/* ═══════════════════════════════════════════════════════
   revixa - A-Level Revision Platform
   Professional Modern Design System
   ═══════════════════════════════════════════════════════ */

:root {
    /* Brand (Revixa) */
    --brand: #1d4ed8;
    --brand-2: #4f46e5;
    --brand-3: #7c3aed;
    --brand-ink: #0b1b3a;

    /* App neutrals */
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-2: #f1f5ff;
    --border: rgba(15, 23, 42, 0.10);

    /* Text */
    --text: #0f172a;
    --text-secondary: #475569;
    --muted: #64748b;

    /* States */
    --success: #16a34a;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;

    /* Primary actions */
    --primary: var(--brand-2);
    --primary-dark: #3730a3;
    --primary-light: #a5b4fc;
    --primary-bg: #eef2ff;

    /* Radii + depth */
    --radius: 16px;
    --radius-sm: 12px;

    /* Shadows */
    --shadow: 0 1px 2px rgba(2,6,23,0.06), 0 1px 1px rgba(2,6,23,0.04);
    --shadow-md: 0 10px 18px rgba(2,6,23,0.08);
    --shadow-lg: 0 18px 40px rgba(2,6,23,0.12);

    /* Motion */
    --transition: 0.18s cubic-bezier(.2,.8,.2,1);

    /* Focus ring */
    --focus: 0 0 0 4px rgba(79, 70, 229, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(79,70,229,0.14), transparent 60%),
                radial-gradient(900px 500px at 90% 10%, rgba(29,78,216,0.10), transparent 55%),
                var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Typography ────────────────────────────────────── */
h1 { font-size: clamp(1.35rem, 1.2rem + 1vw, 2.05rem); font-weight: 800; letter-spacing: -0.02em; color: var(--brand-ink); }
h2 { font-size: clamp(1.15rem, 1.05rem + 0.6vw, 1.5rem); font-weight: 750; letter-spacing: -0.015em; }
h3 { font-size: 1.05rem; font-weight: 700; }
h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }
p, li { font-size: 0.98rem; }
.text-muted { color: var(--muted); }

/* ── Layout ────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.main-content { padding-top: 1rem; }
.auth-page { padding-top: 0; }
.hidden { display: none !important; }

/* ── Navbar ────────────────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; }
.nav-logo-img { height: 32px; width: auto; }
.nav-title { font-weight: 700; font-size: 1.1rem; color: var(--brand-2); }
.nav-links { display: flex; gap: 0.25rem; margin-left: 2rem; }
.nav-link {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: 0.875rem; font-weight: 500; transition: var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--brand-2); background: rgba(79,70,229,0.10); }
.nav-link .material-icons-round { font-size: 18px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.nav-user { font-weight: 500; font-size: 0.875rem; }
.streak-badge {
    background: var(--warning-bg); padding: 0.25rem 0.5rem;
    border-radius: 20px; font-size: 0.8rem; font-weight: 600;
}
.hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text); }

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.6rem 1.2rem; border-radius: 14px;
    font-weight: 500; font-size: 0.875rem; border: none;
    cursor: pointer; text-decoration: none; transition: var(--transition);
    font-family: inherit; min-height: 44px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 55%, var(--brand-3) 120%);
    color: white;
    box-shadow: 0 10px 16px rgba(79,70,229,0.18);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0px) scale(0.99); }
.btn-secondary { background: var(--primary-bg); color: var(--brand-2); }
.btn-secondary:hover { background: #dde1fd; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; min-height: 32px; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 0.5rem; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); cursor: pointer; min-height: auto; }
.btn-icon:hover { background: var(--primary-bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: 0.85rem; margin-bottom: 0.35rem; color: var(--text-secondary); }
.form-input {
    width: 100%; padding: 0.65rem 0.85rem; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 0.9rem; font-family: inherit;
    transition: var(--transition); background: var(--surface);
}
.form-input:focus { outline: none; border-color: rgba(79,70,229,0.55); box-shadow: var(--focus); }
textarea.form-input { resize: vertical; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

/* ── Flash Messages ────────────────────────────────── */
.flash-container { padding: 0 1.5rem; max-width: 1200px; margin: 0.5rem auto; }
.flash {
    padding: 0.75rem 1rem; border-radius: var(--radius-sm);
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.5rem; font-size: 0.9rem; animation: slideIn 0.3s ease;
}
.flash-success { background: var(--success-bg); color: #166534; border-left: 3px solid var(--success); }
.flash-error { background: var(--danger-bg); color: #991b1b; border-left: 3px solid var(--danger); }
.flash-info { background: var(--primary-bg); color: var(--primary-dark); border-left: 3px solid var(--brand-2); }
.flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; opacity: 0.6; }

/* ── Auth Page ─────────────────────────────────────── */
.auth-container { display: flex; min-height: 100vh; }
.auth-hero {
    flex: 1; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 50%, var(--brand-3) 100%);
    display: flex; align-items: center; justify-content: center; padding: 3rem; color: white;
}
.auth-hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; color: white; }
.hero-tagline { font-size: 1.2rem; opacity: 0.9; margin-bottom: 2rem; }
.hero-features { display: grid; gap: 0.75rem; }
.hero-feature { display: flex; align-items: center; gap: 0.75rem; font-size: 1rem; opacity: 0.9; }
.auth-form-panel { flex: 0 0 480px; display: flex; align-items: center; justify-content: center; padding: 3rem; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--muted); margin-bottom: 1.5rem; }
.auth-links { text-align: center; margin-top: 1rem; display: flex; justify-content: space-between; }
.auth-links a { color: var(--brand-2); text-decoration: none; font-size: 0.85rem; font-weight: 500; }

/* ── Dashboard ─────────────────────────────────────── */
.dashboard-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.stats-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.stat-pill {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--surface); padding: 0.5rem 1rem; border-radius: 20px;
    font-size: 0.85rem; font-weight: 500; border: 1px solid var(--border);
}
.stat-pill .material-icons-round { font-size: 18px; color: var(--brand-2); }
.section-title { margin: 1.5rem 0 1rem; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.subject-card {
    background: var(--surface); border-radius: var(--radius); padding: 1.5rem;
    border: 1px solid var(--border); box-shadow: var(--shadow-md);
    transition: var(--transition);
}
.subject-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.subject-card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.subject-icon { font-size: 2rem; }
.subject-desc { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1.25rem; }
.subject-actions { display: flex; gap: 0.5rem; }

/* ── Activity Table ────────────────────────────────── */
.activity-table-wrap { overflow-x: auto; }
.activity-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.activity-table th { background: var(--primary-bg); color: var(--primary-dark); padding: 0.75rem 1rem; text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.activity-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.badge { padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 500; }
.badge-quiz { background: var(--primary-bg); color: var(--brand-2); }
.badge-revision { background: var(--success-bg); color: #166534; }
.badge-mixed { background: var(--warning-bg); color: #92400e; }
.badge-weakness_focus { background: var(--danger-bg); color: #991b1b; }
.score-badge { padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.score-good { background: var(--success-bg); color: #166534; }
.score-ok { background: var(--warning-bg); color: #92400e; }
.score-low { background: var(--danger-bg); color: #991b1b; }
.score-pending { background: var(--primary-bg); color: var(--brand-2); }

/* ── Page Header / Back ────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.back-link {
    display: inline-flex; align-items: center; gap: 0.25rem;
    color: var(--muted); text-decoration: none; font-size: 0.85rem; margin-bottom: 0.5rem;
}
.back-link:hover { color: var(--brand-2); }

/* ── Revision Page ─────────────────────────────────── */
.level-selector { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.level-label { font-weight: 500; font-size: 0.9rem; color: var(--text-secondary); }
.level-btn {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.5rem 1rem; border-radius: var(--radius-sm);
    background: var(--surface); border: 1.5px solid var(--border);
    cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: var(--transition);
    font-family: inherit;
}
.level-btn:hover { border-color: var(--brand-2); color: var(--brand-2); }
.level-btn.active { background: var(--brand-2); color: white; border-color: var(--brand-2); }
.level-btn .material-icons-round { font-size: 16px; }

.revision-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; min-height: 60vh; }
.topic-nav {
    background: var(--surface); border-radius: var(--radius); padding: 1rem;
    border: 1px solid var(--border); overflow-y: auto; max-height: 75vh; position: sticky; top: 80px;
}
.topic-nav h3 { margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.module-group { margin-bottom: 0.5rem; }
.module-header {
    display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem;
    cursor: pointer; border-radius: var(--radius-sm); font-weight: 500; font-size: 0.85rem;
    transition: var(--transition);
}
.module-header:hover { background: var(--primary-bg); }
.module-arrow { font-size: 0.7rem; color: var(--muted); width: 1rem; text-align: center; }
.module-name { flex: 1; }
.optional-tag { font-size: 0.65rem; padding: 0.15rem 0.4rem; background: var(--warning-bg); color: #92400e; border-radius: 6px; }
.topic-list { padding-left: 1.2rem; }
.topic-list.collapsed { display: none; }
.topic-btn {
    display: block; width: 100%; text-align: left; padding: 0.4rem 0.5rem;
    background: none; border: none; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.825rem; color: var(--text-secondary);
    transition: var(--transition); font-family: inherit;
}
.topic-btn:hover { background: var(--primary-bg); color: var(--brand-2); }
.topic-btn.active { background: var(--brand-2); color: white; }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border); border-radius: 20px; transition: var(--transition);
}
.toggle-slider:before {
    content: ''; position: absolute; height: 14px; width: 14px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--brand-2); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

/* Card Viewer */
.card-viewer {
    background: var(--surface); border-radius: var(--radius); padding: 2rem;
    border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.card-empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.card-empty-state h3 { margin: 1rem 0 0.5rem; color: var(--text); }
.card-header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.card-nav { display: flex; align-items: center; gap: 0.75rem; }
#cardCounter { font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); min-width: 50px; text-align: center; }
.revision-card { padding: 1.5rem; background: var(--surface-2); border-radius: var(--radius); }
.revision-card h3 { margin-bottom: 0.75rem; color: var(--primary-dark); }
.revision-card hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.card-section { margin-bottom: 1rem; }
.keyboard-hint { text-align: center; margin-top: 1rem; font-size: 0.8rem; color: var(--muted); }
kbd { background: var(--surface); border: 1px solid var(--border); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.75rem; }

/* ── Quiz Page ─────────────────────────────────────── */
.quiz-setup { max-width: 800px; margin: 0 auto; }
.setup-card {
    background: var(--surface); border-radius: var(--radius); padding: 2rem;
    border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.setup-card h2 { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.setup-section { margin-bottom: 1.5rem; }
.setup-section h3 { margin-bottom: 0.75rem; font-size: 1rem; }

.topic-select-actions { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.topic-checkboxes { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem; }
.module-check-group { margin-bottom: 0.5rem; }
.module-check-header { font-weight: 600; font-size: 0.85rem; padding: 0.3rem 0.5rem; background: var(--surface-2); border-radius: 4px; display: flex; align-items: center; gap: 0.5rem; }
.topic-checkbox { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.5rem 0.3rem 1rem; cursor: pointer; font-size: 0.85rem; }
.topic-checkbox input { accent-color: var(--brand-2); }

.difficulty-options, .type-checkboxes { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.radio-card { flex: 1; min-width: 100px; }
.radio-card input { display: none; }
.radio-label {
    display: block; text-align: center; padding: 0.6rem; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; transition: var(--transition);
}
.radio-card input:checked + .radio-label { border-color: var(--brand-2); background: var(--primary-bg); color: var(--brand-2); font-weight: 600; }

.count-selector { display: flex; gap: 0.5rem; }
.count-selector .btn.active { background: var(--brand-2); color: white; border-color: var(--brand-2); }

.setup-actions { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

/* Active Quiz */
.quiz-active { max-width: 750px; margin: 0 auto; }
.quiz-progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 1rem; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-3)); border-radius: 3px; transition: width 0.5s ease; }
.quiz-status { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; font-size: 0.9rem; font-weight: 500; }
.quiz-timer { color: var(--muted); }

.question-card {
    background: var(--surface); border-radius: var(--radius); padding: 2rem;
    border: 1px solid var(--border); box-shadow: var(--shadow-md); margin-bottom: 1rem;
}
.difficulty-indicator { margin-bottom: 0.75rem; }
.question-card h3 { font-size: 1.1rem; line-height: 1.5; margin-bottom: 1.5rem; }

.mcq-options { display: flex; flex-direction: column; gap: 0.5rem; }
.mcq-btn {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem;
    background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.9rem; text-align: left; transition: var(--transition);
    font-family: inherit; width: 100%;
}
.mcq-btn:hover { border-color: var(--brand-2); background: var(--primary-bg); }
.mcq-btn.selected { border-color: var(--brand-2); background: var(--primary-bg); }
.mcq-btn.correct { border-color: var(--success); background: var(--success-bg); }
.mcq-btn.incorrect { border-color: var(--danger); background: var(--danger-bg); }
.opt-letter {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; background: var(--surface);
    border: 1.5px solid var(--border); font-weight: 600; font-size: 0.8rem; flex-shrink: 0;
}

.tf-options { display: flex; gap: 1rem; }
.tf-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 1rem; background: var(--surface-2); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 1rem; font-weight: 500;
    transition: var(--transition); font-family: inherit;
}
.tf-btn:hover { border-color: var(--brand-2); }
.tf-btn.selected { border-color: var(--brand-2); background: var(--primary-bg); }
.tf-btn.correct { border-color: var(--success); background: var(--success-bg); }
.tf-btn.incorrect { border-color: var(--danger); background: var(--danger-bg); }

.written-answer textarea { margin-bottom: 1rem; min-height: 120px; }

/* Feedback */
.feedback-panel {
    background: var(--surface); border-radius: var(--radius); padding: 1.5rem;
    border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
}
.feedback-header { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.feedback-header.correct { color: var(--success); }
.feedback-header.incorrect { color: var(--danger); }
.feedback-body { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 1rem; }

.grading-loader { text-align: center; padding: 2rem; }
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--brand-2); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 1rem;
}

/* Quiz Results */
.quiz-results { max-width: 600px; margin: 0 auto; }
.results-card {
    background: var(--surface); border-radius: var(--radius); padding: 2.5rem;
    border: 1px solid var(--border); box-shadow: var(--shadow-md); text-align: center;
}
.results-card h2 { margin-bottom: 1.5rem; }
.results-score { font-size: 3rem; font-weight: 800; color: var(--brand-2); margin-bottom: 1rem; }
.results-breakdown { margin-bottom: 2rem; color: var(--text-secondary); }
.results-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Progress Page ─────────────────────────────────── */
.subject-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.subject-tab {
    padding: 0.6rem 1.2rem; border-radius: var(--radius-sm);
    background: var(--surface); border: 1.5px solid var(--border);
    cursor: pointer; font-weight: 500; font-size: 0.9rem;
    transition: var(--transition); font-family: inherit;
}
.subject-tab:hover { border-color: var(--brand-2); }
.subject-tab.active { background: var(--brand-2); color: white; border-color: var(--brand-2); }

.progress-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.progress-stat-card {
    background: var(--surface); border-radius: var(--radius); padding: 1.25rem;
    border: 1px solid var(--border); text-align: center;
}
.progress-stat-card .material-icons-round { font-size: 28px; color: var(--brand-2); margin-bottom: 0.5rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.chart-card {
    background: var(--surface); border-radius: var(--radius); padding: 1.5rem;
    border: 1px solid var(--border); margin-bottom: 1.25rem;
}
.chart-card h3 { margin-bottom: 1rem; }
.chart-container { position: relative; height: 280px; }

.topic-bars { display: flex; flex-direction: column; gap: 0.5rem; }
.topic-bar-row { display: flex; align-items: center; gap: 0.75rem; }
.topic-bar-name { min-width: 150px; font-size: 0.825rem; text-align: right; color: var(--text-secondary); }
.topic-bar-track { flex: 1; height: 20px; background: var(--surface-2); border-radius: 10px; overflow: hidden; }
.topic-bar-fill { height: 100%; border-radius: 10px; transition: width 0.8s ease; }
.bar-good { background: var(--success); }
.bar-ok { background: var(--warning); }
.bar-low { background: var(--danger); }
.topic-bar-pct { min-width: 40px; font-weight: 600; font-size: 0.85rem; }
.topic-bar-detail { font-size: 0.75rem; color: var(--muted); min-width: 45px; }

.weak-card { border-left: 3px solid var(--warning); }
.weak-card h3 { display: flex; align-items: center; gap: 0.5rem; color: var(--warning); }
.weak-areas { display: flex; flex-direction: column; gap: 0.5rem; }
.weak-topic { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; background: var(--warning-bg); border-radius: var(--radius-sm); }
.weak-topic .material-icons-round { color: var(--warning); font-size: 18px; }
.weak-pct { margin-left: auto; font-weight: 600; color: var(--danger); }
.no-data { text-align: center; padding: 1.5rem; color: var(--muted); }
.progress-actions { margin-top: 1.5rem; text-align: center; }
.progress-loading { text-align: center; padding: 3rem; }

/* ── Admin Page ────────────────────────────────────── */
.admin-section { margin-bottom: 2rem; }
.admin-section h2 { margin-bottom: 1rem; }
.admin-form { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; border: 1px solid var(--border); margin-bottom: 1.5rem; }
.admin-user-card {
    background: var(--surface); border-radius: var(--radius); padding: 1.5rem;
    border: 1px solid var(--border); margin-bottom: 1rem; box-shadow: var(--shadow);
}
.user-card-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.user-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--muted); }
.admin-badge { font-size: 0.7rem; padding: 0.15rem 0.5rem; background: var(--primary-bg); color: var(--brand-2); border-radius: 8px; vertical-align: middle; }
.subject-assign-grid { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.subject-toggle {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1rem; background: var(--surface-2); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.85rem; transition: var(--transition);
}
.subject-toggle:has(input:checked) { background: var(--primary-bg); }
.subject-toggle input { accent-color: var(--brand-2); }

/* ── Empty State ───────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state h3 { color: var(--text); margin: 0.75rem 0 0.25rem; }

/* ── Animations ────────────────────────────────────── */
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-container { flex-direction: column; }
    .auth-hero { min-height: 200px; padding: 2rem; }
    .auth-hero h1 { font-size: 1.75rem; }
    .auth-form-panel { flex: none; padding: 2rem; }
    .revision-layout { grid-template-columns: 1fr; }
    .topic-nav { position: static; max-height: 300px; }
}

@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--surface); flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); z-index: 99; }
    .nav-links.open { display: flex; }
    .hamburger { display: block; }
    .container { padding: 1rem; }
    .subject-grid { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; }
    .topic-bar-name { min-width: 80px; font-size: 0.75rem; }
    .setup-actions { flex-direction: column; }
    .results-actions { flex-direction: column; align-items: center; }
    .btn { width: 100%; justify-content: center; }
    .nav-right { gap: 0.5rem; }
    .nav-user { display: none; }
    .subject-actions { flex-direction: column; }
    .mcq-btn { padding: 1rem; }
    .tf-btn { padding: 1.1rem; }
}

@media (max-width: 480px) {
    .auth-form-panel { padding: 1.5rem; }
    .question-card { padding: 1.25rem; }
    .tf-options { flex-direction: column; }
    .difficulty-options { flex-wrap: wrap; }
    .count-selector { flex-wrap: wrap; }
}