/* JLEARN FLAWLESS DESIGN SYSTEM v3.0 */
/* Loaded AFTER styles.css and modern-enhancements.css */

/* === 1. ROOT TOKENS === */
:root {
    /* primary-color matches styles.css */
    --primary-color: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #eef2ff;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --secondary-color: #06b6d4;
    --secondary-dark: #0891b2;
    --secondary-light: #cffafe;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --info-color: #3b82f6;
    --info-light: #dbeafe;
    --bg-color: #f8fafc;
    --bg-secondary: #f1f5f9;
    --surface-color: #ffffff;
    --surface-elevated: #ffffff;
    /* text-color matches styles.css */
    --text-color: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --hover-bg: #f8fafc;
    --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
    --shadow-sm: 0 1px 3px rgba(15,23,42,.06),0 1px 2px rgba(15,23,42,.04);
    --shadow: 0 4px 6px -1px rgba(15,23,42,.07),0 2px 4px -2px rgba(15,23,42,.05);
    --shadow-md: 0 6px 12px -2px rgba(15,23,42,.08),0 3px 6px -2px rgba(15,23,42,.04);
    --shadow-lg: 0 12px 24px -4px rgba(15,23,42,.10),0 6px 12px -4px rgba(15,23,42,.06);
    --shadow-xl: 0 24px 48px -8px rgba(15,23,42,.14),0 12px 24px -6px rgba(15,23,42,.08);
    --shadow-2xl: 0 32px 64px -12px rgba(15,23,42,.20),0 16px 32px -8px rgba(15,23,42,.12);
    --shadow-primary: 0 4px 14px rgba(79,70,229,.25);
    --shadow-primary-lg: 0 8px 24px rgba(79,70,229,.30);
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-md: 14px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    --transition: all .25s cubic-bezier(.4,0,.2,1);
    --transition-fast: all .15s cubic-bezier(.4,0,.2,1);
    --font-sans: 'Poppins',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    --font-display: 'Poppins',-apple-system,BlinkMacSystemFont,sans-serif;
}

[data-theme="dark"] {
    /* Primary: keep consistent with styles.css */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #312e81;
    --primary-50: #1e1b4b;
    --primary-100: #312e81;
    --primary-200: #3730a3;
    --primary-500: #6366f1;
    --primary-600: #818cf8;
    --primary-700: #a5b4fc;
    --secondary-color: #22d3ee;
    --secondary-dark: #06b6d4;
    --secondary-light: #155e75;
    --bg-color: #0b1120;
    --bg-secondary: #0f172a;
    --surface-color: #1e293b;
    --surface-elevated: #243044;
    /* Text: keep consistent with styles.css */
    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-light: #1e293b;
    --hover-bg: #243044;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.3),0 1px 2px rgba(0,0,0,.2);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.3),0 2px 4px -2px rgba(0,0,0,.2);
    --shadow-md: 0 6px 12px -2px rgba(0,0,0,.35),0 3px 6px -2px rgba(0,0,0,.2);
    --shadow-lg: 0 12px 24px -4px rgba(0,0,0,.4),0 6px 12px -4px rgba(0,0,0,.25);
    --shadow-xl: 0 24px 48px -8px rgba(0,0,0,.45),0 12px 24px -6px rgba(0,0,0,.3);
    --shadow-2xl: 0 32px 64px -12px rgba(0,0,0,.55),0 16px 32px -8px rgba(0,0,0,.35);
    --shadow-primary: 0 4px 14px rgba(99,102,241,.3);
    --shadow-primary-lg: 0 8px 24px rgba(99,102,241,.35);
}

/* === 2. BASE TYPOGRAPHY === */
*{ -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; text-rendering:optimizeLegibility; }

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-color);
    background-color: var(--bg-color);
    letter-spacing: -.01em;
}

h1,h2,h3,h4,h5,h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.02em;
    color: var(--text-color);
}
h1{font-size:clamp(2rem,5vw,3.5rem);font-weight:800;}
h2{font-size:clamp(1.5rem,4vw,2.5rem);font-weight:700;}
h3{font-size:clamp(1.25rem,3vw,1.75rem);font-weight:700;}
h4{font-size:clamp(1.1rem,2.5vw,1.375rem);font-weight:600;}
h5{font-size:1.125rem;font-weight:600;}
h6{font-size:1rem;font-weight:600;}
p{line-height:1.7;color:var(--text-secondary);}
a{color:var(--primary-color);transition:var(--transition-fast);}
a:hover{color:var(--primary-dark);}
strong,b{font-weight:700;color:var(--text-color);}
small{font-size:.8125rem;color:var(--text-muted);}
::selection{background:var(--primary-100);color:var(--primary-700);}
[data-theme="dark"] ::selection{background:rgba(129,140,248,.3);color:#c7d2fe;}

/* === 3. SCROLLBAR === */
::-webkit-scrollbar{width:10px;height:10px;}
::-webkit-scrollbar-track{background:var(--bg-secondary);}
::-webkit-scrollbar-thumb{background:var(--border-color);border-radius:var(--radius-full);border:2px solid var(--bg-secondary);}
::-webkit-scrollbar-thumb:hover{background:var(--text-muted);}
[data-theme="dark"] ::-webkit-scrollbar-track{background:#0b1120;}
[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#334155;border-color:#0b1120;}
*{scrollbar-width:thin;scrollbar-color:var(--border-color) var(--bg-secondary);}

/* === 4. NAVBAR === */
.navbar {
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(226,232,240,.8);
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
    padding: .875rem 0;
}
[data-theme="dark"] .navbar {
    background: rgba(15,23,42,.85);
    border-bottom: 1px solid rgba(51,65,85,.6);
}
.nav-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -.03em;
    background: linear-gradient(135deg,var(--primary-color),var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    gap: .625rem;
}
.nav-brand i {
    background: linear-gradient(135deg,var(--primary-color),var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.6rem;
}
.theme-toggle {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.theme-toggle:hover {
    background: var(--primary-50);
    border-color: var(--primary-color);
    transform: rotate(15deg);
}
[data-theme="dark"] .theme-toggle:hover { background: var(--primary-100); }
#teacher-name-display, #student-name-display {
    font-weight: 600; font-size: .875rem;
    color: var(--text-secondary);
    padding: .5rem .875rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

/* === 5. HERO === */
.hero {
    padding: 5rem 0 4rem;
    background: linear-gradient(135deg,#4f46e5 0%,#6366f1 30%,#06b6d4 100%);
    color: white; position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute;
    top: -50%; left: -20%; width: 600px; height: 600px;
    background: radial-gradient(circle,rgba(255,255,255,.08) 0%,transparent 70%);
    border-radius: 50%; animation: heroFloat 20s ease-in-out infinite;
}
.hero::after {
    content: ''; position: absolute;
    bottom: -30%; right: -10%; width: 500px; height: 500px;
    background: radial-gradient(circle,rgba(6,182,212,.12) 0%,transparent 70%);
    border-radius: 50%; animation: heroFloat 25s ease-in-out infinite reverse;
}
@keyframes heroFloat {
    0%,100%{transform:translate(0,0) scale(1);}
    50%{transform:translate(30px,-30px) scale(1.1);}
}
.hero-content { text-align: center; max-width: 640px; margin: 0 auto; position: relative; z-index: 1; }
.hero h1 { color: white; font-size: clamp(2.25rem,5vw,3.5rem); font-weight: 800; margin-bottom: 1rem; text-shadow: 0 2px 20px rgba(0,0,0,.15); }
.hero p { color: rgba(255,255,255,.92); font-size: 1.2rem; margin-bottom: 2rem; font-weight: 400; }
.hero-buttons { gap: 1rem; }
.hero-illustration { position: relative; z-index: 1; }
.hero-illustration i { font-size: 8rem; opacity: .15; animation: heroFloat 15s ease-in-out infinite; }

/* === 6. BUTTONS === */
.btn {
    padding: .75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 42px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-decoration: none;
    letter-spacing: -.01em;
}
.btn::after {
    content: ''; position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg,transparent,rgba(255,255,255,.2),transparent);
    transition: left .5s;
}
.btn:hover::after { left: 100%; }
.btn-primary {
    background: linear-gradient(135deg,var(--primary-color),var(--primary-500));
    color: white;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
    background: linear-gradient(135deg,var(--primary-dark),var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary-lg);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
    background: linear-gradient(135deg,var(--secondary-color),var(--secondary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(6,182,212,.25);
}
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(6,182,212,.3);
}
.btn-success {
    background: linear-gradient(135deg,#10b981,#059669);
    color: white;
    box-shadow: 0 4px 14px rgba(16,185,129,.25);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,185,129,.3); }
.btn-danger {
    background: linear-gradient(135deg,#ef4444,#dc2626);
    color: white;
    box-shadow: 0 4px 14px rgba(239,68,68,.25);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(239,68,68,.3); }
.btn-info {
    background: linear-gradient(135deg,#3b82f6,#2563eb);
    color: white;
    box-shadow: 0 4px 14px rgba(59,130,246,.25);
}
.btn-info:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(59,130,246,.3); }
.btn-text { background: none; color: var(--text-secondary); }
.btn-text:hover { background: var(--bg-secondary); color: var(--text-color); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; pointer-events: none; }
.btn:focus-visible { outline: 3px solid var(--primary-200); outline-offset: 2px; }
.btn-block { width: 100%; }
.btn-large { padding: 1rem 2rem; font-size: 1.1rem; min-width: 200px; min-height: 50px; }
.btn-sm { padding: .5rem 1rem; font-size: .8125rem; min-height: 34px; }

/* === 7. CARDS & SURFACES === */
.feature-card, .login-card, .stat-card, .lesson-card, .completion-card, .video-card, .table-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.feature-card {
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
}
.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}
.feature-card i { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: .5rem; font-size: 1.25rem; }
.feature-card p { color: var(--text-secondary); font-size: .9375rem; }

/* === 8. LOGIN CARDS === */
.login-card {
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 460px;
    width: 100%;
    border: 1px solid var(--border-light);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header i {
    font-size: 3.5rem;
    background: linear-gradient(135deg,var(--primary-color),var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}
.login-header h2 { margin-bottom: .5rem; font-size: 1.75rem; }
.login-header p { color: var(--text-secondary); font-size: .9375rem; }
.login-help {
    margin-top: 1.5rem; padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    text-align: center;
    font-size: .875rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* === 9. FORMS === */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: .5rem;
    font-weight: 600; font-size: .875rem;
    color: var(--text-color);
    letter-spacing: -.01em;
}
.form-group label i { color: var(--primary-color); font-size: .9rem; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: .75rem .875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: .9375rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    transition: var(--transition-fast);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-50);
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-group select:focus {
    box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: var(--text-muted);
}
.form-group small { display: block; margin-top: .25rem; color: var(--text-muted); font-size: .8125rem; }

/* === 10. STAT CARDS === */
.stat-card {
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card i {
    font-size: 2.5rem;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    background: var(--primary-50);
    color: var(--primary-color);
    flex-shrink: 0;
}
[data-theme="dark"] .stat-card i { background: var(--primary-100); }
.stat-info h3 { font-size: 1.75rem; margin-bottom: .125rem; font-weight: 800; }
.stat-info p { font-size: .875rem; color: var(--text-secondary); margin: 0; }

/* === 11. TABLES === */
.table-container {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table thead {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}
.data-table th {
    padding: .875rem 1rem;
    font-weight: 700;
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}
.data-table td {
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-color);
}
.data-table tbody tr { transition: var(--transition-fast); }
.data-table tbody tr:hover { background: var(--hover-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* === 12. DASHBOARD SIDEBAR === */
.dashboard-sidebar {
    background: var(--surface-color);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}
.sidebar-menu { gap: .375rem; }
.menu-item {
    padding: .875rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: .75rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    width: 100%;
    letter-spacing: -.01em;
}
.menu-item i { font-size: 1.15rem; width: 22px; text-align: center; transition: var(--transition); }
.menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-color);
    transform: translateX(3px);
}
.menu-item:hover i { color: var(--primary-color); transform: scale(1.1); }
.menu-item.active {
    background: linear-gradient(135deg,var(--primary-color),var(--primary-500));
    color: white;
    box-shadow: var(--shadow-primary);
}
.menu-item.active i { color: white; }

/* === 13. LESSON CARDS === */
.lesson-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}
.lesson-card-header { margin-bottom: 1rem; }
.lesson-card-body h3 { font-size: 1.15rem; margin-bottom: .5rem; }
.lesson-code {
    background: linear-gradient(135deg,var(--primary-color),var(--primary-500));
    color: white;
    padding: .3rem .75rem;
    border-radius: var(--radius-full);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
    box-shadow: var(--shadow-xs);
}
.lesson-card-footer { margin-top: 1.25rem; gap: .5rem; }

/* === 14. SECTION HEADERS === */
.section-header {
    margin-bottom: 1.75rem;
}
.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

/* === 15. ASSESSMENT SECTION === */
.assessment-section {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}
.assessment-header h3 { font-size: 1.35rem; }
.sticky-timer {
    position: sticky;
    top: 70px;
    background: var(--surface-color);
    padding: .875rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--primary-100);
    display: flex;
    align-items: center;
    gap: .625rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-color);
    z-index: 5;
    transition: var(--transition);
}
[data-theme="dark"] .sticky-timer { border-color: var(--primary-200); }
.sticky-timer i { font-size: 1.25rem; }
.question-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-light);
    transition: var(--transition-fast);
}
.question-card:hover { border-color: var(--primary-200); }
.question-text { font-weight: 600; margin-bottom: 1rem; font-size: 1.05rem; line-height: 1.6; color: var(--text-color); }
.question-number { color: var(--primary-color); font-weight: 800; font-size: 1.1rem; }
.answer-option {
    display: flex;
    align-items: center;
    padding: .875rem 1rem;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.answer-option:hover {
    border-color: var(--primary-color);
    background: var(--primary-50);
    transform: translateX(4px);
}
[data-theme="dark"] .answer-option:hover { background: rgba(99,102,241,.1); }
.answer-option input[type="radio"] { margin-right: .75rem; flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--primary-color); }
.option-letter { font-weight: 700; color: var(--primary-color); margin-right: .75rem; font-size: 1rem; flex-shrink: 0; min-width: 28px; }
.option-text { flex: 1; line-height: 1.5; color: var(--text-color); }

/* === 16. RESULTS === */
.results-section {
    background: var(--surface-color);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}
.results-card { text-align: center; max-width: 640px; margin: 0 auto; }
.results-icon { font-size: 4.5rem; margin-bottom: 1rem; }
.score-display { margin: 2rem 0; }
.score-circle {
    width: 140px; height: 140px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg,var(--primary-color),var(--secondary-color));
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-primary-lg);
}
.score-circle span { font-size: 2.25rem; font-weight: 800; color: white; }
.results-details { text-align: left; margin: 2rem 0; }

/* === 17. MODALS === */
.modal-overlay {
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.modal {
    background-color: var(--surface-color);
    color: var(--text-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border-light);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 1.25rem; font-weight: 700; }
.modal-close {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-fast);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger-color); }
.modal form, .result-details-content { padding: 1.5rem; }
.modal-actions { gap: .75rem; margin-top: 1.5rem; }

/* === 18. VIDEO & MATERIALS === */
.video-section {
    background: linear-gradient(135deg,var(--surface-color) 0%,rgba(79,70,229,.03) 100%);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    border: 1px solid var(--border-light);
}
[data-theme="dark"] .video-section { background: linear-gradient(135deg,var(--surface-color) 0%,rgba(99,102,241,.05) 100%); }
.video-card {
    background: var(--surface-color);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
}
.materials-section {
    background: linear-gradient(135deg,var(--surface-color) 0%,rgba(16,185,129,.03) 100%);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    border: 1px solid var(--border-light);
}
[data-theme="dark"] .materials-section { background: linear-gradient(135deg,var(--surface-color) 0%,rgba(16,185,129,.05) 100%); }
.section-title { border-bottom: 3px solid var(--primary-color); padding-bottom: .75rem; margin-bottom: 1.5rem; }
.section-title i { font-size: 1.5rem; color: var(--primary-color); }
.section-title h3 { font-size: 1.35rem; font-weight: 700; }
.completion-card {
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--border-light);
}
.completion-icon { font-size: 3.5rem; margin-bottom: 1.25rem; }

/* === 19. TABS === */
.tab-btn {
    padding: .75rem 1rem;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: .875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
    background: none;
}
.tab-btn:hover { color: var(--primary-color); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); font-weight: 700; }
.page-tab {
    padding: .625rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: .875rem;
    font-weight: 600;
    background: var(--surface-color);
}
.page-tab:hover { border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-1px); }
.page-tab.active {
    background: linear-gradient(135deg,var(--primary-color),var(--primary-500));
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-primary);
}

/* === 20. EMPTY STATES === */
.empty-state, .empty-state-card {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state i, .empty-state-card i { font-size: 3.5rem; margin-bottom: 1rem; opacity: .4; }
.empty-state p, .empty-state-card p { font-size: .9375rem; }

/* === 21. ERROR & SUCCESS MESSAGES === */
.error-message {
    border-radius: var(--radius);
    border-left: 4px solid var(--danger-color);
    background: linear-gradient(135deg,#fef2f2,#fee2e2);
    color: #991b1b;
    padding: 1rem 1.25rem;
    font-size: .9rem;
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .error-message { background: rgba(239,68,68,.1); color: #fca5a5; }
.success-message {
    border-radius: var(--radius);
    background: var(--success-light);
    color: #065f46;
    padding: .875rem 1rem;
    border: 1px solid rgba(16,185,129,.3);
    font-size: .9rem;
}
[data-theme="dark"] .success-message { background: rgba(16,185,129,.1); color: #6ee7b7; }
.instructions-warning {
    border-radius: var(--radius);
    border-left: 4px solid var(--warning-color);
    background: var(--warning-light);
    color: #92400e;
    padding: 1rem;
    font-size: .9rem;
}
[data-theme="dark"] .instructions-warning { background: rgba(245,158,11,.1); color: #fcd34d; }

/* === 22. LOGIN FOOTER LINKS === */
.login-footer { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-light); }
.login-footer a {
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--primary-color);
    font-weight: 600;
    font-size: .875rem;
    transition: var(--transition);
}
.login-footer a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

/* === 23. FORMAT GUIDE === */
.format-guide {
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-light);
}
.format-guide strong { color: var(--primary-color); }

/* === 24. INSTRUCTION ITEMS === */
.instruction-item {
    border-radius: var(--radius);
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-light);
}
.instruction-item > i { color: var(--primary-color); font-size: 1.35rem; }
.instruction-item strong { font-size: 1rem; color: var(--text-color); }

/* === 25. PAGE TRANSITIONS === */
.page.active { animation: pageFadeIn .35s cubic-bezier(.4,0,.2,1); }
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.assessment-tab-content.active, .assessment-page.active, .dashboard-section.active {
    animation: pageFadeIn .3s cubic-bezier(.4,0,.2,1);
}

/* === 26. MOBILE MENU TOGGLE === */
.mobile-menu-toggle {
    display: none;
    width: 42px; height: 42px;
    border-radius: var(--radius-sm);
    align-items: center; justify-content: center;
    transition: var(--transition-fast);
}
.mobile-menu-toggle:hover { background: var(--bg-secondary); }
.mobile-menu-toggle:active { transform: scale(.95); }

/* === 27. FULLSCREEN BUTTON === */
.fullscreen-btn-external {
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg,var(--primary-color),var(--primary-dark));
    box-shadow: var(--shadow-primary);
    padding: .875rem 1.5rem;
    font-weight: 600;
    font-size: .9375rem;
    transition: var(--transition);
}
.fullscreen-btn-external:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary-lg);
}

/* === 28. VIDEO PROGRESS BAR === */
.video-progress-bar { height: 6px; border-radius: var(--radius-full); background: var(--border-color); }
.video-progress-fill { border-radius: var(--radius-full); background: linear-gradient(90deg,var(--primary-color),var(--secondary-color)); transition: width .3s ease; }

/* === 29. GROUP HEADER === */
.group-header { background: linear-gradient(135deg,var(--primary-color),var(--primary-500)) !important; }
.group-header td { color: white !important; font-weight: 700 !important; }

/* === 30. RESPONSIVE ENHANCEMENTS === */

/* --- TABLET (768px–1024px) --- */
@media (min-width: 768px) and (max-width: 1024px) {
    .container { max-width: min(960px, 94%); padding: 0 24px; }
    .hero { padding: 4rem 0 3rem; }
    .hero h1 { font-size: clamp(2rem, 4vw, 3rem); }
    .hero p { font-size: 1.1rem; }
    .hero-content { max-width: 560px; }
    .hero-buttons { gap: 0.75rem; }
    .hero-buttons .btn { min-width: 160px; }

    /* Feature grid: 2-col on tablet */
    .feature-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    .feature-card { padding: 1.5rem; }
    .feature-card h3 { font-size: 1.15rem; }
    .feature-card p { font-size: .875rem; }

    /* Role grid: 2-col on tablet */
    .role-grid { grid-template-columns: repeat(2, 1fr); }
    .role-card { padding: 1.5rem; }

    /* Tools grid: 2-col on tablet */
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-card { padding: 1.25rem; }

    /* Stats grid: 2-col on tablet */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 1.25rem; }
    .stat-card i { font-size: 2rem; width: 48px; height: 48px; }
    .stat-info h3 { font-size: 1.5rem; }

    /* Login card: slightly wider */
    .login-card { padding: 2rem; max-width: 480px; }
    .login-header i { font-size: 3rem; }

    /* Dashboard sidebar: compact sticky sidebar */
    .dashboard-sidebar {
        position: sticky;
        top: 90px;
        border-radius: var(--radius-lg);
        padding: 1rem;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
    }
    .sidebar-menu { gap: .25rem; }
    .menu-item { padding: .75rem .875rem; font-size: .85rem; }
    .menu-item i { font-size: 1.05rem; }

    /* Dashboard layout: 2-col (sidebar + content) */
    .dashboard-container .container {
        display: grid;
        grid-template-columns: 220px 1fr;
        gap: 1.5rem;
        align-items: start;
    }
    .dashboard-content { padding: 1rem 0; }

    /* Section headers: horizontal on tablet */
    .section-header { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; }
    .section-header h2 { font-size: 1.35rem; }

    /* Tab buttons: horizontal scroll with fade */
    .nav-tabs { gap: 4px; padding-bottom: 4px; }
    .nav-tabs .tab-button { min-width: 110px; padding: 10px 14px; font-size: .85rem; }

    /* Tables: show more columns */
    .data-table { font-size: .85rem; }
    .data-table th { padding: .75rem .875rem; font-size: .78rem; }
    .data-table td { padding: .75rem .875rem; }

    /* Footer: 3-column layout */
    #site-footer { padding: 20px; }
    .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; text-align: left; gap: 24px; }
    .footer-links { align-items: flex-start; }

    /* Lesson cards: 2-col on tablet */
    .lessons-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }

    /* Modal: wider on tablet */
    .modal { max-width: 640px; margin: 5vh auto; }
    .modal-overlay.active { align-items: center; }
}

/* --- LARGE TABLET / SMALL DESKTOP (1024px–1200px) --- */
@media (min-width: 1025px) and (max-width: 1200px) {
    .container { max-width: min(1100px, 94%); }
    .feature-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
    .dashboard-container .container { grid-template-columns: 240px 1fr; }
    .lessons-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- DESKTOP (1200px+) --- */
@media (min-width: 1200px) {
    .hero { padding: 5rem 0 4rem; }
    .hero-content { max-width: 680px; }
    .hero h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); }
    .dashboard-container .container { grid-template-columns: 260px 1fr; gap: 2rem; }
    .lessons-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
}

/* --- MOBILE (max-width: 767px) --- */
@media (max-width: 767px) {
    .hero {
        padding: 3rem 0 2rem;
        text-align: center;
    }
    .hero h1 {
        font-size: 1.65rem !important;
        line-height: 1.25;
    }
    .hero p {
        font-size: .925rem !important;
        line-height: 1.6;
    }
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    .hero-buttons .btn {
        width: 100%;
    }
    .hero-illustration i {
        font-size: 5rem !important;
        opacity: .12;
    }

    /* Feature grid: 1-col */
    .feature-grid { grid-template-columns: 1fr; gap: 1rem; }
    .feature-card { padding: 1.25rem; text-align: left; }
    .feature-card:hover { transform: none; }
    .feature-card i { font-size: 2rem; margin-bottom: .75rem; }

    /* Role grid: 1-col */
    .role-grid { grid-template-columns: 1fr; gap: 10px; }
    .role-card { padding: 1.25rem; border-radius: var(--radius-md); }

    /* Tools grid: 1-col */
    .tools-grid { grid-template-columns: 1fr; }
    .tool-card { padding: 1rem; }

    /* Stats grid: 2-col compact */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1rem;
        min-height: 80px;
    }
    .stat-card i { font-size: 1.5rem; width: 40px; height: 40px; margin-bottom: .5rem; }
    .stat-info h3 { font-size: 1.25rem; }
    .stat-info p { font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; }

    /* Login card */
    .login-card {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
        margin: 0 1rem;
    }
    .login-header i { font-size: 2.5rem; }
    .login-header h2 { font-size: 1.5rem; }
    .login-footer { margin-top: 1.5rem; padding-top: 1rem; }
    .login-footer a { padding: .5rem .875rem; font-size: .825rem; }

    /* Section headers: vertical stack */
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
    }
    .section-header h2 { font-size: 1.2rem; }
    .section-header > div { display: flex; flex-wrap: wrap; gap: 8px; }
    .section-header .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 130px;
        font-size: .825rem;
        padding: 10px 8px;
    }

    /* Lesson cards: 1-col */
    .lessons-grid { grid-template-columns: 1fr; gap: 12px; }
    .lesson-card { padding: 1rem; border-radius: var(--radius-md); }
    .lesson-card:hover { transform: none; }
    .lesson-card-actions { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }

    /* Footer: single column centered */
    #site-footer { padding: 16px 12px; font-size: 11px; }
    .footer-grid { grid-template-columns: 1fr; text-align: center; gap: 16px; }
    .footer-links { align-items: center; }

    /* Tables: horizontal scroll with visual hint */
    .table-container {
        border-radius: var(--radius-md);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table { min-width: 600px; }
    .data-table th { font-size: .7rem; padding: 8px 6px; }
    .data-table td { font-size: .75rem; padding: 8px 6px; }

    /* Cards: disable hover transforms on touch */
    .feature-card:hover, .lesson-card:hover, .stat-card:hover, .role-card:hover,
    .tool-card:hover, .modern-lesson-card:hover, .material-card:hover {
        transform: none;
    }

    /* Modal: bottom sheet on mobile */
    .modal {
        max-width: 100vw !important;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 92dvh;
    }
    .modal-overlay.active { align-items: flex-end; }
    .modal-header { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }

    /* Forms: 16px to prevent iOS zoom */
    .form-group input, .form-group textarea, .form-group select {
        font-size: 16px !important;
        min-height: 46px;
        border-radius: 10px;
    }
    .form-group label { font-size: .8rem; }

    /* Buttons: full-width stacked */
    .btn-primary, .btn-success, .btn-danger, .btn-secondary, .btn-info {
        width: 100%;
        min-height: 48px;
        border-radius: 12px;
    }
}

/* --- EXTRA SMALL PHONES (max-width: 380px) --- */
@media (max-width: 380px) {
    .hero h1 { font-size: 1.4rem !important; }
    .stats-grid { grid-template-columns: 1fr !important; }
    .stat-card { min-height: 70px; padding: .75rem; }
    .stat-info h3 { font-size: 1.1rem; }
    .login-card { padding: 1.25rem; margin: 0 .5rem; }
    .login-header h2 { font-size: 1.3rem; }
    .section-header .btn { flex: 1 1 100%; min-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   STUDENT PORTAL — RESPONSIVE GAP FIXES
   Fixes for inline grid layouts that overflow on small screens
   ═══════════════════════════════════════════════════════════════ */

/* ── Feature cards grid: reduce minmax for small phones ── */
@media (max-width: 400px) {
    div[style*="grid-template-columns: repeat(auto-fit, minmax(320px"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    /* Modality cards: stack on small phones */
    div[style*="grid-template-columns: repeat(auto-fit, minmax(250px"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── Teacher name form-row: stack on mobile ── */
@media (max-width: 520px) {
    .form-row[style*="grid-template-columns: 2fr 1fr 2fr"] {
        grid-template-columns: 2fr !important;
        gap: 0.5rem !important;
    }
}

/* ── AI stats grid: 2-col on mobile instead of 4-col ── */
@media (max-width: 520px) {
    .ai-stats[style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 360px) {
    .ai-stats[style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── Account modal: full mobile ── */
@media (max-width: 640px) {
    #account-modal .modal-content {
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    #account-modal .modal-content > div:first-child {
        padding: 1rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    #account-modal .modal-content > div:first-child > div:first-child {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    #account-modal .modal-content > div:last-child {
        padding: 1rem !important;
        max-height: calc(100vh - 80px) !important;
    }
    #account-modal .modal-content > div:last-child div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── Lesson plan modal: full mobile ── */
@media (max-width: 640px) {
    #lesson-plan-modal {
        width: 100% !important;
        max-width: 100% !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        height: 100vh !important;
    }
    #lesson-plan-modal > div {
        border-radius: 0 !important;
        max-height: 100vh !important;
    }
    #lesson-plan-modal div[style*="border-bottom: 2px solid"] {
        flex-direction: column !important;
        gap: 0.75rem !important;
        padding: 1rem !important;
    }
    #lesson-plan-modal div[style*="display: flex"][style*="gap: 0.75rem"] {
        flex-wrap: wrap !important;
    }
    #lesson-plan-modal div[style*="display: flex"][style*="gap: 0.75rem"] button {
        flex: 1 1 calc(50% - 0.375rem) !important;
        min-width: 0 !important;
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* ── IA filter grid: stack on mobile ── */
@media (max-width: 520px) {
    div[style*="grid-template-columns: repeat(auto-fit, minmax(250px"][style*="gap: 1rem"][style*="margin-bottom: 1rem"] {
        grid-template-columns: 1fr !important;
    }
    div[style*="grid-template-columns: repeat(auto-fit, minmax(200px"][style*="gap: 1rem"][style*="margin-bottom: 1.5rem"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 360px) {
    div[style*="grid-template-columns: repeat(auto-fit, minmax(200px"][style*="gap: 1rem"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── Edit password grid: stack on mobile ── */
@media (max-width: 480px) {
    div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 1rem"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── PPT tools grid: responsive for student portal ── */
@media (max-width: 640px) {
    .ppt-tools-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .ppt-header-inner {
        flex-direction: column !important;
        gap: 0.75rem !important;
        padding: 1rem !important;
    }
    .ppt-header h1 { font-size: 1.3rem !important; }
    .ppt-action-ribbon {
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
    .ppt-action-buttons {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    .ppt-action-buttons button {
        flex: 1 1 calc(50% - 0.25rem) !important;
        min-width: 0 !important;
        font-size: 0.8rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    .ppt-layout-controls {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    .ppt-slides-grid {
        grid-template-columns: 1fr !important;
    }
}
@media (min-width: 641px) and (max-width: 1024px) {
    .ppt-tools-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── LP form grid: responsive for student portal ── */
@media (max-width: 640px) {
    .lp-form-grid {
        grid-template-columns: 1fr !important;
    }
    .lp-form-wide {
        grid-column: 1 !important;
    }
}

/* ── Video section: full-width on mobile ── */
@media (max-width: 640px) {
    .video-card {
        border-radius: 0 !important;
        margin: 0 -15px !important;
        width: calc(100% + 30px) !important;
    }
    .video-section .section-title {
        padding: 0 15px !important;
    }
    .fullscreen-btn-external {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    .video-info-card {
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
    }
}

/* ── Completion card: responsive ── */
@media (max-width: 480px) {
    .completion-card {
        padding: 1.5rem 1rem !important;
        text-align: center !important;
    }
    .completion-card h3 { font-size: 1.2rem !important; }
    .completion-actions {
        flex-direction: column !important;
    }
    .completion-actions .btn { width: 100% !important; }
}

/* ── Results card: responsive ── */
@media (max-width: 480px) {
    .results-card {
        padding: 1.5rem 1rem !important;
    }
    .score-circle {
        width: 120px !important;
        height: 120px !important;
    }
    .score-circle span {
        font-size: 1.8rem !important;
    }
    .results-icon i {
        font-size: 2.5rem !important;
    }
    .results-details .result-item {
        padding: 0.75rem !important;
    }
}

/* ── Footer: responsive for very small phones ── */
@media (max-width: 380px) {
    #site-footer {
        padding: 10px 8px !important;
        font-size: 10px !important;
    }
}

/* ── Table scroll hint: responsive ── */
@media (max-width: 480px) {
    .table-scroll-hint {
        font-size: 0.65rem !important;
        padding: 6px !important;
    }
}

/* ── Materials grid: responsive ── */
@media (max-width: 480px) {
    .materials-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

/* ── Login tabs: responsive ── */
@media (max-width: 380px) {
    .portal-tabs {
        flex-direction: column !important;
    }
    .portal-tabs .btn {
        min-width: 100% !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   END STUDENT PORTAL RESPONSIVE FIXES
   ═══════════════════════════════════════════════════════════════ */

/* === 31. PRINT STYLES === */
@media print {
    .navbar, .mobile-menu-toggle, .mobile-nav-drawer, .mobile-menu-overlay,
    .mobile-view-tabs, .mobile-sticky-action-bar, .dashboard-sidebar,
    .btn, .theme-toggle, #site-footer { display: none !important; }
    .page { display: block !important; opacity: 1 !important; }
    .hero { background: #f0f0f0 !important; color: #000 !important; }
    .hero h1, .hero p { color: #000 !important; }
}

/* === 32. REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === 33. HOVER GUARD (touch devices) === */
@media (hover: none) and (pointer: coarse) {
    .card:hover, .feature-card:hover, .lesson-card:hover, .stat-card:hover,
    .role-card:hover, .tool-card:hover, .modern-lesson-card:hover,
    .material-card:hover, .login-card:hover {
        transform: none !important;
        box-shadow: var(--shadow-sm) !important;
    }
}

/* === 34. SAFE AREA INSETS (notch devices) === */
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
}

/* ═══════════════════════════════════════════════════════════════
   35. COMPREHENSIVE DARK MODE — Master Override Layer
   This section fixes ALL hardcoded colors in inline styles,
   mobile-responsive.css, and HTML <style> blocks.
   Loaded last → highest cascade priority.
   ═══════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
    /* ── Base overrides ── */
    color-scheme: dark;
    background-color: #0b1120;
    color: #e2e8f0;
}

[data-theme="dark"] body {
    background: #0b1120;
    color: #e2e8f0;
}

/* ── Navbar ── */
[data-theme="dark"] .navbar,
[data-theme="dark"] nav.navbar {
    background: rgba(15,23,42,.88) !important;
    border-bottom-color: rgba(51,65,85,.5) !important;
}
[data-theme="dark"] .nav-brand,
[data-theme="dark"] .nav-brand i {
    background: linear-gradient(135deg,#818cf8,#22d3ee);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="dark"] #teacher-name-display,
[data-theme="dark"] #student-name-display {
    background: #1e293b; color: #94a3b8; border-color: #334155;
}
[data-theme="dark"] .theme-toggle {
    background: #1e293b; border-color: #334155; color: #94a3b8;
}
[data-theme="dark"] .theme-toggle:hover {
    background: #312e81; border-color: #818cf8; color: #818cf8;
}

/* ── Hero section ── */
[data-theme="dark"] .hero,
[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg,#312e81 0%,#4338ca 30%,#0e7490 100%) !important;
}
[data-theme="dark"] .hero h1,
[data-theme="dark"] .hero-title { color: #f1f5f9 !important; text-shadow: 0 2px 20px rgba(0,0,0,.4); }
[data-theme="dark"] .hero p,
[data-theme="dark"] .hero-subtitle { color: rgba(241,245,249,.88) !important; }

/* ── All cards, surfaces ── */
[data-theme="dark"] .card,
[data-theme="dark"] .feature-card,
[data-theme="dark"] .login-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .lesson-card,
[data-theme="dark"] .completion-card,
[data-theme="dark"] .video-card,
[data-theme="dark"] .table-container,
[data-theme="dark"] .modern-lesson-card,
[data-theme="dark"] .not-taken-lesson-card,
[data-theme="dark"] .material-card,
[data-theme="dark"] .question-card,
[data-theme="dark"] .role-card,
[data-theme="dark"] .tool-card,
[data-theme="dark"] .instruction-item,
[data-theme="dark"] .format-guide {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.3) !important;
    color: #e2e8f0;
}

/* ── Tables ── */
[data-theme="dark"] .data-table,
[data-theme="dark"] .data-table th,
[data-theme="dark"] table th {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .data-table td,
[data-theme="dark"] table td {
    border-color: #334155 !important;
    color: #e2e8f0;
}
[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] tbody tr:hover td {
    background: rgba(99,102,241,.08) !important;
}
[data-theme="dark"] .data-table thead,
[data-theme="dark"] .table-responsive .data-table thead {
    background: linear-gradient(135deg,#4338ca,#6366f1) !important;
}
[data-theme="dark"] .data-table tbody tr:not(.group-header):nth-child(even) {
    background: #162032 !important;
}
[data-theme="dark"] .data-table tbody tr:not(.group-header):hover {
    background: rgba(99,102,241,.06) !important;
}

/* ── Group headers (always purple gradient) ── */
[data-theme="dark"] .group-header,
[data-theme="dark"] .data-table .group-header,
[data-theme="dark"] table .group-header,
[data-theme="dark"] tbody .group-header {
    background: linear-gradient(135deg,#4338ca,#6366f1) !important;
    color: white !important;
}
[data-theme="dark"] .group-header td,
[data-theme="dark"] .group-header .group-title,
[data-theme="dark"] .group-header .student-count {
    color: white !important;
}

/* ── Dashboard sidebar ── */
[data-theme="dark"] .dashboard-sidebar,
[data-theme="dark"] .dash-sidebar {
    background: #111827 !important;
    border-color: #1f2937 !important;
}
[data-theme="dark"] .sidebar-menu .menu-item,
[data-theme="dark"] .dash-sidebar .menu-item {
    color: #94a3b8 !important;
    background: transparent !important;
}
[data-theme="dark"] .sidebar-menu .menu-item:hover,
[data-theme="dark"] .dash-sidebar .menu-item:hover {
    background: rgba(99,102,241,.1) !important;
    color: #a5b4fc !important;
}
[data-theme="dark"] .sidebar-menu .menu-item.active,
[data-theme="dark"] .dash-sidebar .menu-item.active {
    background: linear-gradient(135deg,#4338ca,#6366f1) !important;
    color: white !important;
}
[data-theme="dark"] .sidebar-menu .menu-item.active i,
[data-theme="dark"] .dash-sidebar .menu-item.active i {
    color: white !important;
}
[data-theme="dark"] .sidebar-drawer-title { color: #e2e8f0; }
[data-theme="dark"] .sidebar-drawer-close { background: #334155; color: #94a3b8; }

/* ── Dashboard content & sections ── */
[data-theme="dark"] .dashboard-content,
[data-theme="dark"] .dashboard-main { background: #0b1120 !important; }
[data-theme="dark"] .dashboard-section,
[data-theme="dark"] .section-header {
    background: #1e293b !important;
}
[data-theme="dark"] .section-header h2 { color: #f1f5f9 !important; }

/* ── Stats cards ── */
[data-theme="dark"] .stat-card i,
[data-theme="dark"] .stat-card .stat-icon {
    background: #312e81 !important;
    color: #818cf8 !important;
}
[data-theme="dark"] .stat-info h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .stat-info p { color: #94a3b8 !important; }

/* ── Login card ── */
[data-theme="dark"] .login-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .login-header h2 { color: #f1f5f9; }
[data-theme="dark"] .login-header p { color: #94a3b8; }
[data-theme="dark"] .login-help {
    background: #0f172a; border-color: #334155; color: #94a3b8;
}
[data-theme="dark"] .login-footer { border-color: #334155; }
[data-theme="dark"] .login-footer a {
    background: #1e293b; border-color: #334155; color: #818cf8;
}
[data-theme="dark"] .login-footer a:hover {
    background: #4f46e5; color: white; border-color: #6366f1;
}

/* ── Forms ── */
[data-theme="dark"] .form-group label { color: #e2e8f0; }
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 4px rgba(99,102,241,.15) !important;
}
[data-theme="dark"] .form-group small { color: #64748b; }
[data-theme="dark"] .form-control { background: #0f172a; border-color: #334155; color: #e2e8f0; }

/* ── Buttons in dark mode ── */
[data-theme="dark"] .btn-text { color: #94a3b8; }
[data-theme="dark"] .btn-text:hover { background: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .btn-sm { background: #334155; color: #e2e8f0; border-color: #475569; }

/* ── Tabs ── */
[data-theme="dark"] .tab-btn,
[data-theme="dark"] .tab-bar .tab,
[data-theme="dark"] .page-tab {
    color: #94a3b8;
    background: transparent;
    border-bottom-color: transparent;
}
[data-theme="dark"] .tab-btn:hover,
[data-theme="dark"] .tab-bar .tab:hover,
[data-theme="dark"] .page-tab:hover {
    color: #818cf8;
}
[data-theme="dark"] .tab-btn.active,
[data-theme="dark"] .tab-bar .tab.active,
[data-theme="dark"] .page-tab.active {
    color: #818cf8;
    border-bottom-color: #818cf8;
    background: rgba(99,102,241,.08);
}
[data-theme="dark"] .nav-tabs .tab-button { background: #1e293b; color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .nav-tabs .tab-button.active { background: #4f46e5; color: white; border-color: #6366f1; }

/* ── Modals ── */
[data-theme="dark"] .modal,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dialog-box {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .ai-header {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .ai-header h3 { color: #f1f5f9; }
[data-theme="dark"] .modal-content { color: #e2e8f0; }
[data-theme="dark"] .modal-close,
[data-theme="dark"] .ai-header button {
    background: #334155; color: #94a3b8;
}
[data-theme="dark"] .modal-close:hover,
[data-theme="dark"] .ai-header button:hover {
    background: rgba(239,68,68,.15); color: #fca5a5;
}
[data-theme="dark"] .modal form,
[data-theme="dark"] .result-details-content { background: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .modal-actions,
[data-theme="dark"] .ai-footer { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .modal-actions .btn-cancel { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .modal-actions .btn-confirm { background: #6366f1; color: white; }

/* ── Assessment page ── */
[data-theme="dark"] .assessment-section { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .question-card { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .question-text { color: #e2e8f0; }
[data-theme="dark"] .answer-option {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}
[data-theme="dark"] .answer-option:hover,
[data-theme="dark"] .answer-option.selected {
    background: rgba(99,102,241,.12) !important;
    border-color: #818cf8 !important;
}
[data-theme="dark"] .option-letter { color: #818cf8; }
[data-theme="dark"] .option-text { color: #e2e8f0; }
[data-theme="dark"] .quiz-question label {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}
[data-theme="dark"] .quiz-question label:active {
    background: rgba(99,102,241,.15) !important;
    border-color: #818cf8 !important;
}
[data-theme="dark"] .quiz-question h4,
[data-theme="dark"] .quiz-question .question-number { color: #f1f5f9; }

/* ── Sticky timer ── */
[data-theme="dark"] .sticky-timer { background: #1e293b; border-color: #4338ca; color: #818cf8; }
[data-theme="dark"] #sticky-timer,
[data-theme="dark"] .quiz-timer {
    background: linear-gradient(135deg,#4338ca,#3730a3) !important;
}
[data-theme="dark"] #violation-counter-main {
    background: linear-gradient(135deg,#dc2626,#991b1b) !important;
}

/* ── Quiz palette ── */
[data-theme="dark"] .quiz-palette-container {
    background: #1e293b; border-color: #334155;
}
[data-theme="dark"] .quiz-palette-item {
    background: #0f172a; border-color: #334155; color: #94a3b8;
}
[data-theme="dark"] .quiz-palette-item.active,
[data-theme="dark"] .quiz-palette-item.current {
    background: #4f46e5; color: white; border-color: #6366f1;
}
[data-theme="dark"] .quiz-palette-item.answered {
    background: #065f46; color: white; border-color: #10b981;
}

/* ── Quiz navigation ── */
[data-theme="dark"] .quiz-navigation {
    background: rgba(15,23,42,.95);
    border-color: #334155;
}

/* ── Footer ── */
[data-theme="dark"] #site-footer {
    background: linear-gradient(135deg,#312e81,#4c1d95) !important;
}

/* ── Lesson cards ── */
[data-theme="dark"] .lesson-card-top,
[data-theme="dark"] .lesson-card-actions {
    background: #0f172a !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .lesson-card-body h3,
[data-theme="dark"] .lesson-title { color: #f1f5f9; }
[data-theme="dark"] .lesson-card-body .subject,
[data-theme="dark"] .meta-item { color: #94a3b8; }
[data-theme="dark"] .lesson-code-badge {
    background: linear-gradient(135deg,#4338ca,#6366f1);
}
[data-theme="dark"] .status-badge.status-active,
[data-theme="dark"] .status-badge.status-active-green {
    background: rgba(16,185,129,.15); color: #6ee7b7;
}

/* ── Not-taken cards ── */
[data-theme="dark"] .not-taken-lesson-header {
    background: linear-gradient(135deg,#1e293b,#0f172a) !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .not-taken-lesson-header:hover {
    background: linear-gradient(135deg,#334155,#1e293b) !important;
}
[data-theme="dark"] .not-taken-grade-group,
[data-theme="dark"] .not-taken-section-group {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .not-taken-grade-header,
[data-theme="dark"] .not-taken-section-header {
    background: #162032 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .group-title,
[data-theme="dark"] .not-taken-chevron { color: #e2e8f0; }
[data-theme="dark"] .not-taken-lesson-card:not(.collapsed) .not-taken-chevron {
    background: #312e81; color: #818cf8;
}
[data-theme="dark"] .btn-copy-action {
    background: #334155; border-color: #475569; color: #e2e8f0;
}
[data-theme="dark"] .btn-copy-action:hover {
    background: #4f46e5; color: white; border-color: #6366f1;
}

/* ── Mobile nav drawer ── */
[data-theme="dark"] .mobile-nav-drawer,
[data-theme="dark"] .dashboard-sidebar.active {
    background: #111827 !important;
}
[data-theme="dark"] .mobile-nav-header {
    border-color: #334155;
}
[data-theme="dark"] .mobile-nav-header .drawer-title { color: #818cf8; }
[data-theme="dark"] .mobile-nav-close { background: #334155; color: #94a3b8; }
[data-theme="dark"] .mobile-nav-link {
    color: #94a3b8;
}
[data-theme="dark"] .mobile-nav-link:hover,
[data-theme="dark"] .mobile-nav-link.active {
    background: rgba(99,102,241,.1) !important;
    color: #818cf8 !important;
}
[data-theme="dark"] .mobile-menu-toggle {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #818cf8 !important;
}

/* ── Mobile view tabs ── */
[data-theme="dark"] .mobile-view-tabs {
    background: #111827 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .mobile-view-tabs .tabs-segmented {
    background: #0f172a !important;
}
[data-theme="dark"] .mobile-view-tabs .tab-segment-btn {
    color: #64748b;
}
[data-theme="dark"] .mobile-view-tabs .tab-segment-btn.active {
    background: #1e293b !important;
    color: #818cf8 !important;
}

/* ── Sticky action bar ── */
[data-theme="dark"] .mobile-sticky-action-bar {
    background: #111827 !important;
    border-color: #334155 !important;
}

/* ── Toast / notification ── */
[data-theme="dark"] #jlearn-toast-notification,
[data-theme="dark"] .toast,
[data-theme="dark"] .notification {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}

/* ── Video & materials ── */
[data-theme="dark"] .video-section {
    background: linear-gradient(135deg,#1e293b,rgba(99,102,241,.05)) !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .materials-section {
    background: linear-gradient(135deg,#1e293b,rgba(16,185,129,.05)) !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .section-title { border-color: #4f46e5; }
[data-theme="dark"] .section-title i { color: #818cf8; }
[data-theme="dark"] .section-title h3 { color: #f1f5f9; }
[data-theme="dark"] .section-description { color: #94a3b8; }
[data-theme="dark"] .video-card,
[data-theme="dark"] .video-info-card {
    background: #0f172a; border-color: #334155;
}
[data-theme="dark"] .completion-card {
    background: #1e293b; border-color: #334155;
}

/* ── Results ── */
[data-theme="dark"] .results-section {
    background: #1e293b; border-color: #334155;
}
[data-theme="dark"] .results-card { color: #e2e8f0; }
[data-theme="dark"] .score-circle {
    background: linear-gradient(135deg,#4338ca,#0891b2);
}
[data-theme="dark"] .results-details { color: #e2e8f0; }

/* ── Error / success messages ── */
[data-theme="dark"] .error-message {
    background: rgba(239,68,68,.1) !important;
    color: #fca5a5 !important;
    border-left-color: #ef4444 !important;
}
[data-theme="dark"] .success-message {
    background: rgba(16,185,129,.1) !important;
    color: #6ee7b7 !important;
}
[data-theme="dark"] .instructions-warning {
    background: rgba(245,158,11,.1) !important;
    color: #fcd34d !important;
}

/* ── Format guide ── */
[data-theme="dark"] .format-guide {
    background: #162032 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .format-guide strong { color: #818cf8; }
[data-theme="dark"] .format-guide li { color: #cbd5e1; }

/* ── Empty states ── */
[data-theme="dark"] .empty-state,
[data-theme="dark"] .empty-state-card {
    color: #64748b;
    background: #0f172a;
    border-color: #334155;
}
[data-theme="dark"] .empty-state i,
[data-theme="dark"] .empty-state-card i { color: #475569; }

/* ── Premium banner ── */
[data-theme="dark"] #premium-plan-banner {
    background: linear-gradient(135deg,#1e293b,#312e81) !important;
    border-color: #334155 !important;
}
[data-theme="dark"] #premium-plan-banner h3 { color: #f1f5f9; }
[data-theme="dark"] #free-plan-banner {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] #free-plan-banner h3 { color: #f1f5f9; }

/* ── Search inputs ── */
[data-theme="dark"] #student-search-input,
[data-theme="dark"] #lesson-search-input,
[data-theme="dark"] #progress-search-input,
[data-theme="dark"] #results-search-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── AI Assistant ── */
[data-theme="dark"] .ai-body {
    background: #0f172a;
    color: #e2e8f0;
}
[data-theme="dark"] .ai-section {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .ai-rule {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .ai-anticheat {
    background: rgba(239,68,68,.08);
    border-color: rgba(239,68,68,.2);
}
[data-theme="dark"] .ai-anticheat li { color: #fca5a5; }
[data-theme="dark"] .ai-ack { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .ai-ack-text { color: #94a3b8; }
[data-theme="dark"] .ai-stat {
    background: #0f172a;
    border-color: #334155;
}
[data-theme="dark"] .ai-stat-val { color: #f1f5f9; }
[data-theme="dark"] .ai-stat-label { color: #64748b; }

/* ── Keyboard shortcuts / help modal ── */
[data-theme="dark"] .help-modal-content,
[data-theme="dark"] .quick-search-content,
[data-theme="dark"] .error-modal-content {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .help-modal-header,
[data-theme="dark"] .error-modal-header {
    border-color: #334155;
}
[data-theme="dark"] .help-modal-header h2,
[data-theme="dark"] .error-modal-header h3 { color: #f1f5f9; }
[data-theme="dark"] .help-modal-body th { color: #94a3b8; }
[data-theme="dark"] .help-modal-body td { color: #cbd5e1; }
[data-theme="dark"] .help-modal-body kbd { background: #334155; border-color: #475569; color: #e2e8f0; }
[data-theme="dark"] .error-details { background: #0f172a; border-color: #334155; color: #94a3b8; }

/* ── PPT / ILAW / Exemplar generator panels ── */
[data-theme="dark"] .generator-form-panel,
[data-theme="dark"] .generator-preview-panel,
[data-theme="dark"] #exemplar-form-panel,
[data-theme="dark"] #exemplar-preview-panel,
[data-theme="dark"] #ilaw-form-panel,
[data-theme="dark"] #ilaw-preview-panel,
[data-theme="dark"] #ppt-form-panel,
[data-theme="dark"] #ppt-result-panel,
[data-theme="dark"] #co-form-panel,
[data-theme="dark"] #co-preview-panel {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .ppt-slide-card,
[data-theme="dark"] .slide-preview-container {
    background: #0f172a;
    border-color: #334155;
}

/* ── Instruction items ── */
[data-theme="dark"] .instruction-item {
    background: #162032 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .instruction-item > i { color: #818cf8; }
[data-theme="dark"] .instruction-item strong { color: #f1f5f9; }

/* ── Progress bars ── */
[data-theme="dark"] .progress-bar {
    background: #1e293b !important;
}

/* ── Video progress ── */
[data-theme="dark"] .video-progress-bar { background: #334155; }

/* ── Connection lost overlay ── */
[data-theme="dark"] #connection-lost-overlay > div {
    background: rgba(15,23,42,.95) !important;
}

/* ── Lifeline confirm modal ── */
[data-theme="dark"] #lifeline-confirm-modal {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] #lifeline-confirm-modal .lc-body { background: #1e293b; color: #e2e8f0; }

/* ── Assessment header ── */
[data-theme="dark"] .assessment-header,
[data-theme="dark"] #assessment-header {
    background: rgba(15,23,42,.96) !important;
    border-color: #334155 !important;
}

/* ── Sticky quiz bar ── */
[data-theme="dark"] #jl-fixed-quizbar {
    background: rgba(15,23,42,.97) !important;
    border-color: #334155 !important;
}

/* ── Dropdown menus ── */
[data-theme="dark"] .dropdown-menu {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .dropdown-item {
    color: #cbd5e1;
}
[data-theme="dark"] .dropdown-item:hover {
    background: rgba(99,102,241,.1);
    color: #818cf8;
}

/* ── Tool cards ── */
[data-theme="dark"] .tool-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .tool-card:hover { border-color: #4f46e5 !important; }

/* ── Cookie consent ── */
[data-theme="dark"] .cookie-consent-banner,
[data-theme="dark"] #cookie-consent-banner {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}

/* ── Hardcoded inline style overrides ── */
/* These fix the hardcoded colors in the <style> blocks of index.html,
   teacher-dashboard.html, and student-portal.html */
[data-theme="dark"] .dashboard-sidebar {
    background: #111827 !important;
    border-right-color: #1f2937 !important;
}
[data-theme="dark"] .sidebar-menu .menu-item {
    color: #94a3b8 !important;
    border-color: transparent !important;
}
[data-theme="dark"] .sidebar-menu .menu-item:hover {
    background: rgba(99,102,241,.1) !important;
    color: #818cf8 !important;
    border-left-color: #818cf8 !important;
}
[data-theme="dark"] .sidebar-menu .menu-item.active {
    background: linear-gradient(135deg,#4338ca,#6366f1) !important;
    color: white !important;
    border-color: #6366f1 !important;
}
[data-theme="dark"] .sidebar-menu .menu-item.active i { color: white !important; }
[data-theme="dark"] .sidebar-menu .menu-item.active::after {
    background: #ffd700 !important;
}

/* ── Table mobile overrides (hardcoded in inline styles) ── */
[data-theme="dark"] .table-container {
    background: #0b1120 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .data-table { background: #111827 !important; }
[data-theme="dark"] .data-table thead {
    background: linear-gradient(135deg,#4338ca,#6366f1) !important;
}
[data-theme="dark"] .data-table th {
    color: white !important;
}
[data-theme="dark"] .data-table td {
    color: #e2e8f0 !important;
    border-color: #1e293b !important;
}
[data-theme="dark"] .data-table tbody tr:not(.group-header):nth-child(even) {
    background: #162032 !important;
}
[data-theme="dark"] .data-table tbody tr:not(.group-header):hover {
    background: rgba(99,102,241,.06) !important;
}

/* ── Section header hardcodes ── */
[data-theme="dark"] .section-header h2 { color: #f1f5f9 !important; }
[data-theme="dark"] .section-header .btn { border-color: #334155; }
[data-theme="dark"] .section-header .btn:hover { border-color: #6366f1; }

/* ── Role cards hardcodes ── */
[data-theme="dark"] .role-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .role-card:hover { border-color: #818cf8 !important; }
[data-theme="dark"] .role-card h3 { color: #f1f5f9; }
[data-theme="dark"] .role-card p { color: #94a3b8; }

/* ── Hero hardcodes ── */
[data-theme="dark"] .hero-actions .btn-primary { background: white; color: #4338ca; }
[data-theme="dark"] .hero-actions .btn-outline { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
[data-theme="dark"] .hero-actions .btn-outline:hover { background: rgba(255,255,255,.2); }

/* ── Feature grid hardcodes ── */
[data-theme="dark"] .feature-grid { gap: 1.25rem; }
[data-theme="dark"] .feature-card { background: #1e293b !important; border-color: #334155 !important; }
[data-theme="dark"] .feature-card h3 { color: #f1f59; }
[data-theme="dark"] .feature-card p { color: #94a3b8; }
[data-theme="dark"] .feature-card:hover { border-color: rgba(129,140,248,.3) !important; }

/* ── Login footer hardcodes ── */
[data-theme="dark"] .login-footer a {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #818cf8 !important;
}
[data-theme="dark"] .login-footer a:hover {
    background: #4f46e5 !important;
    color: white !important;
    border-color: #6366f1 !important;
}

/* ── Assessment header hardcodes ── */
[data-theme="dark"] .assessment-header,
[data-theme="dark"] #assessment-header {
    background: rgba(15,23,42,.96) !important;
}

/* ── Data table action buttons ── */
[data-theme="dark"] .data-table .btn { border-color: #334155; }
[data-theme="dark"] .data-table .btn-sm { background: #334155; color: #e2e8f0; }

/* ── Score display ── */
[data-theme="dark"] .score-display { color: #818cf8; }

/* ── Time remaining ── */
[data-theme="dark"] .time-remaining { background: #1e293b; color: #94a3b8; }

/* ── Status badges ── */
[data-theme="dark"] .status-badge { border-color: #334155; }

/* ── Lesson card action buttons ── */
[data-theme="dark"] .btn-action.btn-edit { background: #4338ca; }
[data-theme="dark"] .btn-action.btn-export { background: #1e40af; }
[data-theme="dark"] .btn-action.btn-delete { background: #991b1b; }

/* ═══════════════════════════════════════════════════════════════
   STUDENT PORTAL — DARK MODE OVERRIDES
   Fixes all hardcoded inline styles in student-portal.html
   ═══════════════════════════════════════════════════════════════ */

/* ── Platform Features Section (hardcoded gradient background) ── */
[data-theme="dark"] .platform-features-section,
[data-theme="dark"] div[style*="padding: 4rem 2rem"][style*="linear-gradient(135deg, #f8fafc"] {
    background: linear-gradient(135deg, #0f172a 0%, #1a1040 100%) !important;
}
[data-theme="dark"] .platform-features-section h2,
[data-theme="dark"] div[style*="font-size: 2.5rem"][style*="color: #1e293b"] {
    color: #f1f5f9 !important;
}
[data-theme="dark"] .platform-features-section p,
[data-theme="dark"] div[style*="color: #64748b"][style*="font-size: 1.1rem"] {
    color: #94a3b8 !important;
}

/* ── Feature Cards (hardcoded background: white) ── */
[data-theme="dark"] .platform-features-section div[style*="background: white"][style*="border-top: 4px solid"],
[data-theme="dark"] div[style*="background: white"][style*="padding: 2rem"][style*="border-top: 4px solid"] {
    background: #1e293b !important;
    border-top-color: inherit !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] div[style*="background: white"][style*="border-top: 4px solid"] h3 {
    color: #f1f5f9 !important;
}
[data-theme="dark"] div[style*="background: white"][style*="border-top: 4px solid"] p {
    color: #94a3b8 !important;
}
[data-theme="dark"] div[style*="background: white"][style*="border-top: 4px solid"]:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,0.4) !important;
}

/* ── Learning Modalities Banner (hardcoded purple gradient) ── */
[data-theme="dark"] div[style*="background: linear-gradient(135deg, #8b5cf6"] {
    background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%) !important;
    box-shadow: 0 8px 24px rgba(76, 29, 149, 0.4) !important;
}

/* ── Student Login Notice (hardcoded yellow warning) ── */
[data-theme="dark"] div[style*="background-color: #fff3cd"] {
    background-color: #422006 !important;
    border-left-color: #d97706 !important;
}
[data-theme="dark"] div[style*="background-color: #fff3cd"] i[style*="color: #856404"] {
    color: #fbbf24 !important;
}
[data-theme="dark"] div[style*="background-color: #fff3cd"] div[style*="color: #856404"] {
    color: #fde68a !important;
}

/* ── Teacher Registration Email Notice (hardcoded blue) ── */
[data-theme="dark"] div[style*="background-color: #e3f2fd"] {
    background-color: #172554 !important;
    border-left-color: #3b82f6 !important;
}
[data-theme="dark"] div[style*="background-color: #e3f2fd"] i {
    color: #60a5fa !important;
}
[data-theme="dark"] div[style*="background-color: #e3f2fd"] p {
    color: #93c5fd !important;
}

/* ── Portal Tabs Border ── */
[data-theme="dark"] .portal-tabs,
[data-theme="dark"] div[style*="border-bottom:2px solid #e2e8f0"] {
    border-bottom-color: #334155 !important;
}

/* ── iOS PWA Hint (hardcoded light blue) ── */
[data-theme="dark"] div[style*="background:#f0f9ff"] {
    background: #0c1a3a !important;
    border-color: #1e40af !important;
    color: #93c5fd !important;
}

/* ── Item Analysis Filter Card (hardcoded white bg) ── */
[data-theme="dark"] div[style*="background: white"][style*="padding: 1.5rem"][style*="border-radius: 12px"][style*="box-shadow: 0 2px 8px"] {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] div[style*="background: white"][style*="padding: 1.5rem"][style*="border-radius: 12px"] label {
    color: #e2e8f0 !important;
}
[data-theme="dark"] div[style*="background: white"][style*="padding: 1.5rem"][style*="border-radius: 12px"] select,
[data-theme="dark"] div[style*="background: white"][style*="padding: 1.5rem"][style*="border-radius: 12px"] input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── IA Content Card ── */
[data-theme="dark"] #ia-content {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] #ia-content p {
    color: #94a3b8 !important;
}

/* ── IA Summary Cards ── */
[data-theme="dark"] #ia-summary-cards > div {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── Account Modal (hardcoded white body bg) ── */
[data-theme="dark"] #account-modal .modal-content {
    background: #1e293b !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important;
}
[data-theme="dark"] #account-modal .modal-content > div:last-child {
    background: #0f172a !important;
}
[data-theme="dark"] #account-modal h4 {
    color: #f1f5f9 !important;
    border-bottom-color: #334155 !important;
}
[data-theme="dark"] #account-modal p,
[data-theme="dark"] #account-modal label {
    color: #e2e8f0 !important;
}
[data-theme="dark"] #account-modal div[style*="background: #f9fafb"] {
    background: #162032 !important;
}
[data-theme="dark"] #account-modal div[style*="background: #f0fdf4"] {
    background: #052e16 !important;
}
[data-theme="dark"] #account-modal div[style*="border-bottom: 2px solid #f3f4f6"] {
    border-bottom-color: #334155 !important;
}
[data-theme="dark"] #account-modal div[style*="border: 1px solid #e5e7eb"] {
    border-color: #334155 !important;
}

/* ── Lesson Plan Preview Modal (hardcoded white) ── */
[data-theme="dark"] #lesson-plan-modal {
    background: #1e293b !important;
}
[data-theme="dark"] #lesson-plan-modal > div {
    background: #1e293b !important;
}
[data-theme="dark"] #lesson-plan-modal div[style*="border-bottom: 2px solid #f0f0f0"] {
    border-bottom-color: #334155 !important;
}
[data-theme="dark"] #lesson-plan-modal h3 {
    color: #f1f5f9 !important;
}

/* ── Lesson Plan Content (hardcoded colors in lesson-plan-content) ── */
[data-theme="dark"] .lesson-plan-content {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .lesson-plan-content h1 { color: #f1f5f9 !important; }
[data-theme="dark"] .lesson-plan-content h3 { color: #cbd5e1 !important; }
[data-theme="dark"] .lesson-plan-content h4 { color: #94a3b8 !important; }
[data-theme="dark"] .lesson-plan-content strong { color: #f1f5f9 !important; }
[data-theme="dark"] .lesson-plan-content table {
    background: #0f172a !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] .lesson-plan-content table td {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .lesson-plan-content table tr:nth-child(even) {
    background: #162032 !important;
}
[data-theme="dark"] .lesson-plan-content table tr:hover {
    background: #1e3a5f !important;
}
[data-theme="dark"] .lesson-plan-content div[style*="border"] {
    background: #162032 !important;
}

/* ── Assessment Mobile Sticky Bar (hardcoded white) ── */
[data-theme="dark"] #mobile-sticky-bar,
[data-theme="dark"] div[style*="background: #ffffff"][style*="z-index: 1020"] {
    background: #0f172a !important;
    border-color: #334155 !important;
}

/* ── Quiz Question Cards (hardcoded white bg) ── */
[data-theme="dark"] .quiz-question {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] .quiz-question h4 {
    background: linear-gradient(135deg, #162032 0%, #1e293b 100%) !important;
    color: #e2e8f0 !important;
    border-left-color: #818cf8 !important;
}
[data-theme="dark"] .quiz-question label {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .quiz-question label:hover {
    background: rgba(99,102,241,0.1) !important;
    border-color: #818cf8 !important;
}

/* ── Quiz Navigation (hardcoded #f8f9fa bg) ── */
[data-theme="dark"] #quiz-navigation {
    background: #162032 !important;
}
[data-theme="dark"] #page-indicator {
    background: #1e293b !important;
    color: #818cf8 !important;
}

/* ── Quiz Palette ── */
[data-theme="dark"] .quiz-palette-container {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .quiz-palette-grid::-webkit-scrollbar-thumb {
    background: #475569 !important;
}
[data-theme="dark"] .quiz-palette-grid::-webkit-scrollbar-track {
    background: #1e293b !important;
}

/* ── Results Section ── */
[data-theme="dark"] .results-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .results-card h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .results-details .result-item {
    background: #162032 !important;
    border-left-color: #475569 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .results-details .result-item.correct {
    background: #052e16 !important;
    border-left-color: #22c55e !important;
}
[data-theme="dark"] .results-details .result-item.incorrect {
    background: #450a0a !important;
    border-left-color: #ef4444 !important;
}
[data-theme="dark"] #score-text { color: #94a3b8 !important; }

/* ── PPT/ILAW Tools Section ── */
[data-theme="dark"] #tools-section .ppt-header,
[data-theme="dark"] .ppt-header {
    background: #0f172a !important;
}
[data-theme="dark"] #tools-section .ppt-drop-zone {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%) !important;
    border-color: #4338ca !important;
}
[data-theme="dark"] #tools-section textarea,
[data-theme="dark"] #tools-section select,
[data-theme="dark"] #tools-section input[type="text"] {
    background: #0b1120 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] #tools-section .ppt-btn-secondary {
    background: #1e293b !important;
    color: #818cf8 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] #tools-section .ppt-slide-number {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}
[data-theme="dark"] #tools-section .ppt-slide-content {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] #tools-section .ppt-result-panel {
    background: #0b1120 !important;
}
[data-theme="dark"] #tools-section .ppt-loading {
    background: #0b1120 !important;
}
[data-theme="dark"] .ppt-header h1 { color: #f1f5f9 !important; }
[data-theme="dark"] .ppt-header p { color: #94a3b8 !important; }
[data-theme="dark"] .ppt-tool-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .ppt-tool-card:hover {
    border-color: #818cf8 !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] .ppt-tool-card h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .ppt-tool-card p { color: #94a3b8 !important; }
[data-theme="dark"] .ppt-workspace { background: #0f172a !important; }
[data-theme="dark"] .ppt-panel { background: #1e293b !important; }
[data-theme="dark"] .ppt-drop-zone {
    background: #162032 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .ppt-drop-content h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .ppt-drop-content p { color: #94a3b8 !important; }
[data-theme="dark"] textarea,
[data-theme="dark"] .ppt-manual-panel textarea {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] label.ppt-radio-label { color: #e2e8f0 !important; }
[data-theme="dark"] .ppt-action-ribbon {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .ppt-action-ribbon h2 { color: #f1f5f9 !important; }
[data-theme="dark"] .ppt-action-ribbon p { color: #94a3b8 !important; }
[data-theme="dark"] .ppt-slides-grid { background: #0f172a !important; }
[data-theme="dark"] .ppt-saved-section { background: #1e293b !important; }
[data-theme="dark"] .ppt-saved-section h3 { color: #f1f5f9 !important; }

/* ── ILAW Lesson Plan Generator ── */
[data-theme="dark"] .lp-form-group label { color: #e2e8f0 !important; }
[data-theme="dark"] .lp-form-group input,
[data-theme="dark"] .lp-form-group select,
[data-theme="dark"] .lp-form-group textarea {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .lp-result-content {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

/* ── Teachers Registration Form ── */
[data-theme="dark"] #teacher-register-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] #teacher-register-card small {
    color: #94a3b8 !important;
}

/* ── Login Error/Success Messages ── */
[data-theme="dark"] .error-message {
    background: #450a0a !important;
    border-color: #991b1b !important;
    color: #fca5a5 !important;
}
[data-theme="dark"] .success-message {
    background: #052e16 !important;
    border-color: #166534 !important;
    color: #86efac !important;
}

/* ── Search Containers ── */
[data-theme="dark"] div[style*="padding: 1rem"][style*="background: var(--bg-secondary)"][style*="border-radius: 8px"] {
    background: #162032 !important;
}

/* ── Form Inputs Global Dark ── */
[data-theme="dark"] .login-card input,
[data-theme="dark"] .login-card select {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .login-card input::placeholder {
    color: #64748b !important;
}

/* ── Completion Card ── */
[data-theme="dark"] .completion-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .completion-card h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .completion-card p { color: #94a3b8 !important; }

/* ── Video Section ── */
[data-theme="dark"] .video-section {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .video-section .section-title h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .video-info-card {
    background: #162032 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .video-info-card p { color: #94a3b8 !important; }

/* ── Materials Section ── */
[data-theme="dark"] .materials-section {
    background: #1e293b !important;
}
[data-theme="dark"] .materials-section .section-title h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .materials-section .section-description { color: #94a3b8 !important; }

/* ── Empty State Cards ── */
[data-theme="dark"] .empty-state-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

/* ── Connection Status Indicator ── */
[data-theme="dark"] #connection-status-indicator {
    background: #1e293b !important;
    border-color: #334155 !important;
}

/* ── PPT Slideshow Modal ── */
[data-theme="dark"] .ppt-slideshow-modal {
    background: #0f172a !important;
}
[data-theme="dark"] .ppt-slide-topbar {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .ppt-slide-topbar h3 { color: #f1f5f9 !important; }
[data-theme="dark"] .ppt-slide-bottombar {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="dark"] .ppt-slide-bottombar .ppt-tip { color: #94a3b8 !important; }
[data-theme="dark"] .ppt-slide-select {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── Mobile menu overlay ── */
[data-theme="dark"] .mobile-menu-overlay {
    background: rgba(0,0,0,0.7) !important;
}

/* ── Group Headers in Tables ── */
[data-theme="dark"] .group-header td:first-child {
    background: transparent !important;
}
[data-theme="dark"] .data-table tbody tr:not(.group-header):hover td:first-child {
    background-color: rgba(99,102,241,0.06) !important;
}
[data-theme="dark"] .data-table tbody tr:not(.group-header):nth-child(even) td:first-child {
    background: #162032 !important;
}

/* ── Scrollbar in table container ── */
[data-theme="dark"] .table-container::-webkit-scrollbar-track {
    background: #1e293b !important;
}
[data-theme="dark"] .table-container::-webkit-scrollbar-thumb {
    background: #475569 !important;
}

/* ── Table scroll hint ── */
[data-theme="dark"] .table-scroll-hint {
    background: #162032 !important;
    color: #94a3b8 !important;
}

/* ── Warning Banner ── */
[data-theme="dark"] #student-warning-banner {
    background: #422006 !important;
    border-color: #d97706 !important;
}

/* ── Video Overlay ── */
[data-theme="dark"] .video-overlay {
    background: rgba(0,0,0,0.7) !important;
}

/* ══════════════════════════════════════════════════
   STANDALONE TOOL PAGES DARK MODE
   (quiz-generator, rubric-maker, certificate-maker,
    group-generator, class-timer, lesson-exemplar)
   ══════════════════════════════════════════════════ */

/* Override inline :root vars that standalone pages define */
html[data-theme="dark"] .qg-container,
html[data-theme="dark"] .rm-container,
html[data-theme="dark"] .cm-container,
html[data-theme="dark"] .gg-container,
html[data-theme="dark"] .ct-container,
html[data-theme="dark"] .le-container { max-width: 960px; }

/* Body background */
html[data-theme="dark"] body { background: #0b1120 !important; color: #e2e8f0 !important; }

/* Cards */
html[data-theme="dark"] .qg-card,
html[data-theme="dark"] .rm-card,
html[data-theme="dark"] .cm-card,
html[data-theme="dark"] .gg-card,
html[data-theme="dark"] .ct-card,
html[data-theme="dark"] .le-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

/* Card headings */
html[data-theme="dark"] .qg-card h2,
html[data-theme="dark"] .rm-card h2,
html[data-theme="dark"] .cm-card h2,
html[data-theme="dark"] .gg-card h2,
html[data-theme="dark"] .ct-card h2,
html[data-theme="dark"] .le-card h2 { color: #f1f5f9 !important; }

/* Form fields: labels */
html[data-theme="dark"] .qg-field label,
html[data-theme="dark"] .rm-field label,
html[data-theme="dark"] .cm-field label,
html[data-theme="dark"] .gg-field label,
html[data-theme="dark"] .le-field label { color: #94a3b8 !important; }

/* Form fields: inputs, selects, textareas */
html[data-theme="dark"] .qg-field select,
html[data-theme="dark"] .qg-field input,
html[data-theme="dark"] .qg-field textarea,
html[data-theme="dark"] .rm-field select,
html[data-theme="dark"] .rm-field input,
html[data-theme="dark"] .rm-field textarea,
html[data-theme="dark"] .cm-field select,
html[data-theme="dark"] .cm-field input,
html[data-theme="dark"] .cm-field textarea,
html[data-theme="dark"] .gg-field select,
html[data-theme="dark"] .gg-field input,
html[data-theme="dark"] .gg-field textarea,
html[data-theme="dark"] .ct-field select,
html[data-theme="dark"] .ct-field input,
html[data-theme="dark"] .ct-field textarea,
html[data-theme="dark"] .le-field select,
html[data-theme="dark"] .le-field input,
html[data-theme="dark"] .le-field textarea {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

/* Secondary buttons */
html[data-theme="dark"] .qg-btn-secondary,
html[data-theme="dark"] .rm-btn-secondary,
html[data-theme="dark"] .cm-btn-secondary,
html[data-theme="dark"] .gg-btn-secondary,
html[data-theme="dark"] .ct-btn-secondary {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

/* Key input section */
html[data-theme="dark"] .qg-key-input input,
html[data-theme="dark"] .rm-key-input input,
html[data-theme="dark"] .cm-key-input input {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

/* Key note */
html[data-theme="dark"] .qg-key-note,
html[data-theme="dark"] .rm-key-note,
html[data-theme="dark"] .cm-key-note { color: #94a3b8 !important; }

/* Checkbox groups */
html[data-theme="dark"] .qg-checkbox,
html[data-theme="dark"] .rm-checkbox {
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
html[data-theme="dark"] .qg-checkbox:has(input:checked),
html[data-theme="dark"] .rm-checkbox:has(input:checked) {
    background: rgba(99,102,241,0.15) !important;
    border-color: #6366f1 !important;
    color: #a5b4fc !important;
}

/* Question cards */
html[data-theme="dark"] .qg-question,
html[data-theme="dark"] .rm-question {
    background: #0f172a !important;
    border-left-color: #818cf8 !important;
}

/* Question options */
html[data-theme="dark"] .qg-options li,
html[data-theme="dark"] .rm-options li {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

/* Answer key */
html[data-theme="dark"] .qg-answer-key,
html[data-theme="dark"] .rm-answer-key {
    background: #064e3b !important;
    border-color: #065f46 !important;
}
html[data-theme="dark"] .qg-answer-key h3,
html[data-theme="dark"] .rm-answer-key h3 { color: #6ee7b7 !important; }
html[data-theme="dark"] .qg-answer-key th,
html[data-theme="dark"] .rm-answer-key th { color: #a7f3d0 !important; border-bottom-color: #065f46 !important; }
html[data-theme="dark"] .qg-answer-key td,
html[data-theme="dark"] .rm-answer-key td { color: #d1fae5 !important; }

/* Error message */
html[data-theme="dark"] .qg-error,
html[data-theme="dark"] .rm-error,
html[data-theme="dark"] .cm-error {
    background: #450a0a !important;
    border-color: #7f1d1d !important;
    color: #fca5a5 !important;
}

/* Success / info badges */
html[data-theme="dark"] .qg-badge-success,
html[data-theme="dark"] .rm-badge-success {
    background: #064e3b !important;
    color: #6ee7b7 !important;
}
html[data-theme="dark"] .qg-badge-primary,
html[data-theme="dark"] .rm-badge-primary {
    background: rgba(99,102,241,0.2) !important;
    color: #a5b4fc !important;
}

/* Spinner border */
html[data-theme="dark"] .qg-spinner,
html[data-theme="dark"] .rm-spinner {
    border-color: #334155 !important;
    border-top-color: #818cf8 !important;
}

/* Result header */
html[data-theme="dark"] .qg-result-header h2,
html[data-theme="dark"] .rm-result-header h2 { color: #f1f5f9 !important; }

/* ── Print: force light mode ── */
@media print {
    [data-theme="dark"] * { color: #000 !important; background: #fff !important; }
}

