/* ═══════════════════════════════════════════════════
   PROMPT COMPOSER — Modal Styles
   A guided prompt builder for AI image generation.
   ═══════════════════════════════════════════════════ */

/* ── Modal Overlay ──────────────────────────────── */
#prompt-composer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

#prompt-composer-overlay.active {
    display: flex;
    opacity: 1;
}

/* ── Modal Container ────────────────────────────── */
#prompt-composer-modal {
    width: 100%;
    max-width: 56rem;
    /* 896px */
    height: calc(100vh - 1.5rem);
    max-height: 700px;
    background: #0D1117;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 1rem;
    box-shadow:
        0 0 0 1px rgba(139, 92, 246, 0.08),
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 80px -20px rgba(139, 92, 246, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#prompt-composer-overlay.active #prompt-composer-modal {
    transform: scale(1) translateY(0);
}

/* ── Header ─────────────────────────────────────── */
.pc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.04) 0%, transparent 100%);
}

.pc-header-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f0f0f5;
    letter-spacing: -0.01em;
}

.pc-header-subtitle {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 2px;
}

.pc-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pc-close-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #e0e0e5;
}

.pc-close-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ── Body Layout ────────────────────────────────── */
.pc-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ── Subject Type Selector (Step 1) ─────────────── */
.pc-subject-selector {
    padding: 1rem 1.25rem;
    flex-shrink: 0;
}

.pc-subject-selector h3 {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 0.625rem;
}

.pc-subject-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.pc-subject-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    border: 1.5px solid rgba(75, 85, 99, 0.4);
    background: rgba(31, 41, 55, 0.3);
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
}

.pc-subject-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.05);
    color: #d1d5db;
}

.pc-subject-card.active {
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.1);
    color: #e9d5ff;
    box-shadow: 0 0 16px -4px rgba(139, 92, 246, 0.2);
}

.pc-subject-card svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

/* ── Tab Bar ────────────────────────────────────── */
.pc-tab-bar {
    display: flex;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(55, 65, 81, 0.3);
    overflow-x: auto;
    flex-shrink: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.pc-tab-bar::-webkit-scrollbar {
    display: none;
}

.pc-tab-pill {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pc-tab-pill:hover {
    background: rgba(75, 85, 99, 0.25);
    color: #d1d5db;
}

.pc-tab-pill.active {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.pc-tab-pill svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* ── Tab Content Area ───────────────────────────── */
.pc-content-wrapper {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.pc-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    min-width: 0;
}

/* Custom scrollbar */
.pc-content-area::-webkit-scrollbar {
    width: 4px;
}

.pc-content-area::-webkit-scrollbar-track {
    background: transparent;
}

.pc-content-area::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.2);
    border-radius: 4px;
}

/* ── Field Groups ───────────────────────────────── */
.pc-field-group {
    margin-bottom: 1.25rem;
}

.pc-field-group:last-child {
    margin-bottom: 0;
}

.pc-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #d1d5db;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

/* Bordered sub-section (like Hair group) */
.pc-field-section {
    padding: 0.75rem;
    border-radius: 0.625rem;
    background: rgba(31, 41, 55, 0.2);
    border: 1px solid rgba(75, 85, 99, 0.2);
}

.pc-field-section h4 {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #e5e7eb;
    margin-bottom: 0.75rem;
}

.pc-field-section .pc-field-group {
    margin-bottom: 0.875rem;
}

/* ── Option Pills (Face Shape, Expression, etc.) ─ */
.pc-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.pc-pill {
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    border: none;
    background: rgba(31, 41, 55, 0.5);
    box-shadow: inset 0 0 0 1px rgba(75, 85, 99, 0.4);
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pc-pill:hover {
    background: rgba(75, 85, 99, 0.35);
    color: #e5e7eb;
}

.pc-pill.selected {
    background: rgba(139, 92, 246, 0.18);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.5);
    color: #c4b5fd;
}

/* ── Color Swatches (Skin Tone, Eye Color, etc.) ─ */
.pc-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.pc-swatch {
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 0.375rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pc-swatch:hover {
    border-color: rgba(139, 92, 246, 0.4);
    transform: scale(1.1);
}

.pc-swatch.selected {
    border-color: #a78bfa;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
    transform: scale(1.1);
}

/* Round variant (eye color) */
.pc-swatch.round {
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
}

/* ── Slider (Age Range) ─────────────────────────── */
.pc-slider-group {
    margin-bottom: 1.25rem;
}

.pc-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.pc-slider-label span:first-child {
    font-size: 0.7rem;
    font-weight: 600;
    color: #d1d5db;
}

.pc-slider-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: #a78bfa;
}

.pc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(55, 65, 81, 0.5);
    outline: none;
}

.pc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.pc-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 5px rgba(139, 92, 246, 0.25);
}

.pc-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b5cf6;
    border: none;
    cursor: pointer;
}

.pc-slider-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.375rem;
}

.pc-slider-ticks span {
    font-size: 0.625rem;
    color: #6b7280;
}

/* ── Textarea (Additional Details, Outfit Desc) ── */
.pc-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(75, 85, 99, 0.4);
    background: rgba(31, 41, 55, 0.4);
    color: #e5e7eb;
    font-size: 0.8rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.pc-textarea::placeholder {
    color: #6b7280;
}

.pc-textarea:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.08);
}

/* ── Product Assist ─────────────────────────────── */
.pc-assist-panel {
    border: 1px solid rgba(139, 92, 246, 0.18);
    border-radius: 0.75rem;
    padding: 0.875rem;
    background: rgba(17, 24, 39, 0.38);
}

.pc-assist-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e9d5ff;
    margin-bottom: 0.25rem;
}

.pc-assist-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.5;
    margin-bottom: 0.875rem;
}

.pc-assist-hidden-input {
    display: none;
}

.pc-assist-upload {
    width: 100%;
    border: 1px dashed rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.06);
    color: #d8b4fe;
    border-radius: 0.625rem;
    padding: 0.875rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    transition: all 0.18s ease;
    margin-bottom: 0.875rem;
}

.pc-assist-upload:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.65);
}

.pc-assist-upload svg {
    width: 1.25rem;
    height: 1.25rem;
}

.pc-assist-upload span {
    font-size: 0.78rem;
    font-weight: 600;
}

.pc-assist-upload small {
    font-size: 0.65rem;
    color: #9ca3af;
}

.pc-assist-preview-wrap {
    margin-bottom: 0.875rem;
}

.pc-assist-preview {
    width: 100%;
    max-width: 240px;
    border-radius: 0.625rem;
    border: 1px solid rgba(75, 85, 99, 0.5);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}

.pc-assist-preview img {
    width: 100%;
    display: block;
    object-fit: cover;
    max-height: 220px;
}

.pc-assist-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.pc-assist-btn-secondary {
    border: 1px solid rgba(75, 85, 99, 0.45);
    background: rgba(31, 41, 55, 0.55);
    color: #d1d5db;
    border-radius: 0.5rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.pc-assist-btn-secondary:hover {
    border-color: rgba(139, 92, 246, 0.45);
    color: #ede9fe;
}

.pc-assist-btn-secondary.danger {
    border-color: rgba(220, 38, 38, 0.35);
    color: #fca5a5;
}

.pc-assist-actions {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.pc-assist-btn-primary {
    border: none;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    border-radius: 0.55rem;
    padding: 0.55rem 0.95rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.28);
}

.pc-assist-btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

.pc-assist-counter {
    font-size: 0.65rem;
    color: #6b7280;
    margin-top: 0.35rem;
    text-align: right;
}

.pc-assist-status {
    border-radius: 0.5rem;
    padding: 0.55rem 0.65rem;
    font-size: 0.72rem;
    line-height: 1.5;
    margin-bottom: 0.6rem;
}

.pc-assist-status.success {
    border: 1px solid rgba(34, 197, 94, 0.32);
    background: rgba(34, 197, 94, 0.1);
    color: #bbf7d0;
}

.pc-assist-status.error {
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.1);
    color: #fecaca;
}

.pc-assist-status.warn {
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.1);
    color: #fde68a;
}

.pc-assist-status ul {
    margin: 0.4rem 0 0 1rem;
    padding: 0;
}

.pc-assist-status li {
    margin-bottom: 0.2rem;
}

/* ── Preview Panel (Desktop sidebar) ────────────── */
.pc-preview-panel {
    display: none;
    width: 280px;
    flex-shrink: 0;
    border-left: 1px solid rgba(55, 65, 81, 0.3);
    padding: 1rem;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.15);
}

.pc-preview-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 0.75rem;
}

.pc-preview-box {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    border-radius: 0.5rem;
    border: 1px solid rgba(75, 85, 99, 0.3);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
}

.pc-preview-text {
    font-size: 0.8rem;
    line-height: 1.6;
    color: #d1d5db;
    white-space: pre-wrap;
    word-break: break-word;
}

.pc-preview-placeholder {
    font-size: 0.75rem;
    color: #4b5563;
    font-style: italic;
}

.pc-copy-btn {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: none;
    background: rgba(55, 65, 81, 0.4);
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pc-copy-btn:hover {
    background: rgba(75, 85, 99, 0.5);
    color: #e5e7eb;
}

.pc-copy-btn svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* ── Footer ─────────────────────────────────────── */
.pc-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(55, 65, 81, 0.3);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
}

.pc-btn-reset {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pc-btn-reset:hover {
    color: #d1d5db;
    background: rgba(55, 65, 81, 0.3);
}

.pc-btn-apply {
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

.pc-btn-apply:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
    transform: translateY(-1px);
}

/* ── Trigger Button (inside prompt textarea) ───── */
.pc-trigger-btn {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    border: none;
    background: rgba(139, 92, 246, 0.12);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pc-trigger-btn:hover {
    background: rgba(139, 92, 246, 0.22);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.5);
    color: #c4b5fd;
}

.pc-trigger-btn svg {
    width: 0.85rem;
    height: 0.85rem;
}

.pc-new-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    margin-left: 0.125rem;
}

/* ── Empty State (no subject selected) ──────────── */
.pc-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: #4b5563;
}

.pc-empty-state svg {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.pc-empty-state p {
    font-size: 0.8rem;
}

/* ── Drag Indicator (mobile bottom-sheet) ───────── */
.pc-drag-indicator {
    display: none;
    /* hidden on desktop */
    justify-content: center;
    padding: 0.5rem 0 0.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.pc-drag-bar {
    width: 2.5rem;
    height: 4px;
    border-radius: 2px;
    background: rgba(156, 163, 175, 0.4);
}

/* ── Bottom Close Button (mobile thumb-friendly) ── */
.pc-bottom-close {
    display: none;
    /* hidden on desktop */
    padding: 0.5rem 1rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(55, 65, 81, 0.3);
}

.pc-bottom-close-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.625rem;
    border: none;
    background: rgba(55, 65, 81, 0.4);
    color: #d1d5db;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pc-bottom-close-btn:hover,
.pc-bottom-close-btn:active {
    background: rgba(75, 85, 99, 0.5);
    color: #fff;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — Mobile-First Overrides
   ═══════════════════════════════════════════════════ */

/* Mobile: full-height bottom-sheet with close affordances */
@media (max-width: 639px) {
    #prompt-composer-overlay {
        padding: 0;
        align-items: flex-end;
    }

    #prompt-composer-modal {
        max-height: none;
        height: 90dvh;
        border-radius: 1rem 1rem 0 0;
        max-width: 100%;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .pc-drag-indicator {
        display: flex;
    }

    .pc-bottom-close {
        display: block;
    }

    .pc-header {
        padding: 0.5rem 1rem 0.75rem;
        position: sticky;
        top: 0;
        z-index: 2;
        background: #0D1117;
    }

    .pc-close-btn {
        width: 2.5rem;
        height: 2.5rem;
        background: rgba(55, 65, 81, 0.4);
        border-radius: 50%;
    }

    .pc-close-btn svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .pc-subject-selector {
        padding: 0.75rem 1rem;
    }

    .pc-subject-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.375rem;
    }

    .pc-subject-card {
        padding: 0.5rem 0.5rem;
        font-size: 0.7rem;
        gap: 0.375rem;
    }

    .pc-content-area {
        padding: 0.75rem 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .pc-footer {
        padding: 0.625rem 1rem;
    }
}

/* Small screens: 2‑column subject cards */
@media (max-width: 400px) {
    .pc-subject-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: show preview panel, hide mobile close elements */
@media (min-width: 768px) {
    #prompt-composer-modal {
        height: 80vh;
    }

    .pc-preview-panel {
        display: flex;
    }

    .pc-drag-indicator {
        display: none !important;
    }

    .pc-bottom-close {
        display: none !important;
    }

    .pc-header {
        padding: 1rem 1.5rem;
    }

    .pc-subject-selector {
        padding: 1rem 1.5rem;
    }

    .pc-content-area {
        padding: 1rem 1.5rem;
    }

    .pc-footer {
        padding: 0.875rem 1.5rem;
    }
}
