/*
  ****************************************************
  *  Author: Armin Silatani
  *  Date: 2026-05-28
  *  Version: 1.0.0
  ****************************************************
*/

/* =========================== FONTS & VARIABLES =========================== */

@font-face {
    font-family: "Kalameh";
    src: url("../../assets/fonts/KalamehWeb-Regular.woff2") format("woff2"),
         url("../../assets/fonts/KalamehWeb-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Kalameh";
    src: url("../../assets/fonts/KalamehWeb-Black.woff2") format("woff2"),
         url("../../assets/fonts/KalamehWeb-Black.woff") format("woff");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg:     #0d0d0d;
    --text:   #f5f5f5;
    --accent: #B0FFA5;
    --border: rgba(255, 255, 255, 0.08);
}

/* =========================== RESET & BASE =========================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kalameh', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================== HEADER =========================== */

.glass-header {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.header-logo {
    height: 40px;
    width: auto;
}

.header-text h1 {
    font-weight: 900;
    font-size: 22px;
    line-height: 22px;
    margin-top: 7px;
    color: var(--text);
}

.header-text h2 {
    font-weight: 400;
    font-size: 14px;
    line-height: 18px;
    color: var(--text);
    opacity: 0.7;
    margin: 0;
}

.tool-description {
    margin-top: 10px;
    font-size: 14px;
    color: rgba(245, 245, 245, 0.6);
    max-width: 600px;
    text-align: left;
}

/* =========================== CONTAINER & VIEWS =========================== */

.container {
    width: 100%;
    max-width: 800px;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    flex: 1;
    align-self: center;
}

/* Expands width when builder mode is active */
.container.builder-mode {
    max-width: 1300px;
}

.view {
    transition: opacity 0.3s ease;
}

.view.hidden {
    display: none;
}

/* =========================== SEARCH & FILTERS =========================== */

.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(245, 245, 245, 0.5);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

#searchInput:focus {
    border-color: var(--accent);
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.08);
}

.filter-chip.active {
    background: var(--accent);
    color: #0d0d0d;
    border-color: var(--accent);
    font-weight: 400;
}

/* =========================== BUTTONS =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    transition: all 0.2s;
}

.btn-accent {
    background: var(--accent);
    color: #0d0d0d;
    font-weight: 400;
    border: none;
}

.btn-accent:hover {
    opacity: 0.9;
}

.btn-outline {
    border: 1px solid var(--border);
    background: transparent;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
    padding: 8px;
    line-height: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.full-width {
    width: 100%;
    justify-content: center;
    margin-top: 16px;
}

/* ------------------------- BACK BUTTON WITH ANIMATION ------------------------- */

.btn-back {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: rgba(245, 245, 245, 0.6);
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: padding    0.3s cubic-bezier(0.25, 0.8, 0.25, 1.2),
                color      0.3s ease,
                background 0.3s ease;
}

.btn-back:hover {
    padding-right: 14px;
    color: var(--accent);
    background: rgba(176, 255, 165, 0.06);
}

.back-icon {
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1.2);
}

.btn-back:hover .back-icon {
    transform: translateX(-3px);
}

/* Hidden text that reveals on hover */
.back-text {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 400;
    font-family: inherit;
    margin-left: 0;
    transform: translateY(1px);
    transition: max-width   0.4s cubic-bezier(0.25, 0.8, 0.25, 1.2),
                opacity     0.3s ease 0.1s,
                margin-left 0.3s ease;
}

.btn-back:hover .back-text {
    max-width: 60px;
    opacity: 1;
    margin-left: 1px;
}

/* =========================== PROMPT FORM =========================== */

.prompt-form {
    margin-bottom: 24px;
}

.prompt-form.hidden {
    display: none;
}

.form-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
}

.form-card h3 {
    font-weight: 900;
    margin-bottom: 16px;
    color: var(--accent);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    resize: vertical;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23f5f5f5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group select[multiple] {
    height: auto;
    min-height: 80px;
    padding: 8px;
}

.form-group select[multiple] option {
    padding: 4px;
    border-radius: 4px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group small {
    font-size: 12px;
    opacity: 0.5;
    margin-top: 4px;
    display: block;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* =========================== PROMPT CARDS =========================== */

.prompt-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prompt-card {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    min-height: 80px;
}

.prompt-card:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.prompt-card.pinned {
    border-color: var(--accent);
    background: rgba(176, 255, 165, 0.05);
}

/* ------------------------- CARD MAIN CONTENT ------------------------- */

.card-main-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-name {
    font-weight: 400;
    font-size: 16px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card-category {
    display: inline-block;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    color: var(--accent);
}

/* AI badge with divider */
.ai-badge {
    position: relative;
    padding-right: 12px;
    margin-right: 4px;
    font-size: 12px;
    color: rgba(245, 245, 245, 0.6);
    font-weight: 400;
}

.ai-badge::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 12px;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 1px;
}

.ai-badge:last-child {
    padding-right: 0;
    margin-right: 0;
}

.ai-badge:last-child::after {
    display: none;
}

/* Pin and lock icons */
.card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.card-lock-icon {
    width: 18px;
    height: 18px;
    color: rgba(245, 245, 245, 0.5);
    flex-shrink: 0;
    margin-right: 2px;
}

.card-pin {
    background: none;
    border: none;
    color: rgba(245, 245, 245, 0.4);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 8px;
}

.card-pin:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.card-pin.pinned {
    color: var(--accent);
}

/* =========================== IN-CARD PASSWORD FORM =========================== */

.card-password-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 14px 18px;
    gap: 10px;
    background: inherit;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.prompt-card.password-active .card-main-content {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.prompt-card.password-active .card-password-form {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.prompt-card.password-active {
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(176, 255, 165, 0.08);
    transform: scale(1.02);
}

.card-password-text {
    font-size: 13px;
    font-weight: 400;
    color: rgba(245, 245, 245, 0.75);
    margin: 0;
    line-height: 1.4;
}

.card-password-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.card-password-input:focus {
    border-color: var(--accent);
}

.card-password-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.card-password-actions .btn {
    padding: 6px 14px;
    font-size: 13px;
}

.card-password-error {
    color: #ff6b6b;
    font-size: 11px;
    min-height: 16px;
    line-height: 1.2;
}

/* =========================== BUILDER VIEW =========================== */

.builder-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.builder-title {
    font-weight: 400;
    font-size: 20px;
    color: var(--accent);
}

/* Full-width AI models row above the two columns */
.ai-models-full {
    width: 100%;
    margin-bottom: 24px;
}

.ai-status-section {
    margin-bottom: 0;
}

.ai-status-section h4 {
    font-weight: 400;
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--accent);
}

.ai-status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-status-chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.2s;
}

.ai-status-chip.ai-active {
    background: rgba(176, 255, 165, 0.15);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 400;
}

.ai-status-chip.ai-inactive {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(245, 245, 245, 0.4);
}

/* ------------------------- TWO-COLUMN LAYOUT ------------------------- */

.builder-columns {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

.builder-left,
.builder-right {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Input column */
.placeholder-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 8px;
}

.placeholder-field label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: 400;
    color: var(--accent);
}

.placeholder-field input,
.placeholder-field textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    resize: vertical;
}

.placeholder-field input:focus,
.placeholder-field textarea:focus {
    border-color: var(--accent);
}

/* Output column */
.result-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-top: 0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.result-header span {
    font-weight: 400;
    font-size: 14px;
    color: var(--accent);
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

#generatedPrompt {
    width: 100%;
    flex: 1;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    outline: none;
}

/* Blinking cursor typing effect */
#generatedPrompt.typing::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--accent);
    font-weight: 900;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ------------------------- PROMPT DESCRIPTION ------------------------- */

.prompt-description {
    background: rgba(176, 255, 165, 0.04);
    border: 1px solid rgba(176, 255, 165, 0.12);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    color: rgba(245, 245, 245, 0.75);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.prompt-description:empty {
    display: none;
}

/* =========================== RESPONSIVE =========================== */

@media (max-width: 640px) {
    .builder-columns {
        flex-direction: column;
    }

    .builder-left,
    .builder-right {
        flex: 1 1 100%;
        width: 100%;
    }

    .result-area {
        min-height: 50vh;
    }
}

/* =========================== FOOTER =========================== */

.footer {
    padding: 30px 0;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border);
    width: 100%;
}

.footer-signature {
    display: flex;
    align-items: center;
    gap: 3px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.footer-signature:hover {
    opacity: 1;
}

.crafted {
    font-size: 10px;
    color: #7a7a7a;
    letter-spacing: 0.08em;
}

.signature {
    height: 20px;
    transform: translateY(-2px);
    opacity: 0.85;
    filter: brightness(0.9) contrast(1.05);
}

.footer-signature a {
    display: contents;
    text-decoration: none;
    color: inherit;
}

.footer-signature a:hover {
    text-decoration: none;
}
