/* ============================================================
   Smart Shiksha — Material 3 Inspired Theme (matches Flutter app)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --primary-container: #D1E4FF;
    --bg: #F5F7FA;
    --surface: #FFFFFF;
    --surface-high: #ECE6F0;
    --surface-container: #F3EDF7;
    --text: #1C1B1F;
    --text-secondary: #49454F;
    --text-muted: #79747E;
    --outline: #CAC4D0;
    --outline-variant: #E7E0EC;
    --error: #B3261E;
    --success: #2E7D32;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.14);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --primary-light: #90CAF9;
    --primary-container: #004A77;
    --bg: #121212;
    --surface: #1E1E1E;
    --surface-high: #2D2D2D;
    --surface-container: #252525;
    --text: #E6E1E5;
    --text-secondary: #CAC4D0;
    --text-muted: #938F99;
    --outline: #49454F;
    --outline-variant: #49454F;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ── App Bar ─────────────────────────────── */
.app-bar {
    background: var(--primary);
    color: #fff;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-bar__left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-bar__back {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.app-bar__back:hover { background: rgba(255,255,255,0.12); }

.app-bar__title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.15px;
}

.app-bar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1.5px solid rgba(255,255,255,0.35);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.1);
    color: #fff;
    cursor: pointer;
}
.lang-select option { color: #333; background: #fff; }

.app-bar__icon-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.app-bar__icon-btn:hover { background: rgba(255,255,255,0.12); }

.app-bar__text-btn {
    background: rgba(255,255,255,0.12);
    border: 1.5px solid rgba(255,255,255,0.35);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 5px 14px;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.app-bar__text-btn:hover { background: rgba(255,255,255,0.22); }

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    object-fit: cover;
}

.user-info__name {
    font-size: 14px;
    font-weight: 500;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Views ────────────────────────────────── */
.view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Login Screen ─────────────────────────── */
.login-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-card__icon {
    margin-bottom: 16px;
    line-height: 1;
}

.login-card__title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-card__subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.input-group {
    display: flex;
    align-items: center;
    border: 2px solid var(--outline);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}

.input-group__icon {
    padding: 12px 12px 12px 14px;
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.input-group input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 14px 14px 0;
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--text);
}

.input-group input::placeholder { color: var(--text-muted); }

.login-form__error {
    color: var(--error);
    font-size: 13px;
    text-align: center;
    padding: 4px 0;
}

.login-card__footer {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 24px;
}

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
    background: var(--primary);
    color: #fff;
}
.btn--primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn--outline:hover { background: var(--primary); color: #fff; }

.btn--block { width: 100%; }

/* ── Dashboard ────────────────────────────── */
.dashboard {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
}

.dashboard__header {
    margin-bottom: 28px;
}

.dashboard__greeting {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
}

.dashboard__info {
    font-size: 14px;
    color: var(--text-secondary);
}

.dashboard__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.dash-card {
    background: linear-gradient(135deg, var(--c1), var(--c2));
    border-radius: var(--radius-lg);
    padding: 20px;
    color: #fff;
    cursor: pointer;
    border: none;
    text-align: left;
    font-family: inherit;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dash-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.dash-card__icon {
    margin-bottom: auto;
}

.dash-card__text strong {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

.dash-card__text span {
    display: block;
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

/* ── AI Tutor ─────────────────────────────── */
.tutor {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

.tutor__chat {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tutor__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    text-align: center;
    padding: 32px;
    color: var(--text);
}

.tutor__empty h3 {
    font-size: 22px;
    font-weight: 700;
    margin-top: 16px;
    margin-bottom: 8px;
}

.tutor__empty p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 340px;
    margin-bottom: 24px;
}

.tutor__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.chip {
    padding: 8px 16px;
    font-size: 13px;
    font-family: inherit;
    border: 1.5px solid var(--outline);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.chip:hover {
    background: var(--surface-high);
    border-color: var(--primary);
}

/* Chat Bubbles */
.bubble {
    max-width: 78%;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
}

.bubble--user {
    background: var(--primary);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bubble--bot {
    background: var(--surface-high);
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.bubble--loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-style: italic;
}

.bubble__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--outline);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.bubble__actions {
    margin-top: 10px;
}

.bubble__view-btn {
    font-size: 13px;
    font-family: inherit;
    padding: 5px 14px;
    border: 1.5px solid rgba(0,0,0,0.15);
    border-radius: 20px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.bubble--bot .bubble__view-btn { border-color: var(--outline); }
.bubble__view-btn:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .bubble__view-btn:hover { background: rgba(255,255,255,0.08); }

/* Image/file in chat bubbles */
.bubble__image {
    display: block;
    max-width: 200px;
    max-height: 180px;
    border-radius: 10px;
    margin-bottom: 8px;
    object-fit: cover;
}
.bubble--user .bubble__image {
    border: 2px solid rgba(255,255,255,0.25);
}
.bubble__file-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    opacity: 0.85;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    width: fit-content;
}
.bubble--bot .bubble__file-tag {
    background: rgba(0,0,0,0.06);
}

/* Tutor Input Bar */
.tutor__input-bar {
    padding: 8px 16px 16px;
    background: var(--bg);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

/* File Preview (above input) */
.tutor__preview {
    padding: 8px 0 4px;
}
.tutor__preview-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-high);
    border: 1.5px solid var(--outline);
    border-radius: 12px;
    padding: 6px 10px;
    max-width: 280px;
}
.tutor__preview-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
}
.tutor__preview-file {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tutor__preview-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--surface);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.tutor__preview-remove:hover {
    background: var(--error);
    color: #fff;
}

.tutor__form {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Attach button (paperclip) */
.tutor__attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.tutor__attach-btn:hover {
    background: var(--surface-high);
    color: var(--primary);
}

.tutor__form input {
    flex: 1;
    padding: 12px 20px;
    font-size: 15px;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-xl);
    background: var(--surface-high);
    color: var(--text);
    outline: none;
}
.tutor__form input::placeholder { color: var(--text-muted); }
.tutor__form input:focus {
    box-shadow: 0 0 0 2px var(--primary);
}

.tutor__send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}
.tutor__send-btn:hover { background: var(--primary-dark); }
.tutor__send-btn:active { transform: scale(0.93); }
.tutor__send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Saved Lessons ────────────────────────── */
.saved-lessons {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 24px;
}

.saved-lessons__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.saved-lessons__empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 60px 16px;
}

.saved-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.1s;
}
.saved-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.saved-card__topic {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-dark);
}
[data-theme="dark"] .saved-card__topic { color: var(--primary-light); }

.saved-card__meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Lesson Detail ────────────────────────── */
.lesson-detail {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 16px;
}

.lesson-detail__body {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    line-height: 1.8;
    font-size: 16px;
}

/* Markdown Body */
.markdown-body h2 { font-size: 22px; margin: 20px 0 8px; color: var(--primary); font-weight: 700; }
.markdown-body h3 { font-size: 18px; margin: 16px 0 6px; font-weight: 600; }
.markdown-body p  { margin-bottom: 12px; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; margin-bottom: 12px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body strong { color: var(--primary-dark); }
[data-theme="dark"] .markdown-body strong { color: var(--primary-light); }
.markdown-body code {
    background: var(--surface-high);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.markdown-body pre {
    background: #263238;
    color: #e0e0e0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 16px;
}
.markdown-body blockquote {
    border-left: 4px solid #FF8F00;
    padding: 8px 16px;
    margin: 12px 0;
    background: #FFF8E1;
    border-radius: 0 var(--radius) var(--radius) 0;
}
[data-theme="dark"] .markdown-body blockquote { background: #3E2723; }

.lesson-detail__sources {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--outline);
}
.lesson-detail__sources h3 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.lesson-detail__sources ul { list-style: none; }
.lesson-detail__sources li { margin-bottom: 4px; }
.lesson-detail__sources a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    word-break: break-all;
}
.lesson-detail__sources a:hover { text-decoration: underline; }

.save-btn { margin-top: 16px; }

/* ── Coming Soon ──────────────────────────── */
.coming-soon {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    gap: 12px;
}
.coming-soon h3 { font-size: 22px; font-weight: 700; }
.coming-soon p { font-size: 14px; color: var(--text-secondary); max-width: 320px; }

/* ── Footer ───────────────────────────────── */
.footer {
    text-align: center;
    padding: 14px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--outline-variant);
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 480px) {
    .dashboard__grid { gap: 12px; }
    .dash-card { min-height: 120px; padding: 16px; }
    .dash-card__text strong { font-size: 15px; }
    .login-card { padding: 36px 20px; }
    .app-bar__title { font-size: 17px; }
    .lang-select { display: none; }
}

@media (min-width: 768px) {
    .dashboard { max-width: 960px; padding: 40px 32px; }
    .dashboard__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    .dash-card { min-height: 160px; padding: 24px; }
    .dashboard__greeting { font-size: 28px; }
    html { font-size: 17px; }
}

@media (min-width: 1200px) {
    .dashboard { max-width: 1100px; padding: 48px 40px; }
    .dashboard__grid { gap: 24px; }
    .dash-card { min-height: 170px; }
}

/* ============================================================
   ONBOARDING
   ============================================================ */
.onboarding { max-width: 600px; margin: 0 auto; padding: 32px 24px; }
.onboarding__card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px 24px;
    text-align: center;
}
.onboarding__card h2 { margin-bottom: 8px; color: var(--primary); }
.onboarding__card p { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }
.onboarding__options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.ob-option-btn {
    background: var(--surface-container);
    border: 2px solid var(--outline-variant);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    font-weight: 500;
}
.ob-option-btn:hover {
    border-color: var(--primary);
    background: var(--primary-container);
}
.ob-option-btn--selected {
    border-color: var(--primary);
    background: var(--primary-container);
    color: var(--primary-dark);
    font-weight: 600;
}
.onboarding__progress {
    margin-top: 24px;
    height: 6px;
    background: var(--outline-variant);
    border-radius: 3px;
    overflow: hidden;
}
.onboarding__progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* ============================================================
   BROWSE / LIST VIEWS (Lessons, Quiz chapters, Exams)
   ============================================================ */
.browse-container { max-width: 960px; margin: 0 auto; padding: 24px 24px; }
.browse-section { animation: fadeIn 0.2s ease; }
.browse-section__title { font-size: 20px; color: var(--text); margin-bottom: 16px; }
.browse-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.browse-header h3 { font-size: 18px; color: var(--text); }
.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.browse-card {
    background: var(--surface);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    padding: 24px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 110px;
    justify-content: center;
}
.browse-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.browse-card__icon { font-size: 36px; }
.browse-card__name { font-weight: 600; font-size: 15px; color: var(--text); }
.browse-card__desc { font-size: 12px; color: var(--text-muted); }
.browse-card--exam { background: linear-gradient(135deg, var(--primary-container), var(--surface)); }

.browse-list { display: flex; flex-direction: column; gap: 8px; }
.browse-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
}
.browse-list-item:hover {
    border-color: var(--primary);
    background: var(--primary-container);
}
.browse-list-item__num {
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}
.browse-list-item__text { flex: 1; min-width: 0; }
.browse-list-item__text strong { display: block; font-size: 14px; color: var(--text); }
.browse-list-item__text small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.browse-list-item__arrow { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.browse-empty { text-align: center; color: var(--text-muted); padding: 32px 16px; font-size: 14px; }
.browse-lessons-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

/* ============================================================
   QUIZ
   ============================================================ */
.quiz-container { max-width: 900px; margin: 0 auto; padding: 24px 24px; }
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.quiz-header h3 { font-size: 18px; }
.quiz-progress-text { font-size: 13px; color: var(--text-muted); }
.quiz-question-area { display: flex; flex-direction: column; gap: 16px; }

.quiz-card {
    background: var(--surface);
    border: 2px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color 0.3s;
}
.quiz-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.quiz-card__num { font-weight: 700; font-size: 15px; color: var(--primary); }
.quiz-card__type {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.quiz-card__type--mcq { background: #E3F2FD; color: #1565C0; }
.quiz-card__type--msq { background: #F3E5F5; color: #7B1FA2; }
.quiz-card__type--numerical { background: #E8F5E9; color: #2E7D32; }
[data-theme="dark"] .quiz-card__type--mcq { background: #0D47A133; }
[data-theme="dark"] .quiz-card__type--msq { background: #4A148C33; }
[data-theme="dark"] .quiz-card__type--numerical { background: #1B5E2033; }

.quiz-card__question { font-size: 15px; line-height: 1.5; margin-bottom: 14px; color: var(--text); }

.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    line-height: 1.4;
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-container); }
.quiz-option input[type="radio"],
.quiz-option input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--primary);
    flex-shrink: 0;
}
.quiz-option span { flex: 1; }

.quiz-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--outline-variant);
    border-radius: var(--radius);
    font-size: 15px;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
}
.quiz-input:focus { outline: none; border-color: var(--primary); }

.quiz-card--correct { border-color: var(--success); background: rgba(46, 125, 50, 0.06); }
.quiz-card--wrong { border-color: var(--error); background: rgba(179, 38, 30, 0.06); }

.quiz-card__explanation {
    margin-top: 14px;
    padding: 12px;
    background: var(--surface-container);
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.quiz-card__explanation strong { display: block; margin-bottom: 4px; }

.quiz-actions { margin-top: 20px; text-align: center; }

.quiz-results { margin-top: 20px; }
.quiz-results__card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px;
    text-align: center;
}
.quiz-results__card h3 { margin-bottom: 12px; color: var(--primary); }
.quiz-results__score { font-size: 36px; font-weight: 700; color: var(--text); }
.quiz-results__pct { font-size: 18px; color: var(--text-muted); margin-bottom: 16px; }
.quiz-results__bar {
    width: 100%;
    height: 8px;
    background: var(--outline-variant);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}
.quiz-results__fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* ============================================================
   EXAM PREP
   ============================================================ */
.exam-container { max-width: 960px; margin: 0 auto; padding: 24px 24px; }
.mock-timer {
    background: var(--primary-container);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

/* ============================================================
   PROFILE
   ============================================================ */
.profile-container { max-width: 720px; margin: 0 auto; padding: 24px 24px; }
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.profile-avatar { flex-shrink: 0; }
.profile-header-info h2 { font-size: 20px; margin-bottom: 2px; }
.profile-header-info p { font-size: 14px; color: var(--text-muted); }

.profile-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 16px;
}
.profile-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.profile-section__header h3 { font-size: 16px; color: var(--text); }

.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.profile-info-item label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.profile-info-item span {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.profile-stats { display: flex; flex-direction: column; gap: 12px; }
.stat-card {
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    padding: 14px;
}
.stat-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.stat-card__header strong { font-size: 14px; }
.stat-card__header span { font-size: 12px; color: var(--text-muted); }
.stat-card__bar {
    height: 6px;
    background: var(--outline-variant);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.stat-card__fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
}
.stat-card__details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.profile-prefs {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.profile-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.profile-pref-row label { font-size: 14px; font-weight: 500; color: var(--text); }
.profile-pref-row select {
    padding: 6px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--outline);
    background: var(--surface-container);
    color: var(--text);
    font-size: 14px;
}

.profile-version {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================================
   DIALOG OVERLAY
   ============================================================ */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}
.dialog-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 28px;
    max-width: 420px;
    width: 100%;
}
.dialog-card h3 { margin-bottom: 20px; text-align: center; font-size: 18px; }
.dialog-form { display: flex; flex-direction: column; gap: 14px; }
.dialog-form label { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; display: block; }
.dialog-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    background: var(--surface-container);
    color: var(--text);
    font-size: 14px;
}
.dialog-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
    gap: 16px;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--outline-variant);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-text { color: white; font-size: 15px; font-weight: 500; }

/* ============================================================
   BUTTON VARIANTS
   ============================================================ */
.btn--sm { padding: 8px 18px; font-size: 13px; }
.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn--outline:hover { background: var(--primary-container); }
.btn--danger {
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn--danger:hover { opacity: 0.9; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   ADDITIONAL RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .browse-container { padding: 16px 12px; }
    .browse-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .browse-card { padding: 16px 12px; min-height: 90px; }
    .browse-card__icon { font-size: 28px; }
    .quiz-container { padding: 16px 12px; }
    .quiz-card { padding: 16px; }
    .exam-container { padding: 16px 12px; }
    .profile-container { padding: 16px 12px; }
    .profile-info-grid { grid-template-columns: 1fr; }
    .profile-header { flex-direction: column; text-align: center; }
    .dialog-card { padding: 20px; }
    .onboarding__card { padding: 24px 16px; }
}

@media (min-width: 768px) {
    .browse-container { max-width: 960px; padding: 32px; }
    .browse-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .browse-card { padding: 28px 20px; min-height: 130px; }
    .browse-card__icon { font-size: 40px; }
    .browse-card__name { font-size: 16px; }
    .browse-list-item { padding: 18px 24px; }
    .browse-list-item__text strong { font-size: 15px; }
    .quiz-container { max-width: 900px; padding: 32px; }
    .exam-container { max-width: 960px; padding: 32px; }
    .profile-container { max-width: 720px; padding: 32px; }
}

@media (min-width: 1200px) {
    .browse-container { max-width: 1100px; padding: 40px 48px; }
    .browse-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; }
    .browse-card { padding: 32px 24px; min-height: 140px; }
    .browse-card__icon { font-size: 44px; }
    .browse-card__name { font-size: 17px; }
    .quiz-container { max-width: 1000px; padding: 40px 48px; }
    .exam-container { max-width: 1100px; padding: 40px 48px; }
}
