/* =============================================
   PrepZone — Design System
   BCECE LE 2026 Exam Prep
   ============================================= */

/* --- CSS Variables --- */
:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8e;
    --primary-dark: #132740;
    --accent: #f97316;
    --accent-light: #fed7aa;
    --accent-hover: #ea580c;
    --bg: #f8f9fc;
    --surface: #ffffff;
    --card: #ffffff;
    --border: #e5e9f0;
    --border-light: #f0f2f5;
    --text: #1a1d2e;
    --text2: #4a5568;
    --text3: #9aa5b4;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --yellow: #d97706;
    --yellow-light: #fef3c7;
    --blue: #2563eb;
    --blue-light: #dbeafe;
    --math-color: #1e3a5f;
    --mech-color: #92400e;
    --eng-color: #065f46;
    --sidebar-w: 240px;
    --header-h: 60px;
    --mobile-nav-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 50px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
    --font: 'Nunito', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-weight: 800; line-height: 1.3; color: var(--text); }

/* --- Layout --- */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 24px 32px 100px;
    min-height: 100vh;
    max-width: 1200px;
}
.main-content.full-width { margin-left: 0; max-width: 100%; }
.page-container { max-width: 1100px; margin: 0 auto; }

/* --- Sidebar --- */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 20px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 22px; font-weight: 900; color: var(--primary); }
.sidebar-close { display: none; font-size: 20px; color: var(--text3); }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; border-radius: var(--radius-sm);
    color: var(--text2); font-weight: 600; font-size: 14px;
    transition: all var(--transition); margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); color: var(--primary); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.active:hover { background: var(--primary-light); color: #fff; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-divider { height: 1px; background: var(--border); margin: 12px 16px; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }
.logout-btn:hover { background: var(--red-light); color: var(--red); }

/* --- Top Header (mobile) --- */
.top-header {
    display: none; position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0 16px; align-items: center; z-index: 90;
    justify-content: space-between;
}
.menu-toggle { font-size: 22px; color: var(--text); padding: 8px; }
.header-title { font-size: 18px; font-weight: 800; }
.streak-badge {
    background: var(--accent-light); color: var(--accent);
    padding: 4px 12px; border-radius: var(--radius-full);
    font-size: 13px; font-weight: 700;
}

/* --- Mobile Bottom Nav --- */
.mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--mobile-nav-h); background: var(--surface);
    border-top: 1px solid var(--border);
    justify-content: space-around; align-items: center; z-index: 90;
}
.mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--text3); font-size: 11px; font-weight: 600;
    padding: 6px 12px; border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-icon { font-size: 22px; }

/* --- Cards --- */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 700; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 24px; border-radius: var(--radius-full); font-weight: 700;
    font-size: 14px; transition: all var(--transition); border: 2px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.btn-outline { border-color: var(--border); color: var(--text2); background: var(--surface); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* --- Badges --- */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: var(--radius-full); font-size: 12px; font-weight: 700;
}
.badge-easy { background: var(--green-light); color: var(--green); }
.badge-medium { background: var(--yellow-light); color: var(--yellow); }
.badge-hard { background: var(--red-light); color: var(--red); }
.badge-mixed { background: var(--blue-light); color: var(--blue); }
.badge-math { background: #e8edf4; color: var(--math-color); }
.badge-mech { background: #f5ede4; color: var(--mech-color); }
.badge-eng { background: #e4f0ec; color: var(--eng-color); }

/* --- Progress Bars --- */
.progress { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.progress-bar {
    height: 100%; border-radius: 4px; transition: width 0.6s ease;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.progress-bar.math { background: linear-gradient(90deg, var(--math-color), #3b7dd8); }
.progress-bar.mech { background: linear-gradient(90deg, var(--mech-color), #c67a2e); }
.progress-bar.eng { background: linear-gradient(90deg, var(--eng-color), #10b981); }

/* --- Stats Cards --- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { text-align: center; padding: 20px; }
.stat-value { font-size: 28px; font-weight: 900; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text3); font-weight: 600; margin-top: 4px; }

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

/* --- Topic Cards --- */
.topic-card { position: relative; overflow: hidden; cursor: pointer; }
.topic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.topic-card-color { position: absolute; top: 0; left: 0; width: 4px; height: 100%; }
.topic-card-body { padding-left: 12px; }
.topic-card-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.topic-card-meta { display: flex; gap: 12px; font-size: 13px; color: var(--text3); }
.topic-card-progress { margin-top: 12px; }

/* --- Quiz Set Cards --- */
.set-card { border-left: 4px solid var(--primary); position: relative; }
.set-card.locked { opacity: 0.7; }
.set-card.locked::after {
    content: '🔒'; position: absolute; top: 16px; right: 16px; font-size: 24px;
}
.set-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.set-card-name { font-size: 17px; font-weight: 700; }
.set-card-info { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text3); margin-bottom: 12px; }
.set-card-info span { display: flex; align-items: center; gap: 4px; }
.set-card-score { font-size: 14px; color: var(--text2); margin-bottom: 12px; }

/* --- Quiz Page Styles --- */
.quiz-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
    margin: -24px -32px 24px; box-shadow: var(--shadow);
}
.quiz-timer {
    font-family: var(--font-mono); font-size: 22px; font-weight: 700;
    padding: 6px 16px; border-radius: var(--radius-sm);
}
.quiz-timer.green { background: var(--green-light); color: var(--green); }
.quiz-timer.yellow { background: var(--yellow-light); color: var(--yellow); }
.quiz-timer.red { background: var(--red-light); color: var(--red); animation: pulse 1s infinite; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* --- Question Box (CRITICAL) --- */
.question-box {
    background: #fefdf8; border: 2px solid #e2e0d8;
    border-left: 4px solid var(--math-color);
    border-radius: var(--radius); padding: 24px;
    margin-bottom: 20px; font-size: 17px; line-height: 2.0;
    min-height: 120px; position: relative;
}
.question-box.mech { border-left-color: var(--mech-color); }
.question-box.eng { border-left-color: var(--eng-color); }
.question-number { font-size: 13px; font-weight: 700; color: var(--text3); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.question-marks { font-family: var(--font-mono); font-size: 12px; padding: 2px 8px; background: var(--bg); border-radius: 4px; }
.question-text { color: var(--text); }
.question-text .MathJax { font-size: 110% !important; }

/* --- Quiz Options --- */
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.option-card {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px;
    background: var(--surface); border: 2px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    transition: all var(--transition); min-height: 52px;
    font-size: 15px; line-height: 1.8;
}
.option-card:hover { border-color: var(--primary-light); background: #f0f4ff; }
.option-card.selected { border-color: var(--primary); background: #e8edf4; }
.option-card.correct { border-color: var(--green); background: var(--green-light); }
.option-card.wrong { border-color: var(--red); background: var(--red-light); }
.option-letter {
    width: 32px; height: 32px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-weight: 700;
    font-size: 14px; background: var(--bg); color: var(--text2);
    flex-shrink: 0; border: 2px solid var(--border);
}
.option-card.selected .option-letter { background: var(--primary); color: #fff; border-color: var(--primary); }
.option-card.correct .option-letter { background: var(--green); color: #fff; border-color: var(--green); }
.option-card.wrong .option-letter { background: var(--red); color: #fff; border-color: var(--red); }
.option-text { flex: 1; }

/* --- Question Actions --- */
.question-actions {
    display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;
}
.q-action-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: var(--radius-full);
    font-size: 13px; font-weight: 600; background: var(--bg);
    color: var(--text2); border: 1px solid var(--border);
    transition: all var(--transition);
}
.q-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.q-action-btn.bookmarked { background: var(--yellow-light); border-color: var(--yellow); color: var(--yellow); }

/* --- Quiz Navigation --- */
.quiz-bottom-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0; margin-top: 20px; border-top: 1px solid var(--border);
}

/* --- Question Palette (Sidebar) --- */
.quiz-sidebar {
    position: fixed; top: var(--header-h); right: 0; width: 280px;
    background: var(--surface); border-left: 1px solid var(--border);
    padding: 20px; height: calc(100vh - var(--header-h));
    overflow-y: auto; z-index: 40;
}
.palette-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
    margin: 16px 0;
}
.palette-btn {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; border: 2px solid var(--border);
    background: var(--surface); transition: all var(--transition);
}
.palette-btn.answered { background: var(--green); color: #fff; border-color: var(--green); }
.palette-btn.skipped { background: var(--red-light); color: var(--red); border-color: var(--red); }
.palette-btn.review { background: var(--yellow-light); color: var(--yellow); border-color: var(--yellow); }
.palette-btn.current { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.palette-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; }
.palette-legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }

/* --- Explanation Box --- */
.explanation-box {
    background: var(--blue-light); border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm); padding: 16px; margin-top: 16px;
    font-size: 14px; line-height: 1.8;
}
.explanation-box h4 { color: var(--blue); font-size: 14px; margin-bottom: 8px; }

/* --- Result Page --- */
.result-hero { text-align: center; padding: 40px 0 32px; }
.score-ring-container { position: relative; width: 180px; height: 180px; margin: 0 auto 20px; }
.score-ring { transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--border); stroke-width: 10; }
.score-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1.5s ease; }
.score-value { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.score-value .big { font-size: 36px; font-weight: 900; }
.score-value .small { font-size: 14px; color: var(--text3); }
.result-grade { font-size: 20px; font-weight: 800; margin-top: 8px; }
.result-message { color: var(--text2); font-size: 15px; margin-top: 4px; }

/* --- Leaderboard --- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin: 32px 0; }
.podium-item { text-align: center; border-radius: var(--radius) var(--radius) 0 0; padding: 20px 16px; min-width: 120px; }
.podium-item.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); height: 180px; color: #fff; }
.podium-item.silver { background: linear-gradient(135deg, #d1d5db, #9ca3af); height: 150px; color: #fff; }
.podium-item.bronze { background: linear-gradient(135deg, #f59e0b, #92400e); height: 130px; color: #fff; }
.podium-rank { font-size: 32px; font-weight: 900; }
.podium-name { font-size: 14px; font-weight: 700; margin-top: 4px; }
.podium-score { font-size: 12px; opacity: 0.9; margin-top: 2px; }

/* --- Tables --- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px; font-size: 13px;
    font-weight: 700; color: var(--text3); text-transform: uppercase;
    border-bottom: 2px solid var(--border); background: var(--bg);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.data-table tr:hover { background: var(--bg); }
.data-table tr.current-user { background: var(--accent-light); }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); font-size: 15px;
    background: var(--surface); color: var(--text);
    transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-error { font-size: 13px; color: var(--red); margin-top: 4px; }

/* --- Auth Page --- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-header { text-align: center; padding: 32px 24px 0; }
.auth-logo { font-size: 36px; margin-bottom: 8px; }
.auth-tabs { display: flex; margin: 24px 24px 0; border-bottom: 2px solid var(--border); }
.auth-tab {
    flex: 1; padding: 12px; text-align: center; font-weight: 700;
    font-size: 15px; color: var(--text3); cursor: pointer;
    border-bottom: 3px solid transparent; margin-bottom: -2px;
    transition: all var(--transition);
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-body { padding: 24px; }
.auth-form { display: none; }
.auth-form.active { display: block; }

/* --- Tab System --- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
    padding: 10px 20px; font-weight: 700; font-size: 14px;
    color: var(--text3); cursor: pointer; border-bottom: 3px solid transparent;
    margin-bottom: -2px; white-space: nowrap; transition: all var(--transition);
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Filter Bar --- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-chip {
    padding: 6px 16px; border-radius: var(--radius-full);
    font-size: 13px; font-weight: 600; background: var(--bg);
    color: var(--text2); border: 1px solid var(--border);
    cursor: pointer; transition: all var(--transition);
}
.filter-chip.active, .filter-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* --- Announcement Card --- */
.announce-card { border-left: 4px solid var(--blue); padding: 16px; margin-bottom: 12px; }
.announce-card.warning { border-left-color: var(--yellow); }
.announce-card.success { border-left-color: var(--green); }
.announce-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.announce-body { font-size: 14px; color: var(--text2); }
.announce-date { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* --- Welcome Banner --- */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; border-radius: var(--radius); padding: 24px 28px;
    margin-bottom: 24px; display: flex; align-items: center;
    justify-content: space-between; position: relative; overflow: hidden;
}
.welcome-banner::before {
    content: ''; position: absolute; top: -50%; right: -20%;
    width: 300px; height: 300px; border-radius: 50%;
    background: rgba(255,255,255,0.05);
}
.welcome-text h2 { font-size: 22px; color: #fff; margin-bottom: 4px; }
.welcome-text p { opacity: 0.85; font-size: 14px; }
.welcome-streak { font-size: 48px; }

/* --- Quick Actions --- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.quick-action-card {
    display: flex; align-items: center; gap: 12px;
    padding: 16px; cursor: pointer; border: 2px solid var(--border);
}
.quick-action-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.quick-action-icon { font-size: 28px; }
.quick-action-text { font-size: 14px; font-weight: 700; }

/* --- Toast --- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm); color: #fff;
    font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease; min-width: 250px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue); }
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }

/* --- Spinner --- */
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }
.loading-overlay {
    position: absolute; inset: 0; background: rgba(255,255,255,0.8);
    display: flex; align-items: center; justify-content: center; z-index: 10;
    border-radius: var(--radius);
}

/* --- Subject Header --- */
.subject-header {
    padding: 24px; border-radius: var(--radius); margin-bottom: 24px;
    color: #fff; position: relative; overflow: hidden;
}
.subject-header.math { background: linear-gradient(135deg, var(--math-color), #2d5a8e); }
.subject-header.mech { background: linear-gradient(135deg, var(--mech-color), #c67a2e); }
.subject-header.eng { background: linear-gradient(135deg, var(--eng-color), #10b981); }
.subject-header h1 { color: #fff; font-size: 26px; }
.subject-header p { opacity: 0.85; font-size: 14px; margin-top: 4px; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 16px; font-weight: 600; }

/* --- MathJax Ready Hide --- */
.mathjax-loading { visibility: hidden; }
body.mathjax-ready .mathjax-loading { visibility: visible; }

/* --- Print Styles --- */
@media print {
    .sidebar, .mobile-nav, .top-header, .quiz-sidebar, .toast-container { display: none !important; }
    .main-content { margin: 0; padding: 20px; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */
@media (max-width: 1100px) {
    .quiz-sidebar { width: 240px; }
    .main-content { padding: 24px 20px 100px; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar-close { display: block; }
    .top-header { display: flex; }
    .mobile-nav { display: flex; }
    .main-content { margin-left: 0; padding: 80px 16px 100px; }
    .quiz-header { margin: -80px -16px 20px; padding: 12px 16px; }
    .quiz-sidebar { display: none; }
    .quiz-sidebar.open { display: block; position: fixed; top: 0; right: 0; bottom: 0; width: 80%; max-width: 320px; z-index: 200; box-shadow: var(--shadow-lg); }
    .options-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .podium { gap: 8px; }
    .podium-item { min-width: 90px; padding: 12px; }
    .welcome-banner { flex-direction: column; text-align: center; gap: 12px; }
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .subject-header h1 { font-size: 20px; }
}
@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .quick-actions { grid-template-columns: 1fr 1fr; }
    .question-box { padding: 16px; font-size: 15px; }
    .option-card { padding: 10px 14px; font-size: 14px; }
    .auth-card { border-radius: 0; }
}

/* =============================================
   CHATBOT WIDGET
   ============================================= */
#chatbotWidget { position: fixed; bottom: 24px; right: 24px; z-index: 9000; }
.chatbot-fab {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(124,58,237,0.4);
    transition: all 0.3s ease; position: relative;
}
.chatbot-fab:hover { transform: scale(1.1); }
.chatbot-fab.active { background: linear-gradient(135deg, #dc2626, #ef4444); }
.chatbot-fab-icon { font-size: 28px; }
.chatbot-fab-pulse {
    position: absolute; inset: -4px; border-radius: 50%;
    border: 2px solid rgba(124,58,237,0.6);
    animation: chatPulse 2s infinite;
}
@keyframes chatPulse { 0%{transform:scale(1);opacity:1} 100%{transform:scale(1.5);opacity:0} }
.chatbot-window {
    position: absolute; bottom: 68px; right: 0;
    width: 340px; height: 460px;
    background: var(--surface); border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none; flex-direction: column; overflow: hidden;
    border: 1px solid var(--border);
}
.chatbot-window.open { display: flex; animation: chatSlideUp 0.3s ease; }
@keyframes chatSlideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
.chatbot-header {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff; padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between;
}
.chatbot-header-info { display: flex; align-items: center; gap: 10px; }
.chatbot-avatar { font-size: 28px; }
.chatbot-name { font-weight: 700; font-size: 15px; }
.chatbot-status { font-size: 11px; opacity: 0.8; }
.chatbot-header-actions { display: flex; gap: 4px; }
.chatbot-btn {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.2); color: #fff;
    border: none; cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}
.chatbot-btn:hover { background: rgba(255,255,255,0.3); }
.chatbot-body {
    flex: 1; padding: 12px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 8px; background: #f8f7ff;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble {
    max-width: 80%; padding: 10px 14px; border-radius: 16px;
    font-size: 13px; line-height: 1.6; word-wrap: break-word;
}
.chat-msg.bot .chat-bubble { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.user .chat-bubble { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; border-bottom-right-radius: 4px; }
.chatbot-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-suggestion {
    padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
    background: var(--surface); color: #7c3aed; border: 1px solid #ddd5f5; cursor: pointer;
}
.chat-suggestion:hover { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.chatbot-footer { padding: 8px 12px 10px; border-top: 1px solid var(--border); background: var(--surface); }
.chatbot-input-row { display: flex; gap: 6px; }
.chatbot-input {
    flex: 1; padding: 8px 14px; border: 2px solid var(--border);
    border-radius: 24px; font-size: 13px; font-family: inherit; background: var(--bg); outline: none;
}
.chatbot-input:focus { border-color: #7c3aed; }
.chatbot-send {
    width: 36px; height: 36px; border-radius: 50%; background: #7c3aed; color: #fff;
    border: none; cursor: pointer; font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.chatbot-send:hover { background: #6d28d9; }
.chatbot-clear { border: none; background: none; color: var(--text3); font-size: 11px; cursor: pointer; padding: 4px 0; margin-top: 4px; width: 100%; text-align: center; }
.chatbot-clear:hover { color: var(--red); }
.typing-dots span { animation: typingBounce 1.4s infinite; font-size: 20px; font-weight: 900; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-4px)} }
@media (max-width: 480px) {
    #chatbotWidget { bottom: 80px; right: 12px; }
    .chatbot-window { width: calc(100vw - 24px); right: -12px; height: 400px; }
}

/* =============================================
   STUDY MATERIAL + DEVELOPER PAGE
   ============================================= */
.material-card { position: relative; overflow: hidden; }
.material-card:hover { transform: translateY(-2px); }
.material-thumb { width: 100%; height: 180px; background: var(--bg); overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.material-thumb img { width: 100%; height: 100%; object-fit: cover; }
.material-play {
    position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
    width: 56px; height: 56px; border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer;
}
.material-play:hover { background: var(--red); transform: translateX(-50%) scale(1.1); }
.material-info { padding: 16px; }
.material-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.material-meta { font-size: 13px; color: var(--text3); display: flex; gap: 12px; }
.video-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 10000; display: none; align-items: center; justify-content: center; }
.video-modal.open { display: flex; }
.video-modal-content { width: 90%; max-width: 900px; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; position: relative; }
.video-modal-close { position: absolute; top: -40px; right: 0; color: #fff; font-size: 28px; cursor: pointer; background: none; border: none; }
.dev-hero { text-align: center; padding: 48px 24px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius); color: #fff; margin-bottom: 24px; position: relative; overflow: hidden; }
.dev-hero::before { content: ''; position: absolute; top: -50%; right: -30%; width: 400px; height: 400px; border-radius: 50%; background: rgba(255,255,255,0.05); }
.dev-avatar { width: 120px; height: 120px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.3); margin: 0 auto 16px; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; font-size: 48px; }
.dev-name { font-size: 28px; font-weight: 900; color: #fff; }
.dev-title { font-size: 15px; opacity: 0.85; margin-top: 4px; }
.dev-location { font-size: 13px; opacity: 0.7; margin-top: 8px; }
.social-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 24px 0; }
.social-link { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-full); background: var(--surface); border: 2px solid var(--border); color: var(--text); font-weight: 600; font-size: 14px; transition: all 0.2s; text-decoration: none; }
.social-link:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.tech-card { text-align: center; padding: 16px; background: var(--bg); border-radius: var(--radius-sm); font-weight: 700; font-size: 14px; color: var(--text2); border: 1px solid var(--border); }
.tech-card:hover { border-color: var(--primary); color: var(--primary); }

.quiz-sidebar.hidden { display: none !important; }
