/* ==========================================================================
   🧠 NEXTEDU NEXUS — MULTIMODAL AI DOUBT LAB STYLESHEET (v7.0.0)
   Obsidian Dark + Frosted Light • 60FPS Hardware Accelerated
   Vision Engine • Voice Dictation • Pedagogical Solutions • TTS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Poppins:wght@300;400;500;600;700;800&family=Orbitron:wght@600;700;800;900&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS (Chocolaty Dark & Frosted White/Purple Light)
   ========================================================================== */
:root, [data-theme="dark"] {
    --nexus-bg: #140e0c;
    --nexus-bg-alt: #1a120f;
    --nexus-bg-gradient: radial-gradient(circle at 50% -10%, #2a1813 0%, #140e0c 80%);
    --nexus-surface: #1d1512;
    --nexus-surface-card: #201714;
    --nexus-surface-hover: #261c18;
    --nexus-surface-solid: #1d1512;
    --nexus-glass: rgba(29, 21, 18, 0.94);
    --nexus-glass-border: rgba(255, 255, 255, 0.08);
    --nexus-glass-border-hover: rgba(16, 185, 129, 0.45);
    --nexus-text: #f8fafc;
    --nexus-text-muted: #cbd5e1;
    --nexus-text-dim: #94a3b8;
    --nexus-primary: #10b981;
    --nexus-primary-hover: #059669;
    --nexus-primary-light: rgba(16, 185, 129, 0.12);
    --nexus-cyan: #10b981;
    --nexus-blue: #3b82f6;
    --nexus-purple: #10b981;
    --nexus-amber: #f59e0b;
    --nexus-emerald: #10b981;
    --nexus-rose: #ef4444;
    --nexus-gold: #fbbf24;
    --nexus-gold-glow: rgba(251, 191, 36, 0.28);
    
    --card-border: rgba(16, 185, 129, 0.2);
    --card-bg: rgba(29, 21, 18, 0.94);
    --input-bg: #241a16;
    
    --nexus-shadow: 0 16px 44px rgba(0, 0, 0, 0.6);
    --nexus-glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --nexus-font: 'Poppins', sans-serif;
    --nexus-font-heading: 'Outfit', sans-serif;
    --nexus-font-mono: 'Orbitron', monospace;
    --nexus-max-width: 900px;
    --nexus-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --nexus-bg: #fbf9fe;
    --nexus-bg-alt: #f3eefc;
    --nexus-bg-gradient: radial-gradient(circle at 50% -10%, #ede8f5 0%, #fbf9fe 85%);
    --nexus-surface: #ffffff;
    --nexus-surface-card: #ffffff;
    --nexus-surface-hover: #faf7ff;
    --nexus-surface-solid: #ffffff;
    --nexus-glass: rgba(255, 255, 255, 0.94);
    --nexus-glass-border: rgba(124, 58, 237, 0.12);
    --nexus-glass-border-hover: rgba(124, 58, 237, 0.4);
    --nexus-text: #1e1b4b;
    --nexus-text-muted: #5b5570;
    --nexus-text-dim: #8b859e;
    --nexus-primary: #7c3aed;
    --nexus-primary-hover: #6d28d9;
    --nexus-primary-light: rgba(124, 58, 237, 0.08);
    --nexus-cyan: #7c3aed;
    --nexus-blue: #6366f1;
    --nexus-purple: #7c3aed;
    --nexus-amber: #d97706;
    --nexus-emerald: #059669;
    --nexus-rose: #dc2626;
    --nexus-gold: #d97706;
    --nexus-gold-glow: rgba(217, 119, 6, 0.18);
    
    --card-border: rgba(124, 58, 237, 0.12);
    --card-bg: #ffffff;
    --input-bg: #f5f2fa;
    
    --nexus-shadow: 0 16px 40px rgba(124, 58, 237, 0.08);
    --nexus-glass-shadow: 0 8px 30px 0 rgba(124, 58, 237, 0.06);
}

/* ==========================================================================
   2. GLOBAL CANVAS & RESET
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body.dashboard-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--nexus-bg);
    background-image: var(--nexus-bg-gradient);
    background-attachment: fixed;
    color: var(--nexus-text);
    font-family: var(--nexus-font);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 20px));
    position: relative;
    overflow-x: hidden;
}

/* Ambient glow orbs */
body.dashboard-body::before {
    content: '';
    position: fixed;
    width: 48vw;
    height: 48vw;
    max-width: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
    top: -10%;
    left: -10%;
    z-index: 0;
    pointer-events: none;
    filter: blur(90px);
    transform: translateZ(0);
}
[data-theme="light"] body.dashboard-body::before {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.08) 0%, transparent 70%);
}

body.dashboard-body::after {
    content: '';
    position: fixed;
    width: 42vw;
    height: 42vw;
    max-width: 450px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.06) 0%, transparent 70%);
    bottom: 8%;
    right: -10%;
    z-index: 0;
    pointer-events: none;
    filter: blur(90px);
    transform: translateZ(0);
}

.main-content {
    width: 100%;
    max-width: var(--nexus-max-width);
    margin: 0 auto;
    padding: 10px 18px 40px;
    position: relative;
    z-index: 5;
    animation: doubtFadeUp 0.5s var(--nexus-ease) forwards;
}

@keyframes doubtFadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   3. APP HEADER (NEXUS COMPACT)
   ========================================================================== */
.app-header {
    width: 100%;
    max-width: var(--nexus-max-width);
    margin: 14px auto 8px;
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
}

.header-greeting-box,
.header-greeting {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-top-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 9999px;
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    color: var(--nexus-text);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s var(--nexus-ease);
}
.btn-top-back:hover {
    border-color: var(--nexus-primary);
    color: var(--nexus-primary);
    transform: translateY(-1px);
}

.brand-text-block {
    display: flex;
    flex-direction: column;
}

.nexus-header-btn {
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--nexus-text);
    font-size: 1.15rem;
    transition: all 0.25s var(--nexus-ease);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nexus-header-btn:hover {
    border-color: var(--nexus-primary);
    color: var(--nexus-primary);
    transform: scale(1.05);
    background: var(--nexus-surface-hover);
    box-shadow: 0 4px 16px var(--nexus-cyan-glow);
}

.back-btn-header {
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--nexus-text);
    font-size: 1.1rem;
    transition: all 0.25s var(--nexus-ease);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.back-btn-header:hover {
    border-color: var(--nexus-primary);
    color: var(--nexus-primary);
    transform: translateX(-3px);
    background: var(--nexus-surface-hover);
    box-shadow: 0 4px 16px var(--nexus-cyan-glow);
}

.header-brand-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    padding: 8px 16px;
    border-radius: 999px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.header-brand-pill .brand-title {
    font-family: var(--nexus-font-heading);
    font-weight: 800;
    font-size: 1.12rem;
    letter-spacing: -0.3px;
    color: var(--nexus-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-brand-pill .brand-badge {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(129, 140, 248, 0.2) 100%);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: var(--nexus-cyan);
    font-family: var(--nexus-font-mono);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.glossy-btn {
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nexus-text);
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.25s var(--nexus-ease);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.glossy-btn:hover {
    border-color: var(--nexus-gold);
    color: var(--nexus-gold);
    transform: rotate(15deg) scale(1.05);
}

.header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(129, 140, 248, 0.2));
    border: 1px solid var(--nexus-glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--nexus-ease);
    overflow: hidden;
    position: relative;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.header-avatar:hover {
    border-color: var(--nexus-cyan);
    transform: scale(1.06);
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.3);
}

/* ==========================================================================
   4. HERO BANNER — AI DOUBT LAB
   ========================================================================== */
.doubt-hero {
    position: relative;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.94) 0%, rgba(30, 41, 59, 0.9) 100%);
    border-radius: 26px;
    padding: 26px 30px;
    margin-bottom: 22px;
    overflow: hidden;
    color: var(--nexus-text);
    box-shadow: var(--nexus-glass-shadow);
    border: 1px solid var(--nexus-glass-border);
    transition: border-color 0.3s var(--nexus-ease);
}

.doubt-hero:hover {
    border-color: var(--nexus-glass-border-hover);
}

.doubt-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.doubt-hero-left {
    max-width: 600px;
}

.capability-pills-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.cap-pill {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.22);
    color: var(--nexus-cyan);
    font-family: var(--nexus-font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--nexus-emerald);
    font-family: var(--nexus-font-mono);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulseBlink 1.4s infinite;
}

@keyframes pulseBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(1.3); }
}

.doubt-hero-title {
    font-family: var(--nexus-font-heading);
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.4px;
    color: var(--nexus-text);
}

.doubt-hero-sub {
    font-size: 0.92rem;
    color: var(--nexus-text-muted);
    margin: 8px 0 0;
    font-weight: 500;
    line-height: 1.5;
}

.doubt-hero-art {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 640px) {
    .doubt-hero-art {
        display: none;
    }
}

.hero-orb-ring {
    position: absolute;
    inset: 0;
    border: 2px dashed rgba(56, 189, 248, 0.25);
    border-radius: 50%;
    animation: orbSpin 18s linear infinite;
}

.hero-orb-inner {
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 50%;
    animation: orbSpinRev 12s linear infinite;
}

.hero-orb-center {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.35) 0%, rgba(13, 19, 36, 0.9) 100%);
    border: 1px solid rgba(56, 189, 248, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nexus-cyan);
    font-size: 1.3rem;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

@keyframes orbSpin { 100% { transform: rotate(360deg); } }
@keyframes orbSpinRev { 100% { transform: rotate(-360deg); } }

/* ==========================================================================
   5. DAILY QUOTA HUD CARD (#doubt-limit-card)
   ========================================================================== */
.doubt-limit-card {
    background: var(--nexus-surface-card);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 22px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--nexus-glass-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: all 0.3s var(--nexus-ease);
}

.doubt-limit-info {
    flex: 1;
    min-width: 0;
}

.doubt-limit-title {
    font-family: var(--nexus-font-heading);
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--nexus-text);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doubt-limit-plan {
    font-size: 0.78rem;
    color: var(--nexus-text-muted);
    font-weight: 600;
    margin: 0;
}

.doubt-limit-count {
    min-width: 80px;
    text-align: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    color: var(--nexus-cyan);
    font-family: var(--nexus-font-mono);
    font-weight: 800;
    font-size: 0.94rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* ==========================================================================
   6. MULTIMODAL INPUT STUDIO (PHOTO / VOICE / TEXT)
   ========================================================================== */
.studio-card {
    background: var(--nexus-surface-card);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 26px;
    padding: 26px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--nexus-glass-shadow);
    position: relative;
    margin-bottom: 22px;
}

.studio-section-title {
    font-family: var(--nexus-font-heading);
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--nexus-text);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.studio-tabs-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.studio-tab-badge {
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-family: var(--nexus-font-heading);
    font-weight: 700;
    color: var(--nexus-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 📸 Upload Zone (#drop-area) */
.upload-wrapper {
    position: relative;
    width: 100%;
    min-height: 180px;
    border: 2px dashed var(--nexus-glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s var(--nexus-ease);
    background: var(--input-bg);
    margin-bottom: 18px;
    padding: 20px;
    text-align: center;
}

.upload-wrapper:hover {
    border-color: var(--nexus-cyan);
    background: rgba(56, 189, 248, 0.05);
    transform: translateY(-2px);
}

.upload-wrapper.dragover {
    border-color: var(--nexus-cyan);
    background: rgba(56, 189, 248, 0.1);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.upload-wrapper i.upload-icon {
    font-size: 2.5rem;
    color: var(--nexus-cyan);
    margin-bottom: 10px;
    transition: transform 0.25s var(--nexus-ease);
}

.upload-wrapper:hover i.upload-icon {
    transform: scale(1.1);
}

.upload-title {
    font-family: var(--nexus-font-heading);
    font-weight: 800;
    font-size: 0.98rem;
    color: var(--nexus-text);
    margin: 0 0 4px;
}

.upload-sub {
    font-size: 0.78rem;
    color: var(--nexus-text-muted);
    font-weight: 500;
}

#preview-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--nexus-bg);
    display: none;
    z-index: 5;
    border-radius: 18px;
}

.preview-controls-overlay {
    display: none;
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10;
    gap: 8px;
}

.preview-pill-btn {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--nexus-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--nexus-text);
    font-family: var(--nexus-font-heading);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s var(--nexus-ease);
}

.preview-pill-btn:hover {
    background: var(--nexus-cyan);
    color: #060913;
}

.preview-pill-btn.btn-remove:hover {
    background: var(--nexus-rose);
    color: #ffffff;
    border-color: var(--nexus-rose);
}

/* ✍️ Smart Prompt Textarea (#doubtText) */
.composer-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
}

#doubtText,
#followUpText {
    width: 100%;
    min-height: 110px;
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 18px;
    padding: 16px 50px 16px 16px;
    color: var(--nexus-text);
    font-family: var(--nexus-font);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.25s var(--nexus-ease);
    box-sizing: border-box;
    outline: none;
}

#followUpText {
    min-height: 70px;
    padding: 14px 16px;
}

#doubtText:focus,
#followUpText:focus {
    border-color: var(--nexus-cyan);
    background: var(--nexus-surface);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

#doubtText::placeholder,
#followUpText::placeholder {
    color: var(--nexus-text-dim);
    font-weight: 500;
}

/* 🎙️ Voice Button (#voice-input-btn) */
.voice-mic-container {
    position: absolute;
    right: 12px;
    bottom: 14px;
    z-index: 5;
}

#voice-input-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--nexus-cyan);
    cursor: pointer;
    transition: all 0.25s var(--nexus-ease);
    outline: none;
}

#voice-input-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    transform: scale(1.08);
}

#voice-input-btn.listening {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
    animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* Helper Prompt Chips */
.helper-chips-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.helper-chip {
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-family: var(--nexus-font-heading);
    font-weight: 700;
    color: var(--nexus-text-muted);
    cursor: pointer;
    transition: all 0.2s var(--nexus-ease);
}

.helper-chip:hover {
    border-color: var(--nexus-cyan);
    color: var(--nexus-cyan);
    background: rgba(56, 189, 248, 0.08);
    transform: translateY(-1px);
}

/* Primary Solve CTA Button (#solveBtn) */
.btn-primary.btn-solve {
    width: 100%;
    padding: 16px 20px;
    border-radius: 16px;
    font-family: var(--nexus-font-heading);
    font-weight: 900;
    font-size: 1.02rem;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 50%, #818cf8 100%);
    border: none;
    color: #ffffff !important;
    cursor: pointer;
    box-shadow: 0 8px 26px rgba(56, 189, 248, 0.35);
    transition: all 0.3s var(--nexus-ease);
}

.btn-primary.btn-solve:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(56, 189, 248, 0.5);
    filter: brightness(1.06);
}

.btn-primary.btn-solve:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary.btn-solve:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.4);
    transform: none;
}

/* ==========================================================================
   7. AI VISION PIPELINE PROGRESS CARD (#photo-progress-card)
   ========================================================================== */
.photo-progress-card {
    display: none;
    margin: 20px 0 0;
    padding: 20px;
    border: 1px solid var(--nexus-glass-border-hover);
    border-radius: 20px;
    background: var(--nexus-surface);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    animation: popIn 0.3s var(--nexus-ease);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.photo-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--nexus-text);
    font-family: var(--nexus-font-heading);
    font-size: 0.92rem;
    font-weight: 800;
}

.photo-progress-percent {
    min-width: 48px;
    text-align: right;
    color: var(--nexus-cyan);
    font-family: var(--nexus-font-mono);
    font-weight: 800;
    font-size: 1.05rem;
}

.photo-progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
}

.photo-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8 0%, #818cf8 50%, #10b981 100%);
    transition: width 0.35s ease;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.photo-progress-note {
    margin-top: 10px;
    color: var(--nexus-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   8. NEXUS SOLUTION LAB CONTAINER (#solution-area)
   ========================================================================== */
#solution-area {
    display: none;
    margin-top: 24px;
    animation: solutionReveal 0.45s var(--nexus-ease) forwards;
}

@keyframes solutionReveal {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.solution-card {
    background: var(--nexus-surface-card);
    border: 1px solid var(--nexus-glass-border-hover);
    border-radius: 26px;
    padding: 28px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
}

.solution-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--nexus-glass-border);
    padding-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.solution-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.solution-header-title h3 {
    font-family: var(--nexus-font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    color: var(--nexus-text);
}

.solution-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.solution-action-btn {
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 12px;
    padding: 8px 14px;
    font-family: var(--nexus-font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--nexus-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s var(--nexus-ease);
}

.solution-action-btn:hover {
    border-color: var(--nexus-cyan);
    color: var(--nexus-cyan);
    background: rgba(56, 189, 248, 0.08);
}

/* Text-to-Speech Button (#tts-speak-btn) */
#tts-speak-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    color: var(--nexus-cyan);
    transition: all 0.25s var(--nexus-ease);
}

#tts-speak-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    transform: scale(1.08);
}

#tts-speak-btn.speaking {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    color: var(--nexus-purple) !important;
    animation: ttsPulse 1.2s infinite;
}

@keyframes ttsPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Solution Markdown Content (#ai-response) */
.doubt-solution-body {
    color: var(--nexus-text);
    line-height: 1.85;
    font-size: 0.98rem;
    text-align: left;
    font-weight: 500;
}

.doubt-solution-body h3 {
    color: var(--nexus-cyan);
    margin: 20px 0 10px;
    font-family: var(--nexus-font-heading);
    font-size: 1.15rem;
    font-weight: 800;
}

.doubt-solution-body strong,
.doubt-solution-body b {
    color: var(--nexus-text);
    font-weight: 700;
}

.doubt-solution-body pre,
.doubt-solution-body code {
    font-family: var(--nexus-font-mono);
    font-size: 0.88rem;
}

.doubt-solution-body pre {
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 14px;
    padding: 14px;
    overflow-x: auto;
    margin: 14px 0;
}

/* Follow-up Composer Card */
.followup-card {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--nexus-glass-border);
}

.followup-header {
    font-family: var(--nexus-font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--nexus-text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   9. UPGRADE PAYWALL OVERLAY (#upgrade-overlay)
   ========================================================================== */
#upgrade-overlay {
    position: absolute;
    inset: 0;
    background: rgba(6, 9, 19, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 20;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 26px;
    padding: 30px;
    text-align: center;
    animation: overlayFade 0.3s var(--nexus-ease);
}

@keyframes overlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

#upgrade-overlay .lock-icon-box {
    width: 70px;
    height: 70px;
    border-radius: 24px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--nexus-rose);
    margin-bottom: 18px;
}

#upgrade-overlay h3 {
    font-family: var(--nexus-font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--nexus-text);
    margin: 0 0 8px;
}

#upgrade-overlay p {
    font-size: 0.92rem;
    color: var(--nexus-text-muted);
    max-width: 380px;
    margin: 0 0 22px;
    line-height: 1.5;
}

#upgrade-overlay .btn-primary {
    padding: 14px 28px;
    border-radius: 14px;
    font-family: var(--nexus-font-heading);
    font-weight: 800;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border: none;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.25s var(--nexus-ease);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
}

#upgrade-overlay .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.5);
}

/* ==========================================================================
   10. FLOATING GLASS BOTTOM NAVIGATION
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    left: 15px;
    width: calc(100% - 30px);
    max-width: 500px;
    margin: 0 auto;
    right: 15px;
    height: 64px;
    background: var(--nexus-surface);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--nexus-glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border-radius: 32px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--nexus-text-muted);
    text-decoration: none;
    transition: all 0.25s var(--nexus-ease);
    height: 44px;
    width: 44px;
    border-radius: 50%;
    border: 1px solid transparent;
}

.bottom-nav-item i {
    font-size: 1.35rem;
    transition: transform 0.25s var(--nexus-ease);
}

.bottom-nav-item.active {
    color: var(--nexus-cyan) !important;
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.25);
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

.bottom-nav-item:hover {
    color: var(--nexus-cyan);
    background: rgba(56, 189, 248, 0.08);
}

.bottom-nav-item span {
    display: none !important;
}

/* ==========================================================================
   11. TOAST ALERTS SYSTEM
   ========================================================================== */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 90vw;
}

.custom-toast {
    pointer-events: auto;
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    color: var(--nexus-text);
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-width: 260px;
    transform: translateX(100px);
    opacity: 0;
    transition: all 0.3s var(--nexus-ease);
}

.custom-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.custom-toast.success {
    border-left: 4px solid var(--nexus-emerald);
}

.custom-toast.error {
    border-left: 4px solid var(--nexus-rose);
}

.custom-toast.info {
    border-left: 4px solid var(--nexus-cyan);
}

/* ==========================================================================
   12. RESPONSIVE REFINEMENTS
   ========================================================================== */
@media (max-width: 640px) {
    .app-header {
        padding: 8px 12px;
        margin-top: 8px;
    }
    .header-brand-pill .brand-title {
        font-size: 1.05rem;
    }
    .doubt-hero {
        padding: 20px 18px;
        border-radius: 22px;
        margin-bottom: 20px;
    }
    .doubt-hero-title {
        font-size: 1.45rem;
    }
    .studio-card, .solution-card {
        padding: 20px 16px;
        border-radius: 22px;
    }
    .upload-wrapper {
        min-height: 150px;
        padding: 16px;
    }
}

/* ==========================================================================
   13. LIGHT THEME ENHANCEMENTS & HIGH-CONTRAST OPTIMIZATION (White & Purple)
   ========================================================================== */
[data-theme="light"] {
    --card-border: rgba(124, 58, 237, 0.12);
    --card-bg: #ffffff;
    --input-bg: #f5f2fa;
}

[data-theme="light"] body.dashboard-body {
    background-color: #fbf9fe;
    background-image: radial-gradient(circle at 50% -10%, #ede8f5 0%, #fbf9fe 85%);
    color: #1e1b4b;
}

/* Header Controls in Light Mode */
[data-theme="light"] .btn-top-back,
[data-theme="light"] .nexus-header-btn,
[data-theme="light"] .glossy-btn {
    background: #ffffff;
    border-color: rgba(124, 58, 237, 0.15);
    color: #1e1b4b;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.05);
}

[data-theme="light"] .btn-top-back:hover,
[data-theme="light"] .nexus-header-btn:hover,
[data-theme="light"] .glossy-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
    background: #faf7ff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.15);
}

[data-theme="light"] .header-avatar {
    background: #f5f2fa;
    border-color: rgba(124, 58, 237, 0.15);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.05);
}

[data-theme="light"] .header-avatar:hover {
    border-color: #7c3aed;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
}

/* Hero Section in Light Mode */
[data-theme="light"] .doubt-hero {
    background: linear-gradient(135deg, #ffffff 0%, #faf7ff 60%, #f3eefc 100%);
    border: 1px solid rgba(124, 58, 237, 0.18);
    box-shadow: 0 10px 32px rgba(124, 58, 237, 0.08);
}

[data-theme="light"] .doubt-hero-title {
    color: #1e1b4b;
}

[data-theme="light"] .doubt-hero-sub {
    color: #5b5570;
}

[data-theme="light"] .cap-pill {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.22);
    color: #7c3aed;
}

[data-theme="light"] .hero-orb-ring {
    border-color: rgba(124, 58, 237, 0.25);
}

[data-theme="light"] .hero-orb-inner {
    border-color: rgba(124, 58, 237, 0.3);
}

[data-theme="light"] .hero-orb-center {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, rgba(251, 249, 254, 0.95) 100%);
    border-color: rgba(124, 58, 237, 0.35);
    color: #7c3aed;
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.2);
}

/* Daily Quota HUD Card */
[data-theme="light"] .doubt-limit-card {
    background: #ffffff;
    border: 1px solid rgba(124, 58, 237, 0.12);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.05);
}

[data-theme="light"] .doubt-limit-title {
    color: #1e1b4b;
}

[data-theme="light"] .doubt-limit-plan {
    color: #5b5570;
}

[data-theme="light"] .doubt-limit-count {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.2);
    color: #7c3aed;
}

/* Studio & Solution Cards */
[data-theme="light"] .studio-card,
[data-theme="light"] .solution-card {
    background: #ffffff;
    border: 1px solid rgba(124, 58, 237, 0.12);
    box-shadow: 0 10px 32px rgba(124, 58, 237, 0.06);
}

[data-theme="light"] .studio-section-title {
    color: #1e1b4b;
}

[data-theme="light"] .studio-tab-badge {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.12);
    color: #5b5570;
}

/* Upload Area */
[data-theme="light"] .upload-wrapper {
    background: #fbf9fe;
    border: 2px dashed rgba(124, 58, 237, 0.2);
}

[data-theme="light"] .upload-wrapper:hover {
    background: rgba(124, 58, 237, 0.04);
    border-color: #7c3aed;
}

[data-theme="light"] .upload-wrapper.dragover {
    background: rgba(124, 58, 237, 0.08);
    border-color: #7c3aed;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.15);
}

[data-theme="light"] .upload-title {
    color: #1e1b4b;
}

[data-theme="light"] .upload-sub {
    color: #5b5570;
}

[data-theme="light"] #preview-img {
    background: #f5f2fa;
}

[data-theme="light"] .preview-pill-btn {
    background: #ffffff;
    border: 1px solid rgba(124, 58, 237, 0.18);
    color: #1e1b4b;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

[data-theme="light"] .preview-pill-btn:hover {
    background: #7c3aed;
    color: #ffffff;
}

/* Textareas & Prompts */
[data-theme="light"] #doubtText,
[data-theme="light"] #followUpText {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.16);
    color: #1e1b4b;
}

[data-theme="light"] #doubtText:focus,
[data-theme="light"] #followUpText:focus {
    background: #ffffff;
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

[data-theme="light"] #doubtText::placeholder,
[data-theme="light"] #followUpText::placeholder {
    color: #8b859e;
}

/* Voice Mic Button */
[data-theme="light"] #voice-input-btn {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.25);
    color: #7c3aed;
}

[data-theme="light"] #voice-input-btn:hover {
    background: rgba(124, 58, 237, 0.16);
}

/* Helper Chips */
[data-theme="light"] .helper-chip {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.12);
    color: #5b5570;
}

[data-theme="light"] .helper-chip:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: #7c3aed;
    color: #7c3aed;
}

/* Primary Solve CTA */
[data-theme="light"] .btn-primary.btn-solve {
    color: #ffffff !important;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    box-shadow: 0 8px 26px rgba(124, 58, 237, 0.35);
}

/* Photo Progress Card */
[data-theme="light"] .photo-progress-card {
    background: #ffffff;
    border: 1px solid rgba(124, 58, 237, 0.12);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.06);
}

[data-theme="light"] .photo-progress-top {
    color: #1e1b4b;
}

[data-theme="light"] .photo-progress-track {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.12);
}

[data-theme="light"] .photo-progress-note {
    color: #5b5570;
}

/* Solution Details & Action Buttons */
[data-theme="light"] .solution-header-bar {
    border-bottom: 1px solid rgba(124, 58, 237, 0.1);
}

[data-theme="light"] .solution-header-title h3 {
    color: #1e1b4b;
}

[data-theme="light"] .solution-action-btn {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.15);
    color: #1e1b4b;
}

[data-theme="light"] .solution-action-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.06);
}

[data-theme="light"] #tts-speak-btn {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.15);
    color: #7c3aed;
}

[data-theme="light"] #tts-speak-btn:hover {
    background: rgba(124, 58, 237, 0.1);
}

/* Solution Markdown Content */
[data-theme="light"] .doubt-solution-body {
    color: #1e1b4b;
}

[data-theme="light"] .doubt-solution-body h3 {
    color: #7c3aed;
}

[data-theme="light"] .doubt-solution-body strong,
[data-theme="light"] .doubt-solution-body b {
    color: #1e1b4b;
}

[data-theme="light"] .doubt-solution-body pre {
    background: #f5f2fa;
    border: 1px solid rgba(124, 58, 237, 0.12);
    color: #1e1b4b;
}

[data-theme="light"] .doubt-solution-body code {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
}

[data-theme="light"] .followup-card {
    border-top: 1px solid rgba(124, 58, 237, 0.1);
}

[data-theme="light"] .followup-header {
    color: #1e1b4b;
}

/* Forced Dark Glass for Paywall Overlay across all themes */
#upgrade-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 6, 5, 0.94) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-radius: 26px;
    z-index: 50;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 24px;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
    color: #f8fafc !important;
}

#upgrade-overlay h3 {
    color: #f8fafc !important;
    margin: 12px 0 8px;
    font-size: 1.3rem;
}

#upgrade-overlay p {
    color: #cbd5e1 !important;
    font-size: 0.92rem;
    max-width: 380px;
    margin-bottom: 20px;
}

/* Toast Notifications */
[data-theme="light"] .custom-toast {
    background: #ffffff;
    border: 1px solid rgba(124, 58, 237, 0.12);
    color: #1e1b4b;
    box-shadow: 0 16px 36px rgba(124, 58, 237, 0.12);
}
