/* =============================================
   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;
    animation: pageLoad 0.4s ease;
}
@keyframes pageLoad { from { opacity: 0; } to { opacity: 1; } }
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: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-right: none;
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}
.sidebar-header {
    padding: 20px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 22px; font-weight: 900; color: #fff; }
.sidebar-close { display: none; font-size: 20px; color: rgba(255,255,255,0.5); }
.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: rgba(255,255,255,0.6); font-weight: 600; font-size: 14px;
    transition: all var(--transition); margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: 0 2px 8px rgba(30,58,95,0.4); }
.nav-item.active:hover { background: linear-gradient(135deg, var(--primary-light), #3b7dd8); color: #fff; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 12px 16px; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.logout-btn:hover { background: rgba(220,38,38,0.15); color: #f87171; }

/* --- Top Header (mobile) --- */
.top-header {
    display: none; position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 0 16px; align-items: center; z-index: 90;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(30,58,95,0.15);
}
.menu-toggle { font-size: 22px; color: #fff; padding: 8px; }
.header-title { font-size: 17px; font-weight: 800; color: #fff; }
.streak-badge {
    background: rgba(255,255,255,0.15); color: #fff;
    padding: 4px 12px; border-radius: var(--radius-full);
    font-size: 13px; font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2);
}

/* --- 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;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.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); position: relative;
}
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item.active::after {
    content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; border-radius: 0 0 3px 3px; background: 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 0.3s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.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 0.25s ease; border: 2px solid transparent;
    position: relative; overflow: hidden;
}
.btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(rgba(255,255,255,0.15), rgba(255,255,255,0));
    opacity: 0; transition: opacity 0.25s;
}
.btn:hover::after { opacity: 1; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: 0 2px 8px rgba(30,58,95,0.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(30,58,95,0.35); color: #fff; }
.btn-accent { background: linear-gradient(135deg, var(--accent), #fb923c); color: #fff; box-shadow: 0 2px 8px rgba(249,115,22,0.25); }
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(249,115,22,0.35); color: #fff; }
.btn-outline { border-color: var(--border); color: var(--text2); background: var(--surface); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.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);
    flex-wrap: wrap; gap: 8px;
}
.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, #0f172a, var(--primary), #312e81);
    color: #fff; border-radius: var(--radius); padding: 28px 32px;
    margin-bottom: 24px; display: flex; align-items: center;
    justify-content: space-between; position: relative; overflow: hidden;
    box-shadow: 0 4px 20px rgba(15,23,42,0.2);
}
.welcome-banner::before {
    content: ''; position: absolute; top: -50%; right: -20%;
    width: 300px; height: 300px; border-radius: 50%;
    background: rgba(255,255,255,0.04);
}
.welcome-banner::after {
    content: ''; position: absolute; bottom: -60%; left: -10%;
    width: 250px; height: 250px; border-radius: 50%;
    background: rgba(124,58,237,0.1);
}
.welcome-text h2 { font-size: 22px; color: #fff; margin-bottom: 4px; }
.welcome-text p { opacity: 0.75; font-size: 14px; }
.welcome-streak { font-size: 48px; animation: streakBounce 2s ease-in-out infinite; }
@keyframes streakBounce { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

/* --- 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);
    transition: all 0.3s ease;
}
.quick-action-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.quick-action-icon { font-size: 28px; }
.quick-action-text { font-size: 14px; font-weight: 700; }

/* --- Profile Hero --- */
.profile-hero {
    background: linear-gradient(135deg, #0f172a, var(--primary), #312e81);
    border-radius: var(--radius); padding: 36px; text-align: center;
    color: #fff; margin-bottom: 24px; position: relative; overflow: hidden;
}
.profile-hero::before {
    content: ''; position: absolute; top: -50%; right: -30%;
    width: 400px; height: 400px; border-radius: 50%;
    background: rgba(255,255,255,0.03);
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 900; color: #fff; margin: 0 auto 16px;
    border: 3px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.profile-hero h2 { color: #fff; font-size: 24px; margin-bottom: 4px; }
.profile-hero p { opacity: 0.7; font-size: 14px; }
.profile-badges { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.profile-badge-item {
    padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 700;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
}

/* --- 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: 28px; border-radius: var(--radius); margin-bottom: 24px;
    color: #fff; position: relative; overflow: hidden;
}
.subject-header::before {
    content: ''; position: absolute; top: -40%; right: -15%;
    width: 250px; height: 250px; border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.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; position: relative; }
.subject-header p { opacity: 0.8; font-size: 14px; margin-top: 4px; position: relative; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; animation: emptyBounce 3s ease-in-out infinite; }
@keyframes emptyBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.empty-state-text { font-size: 16px; font-weight: 600; }

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

/* =============================================
   PREMIUM ENHANCEMENTS
   ============================================= */

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(30,58,95,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(30,58,95,0.3); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* --- Brand Text Selection --- */
::selection { background: rgba(30,58,95,0.15); color: var(--primary); }

/* --- Sidebar Mobile Overlay Backdrop --- */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 99;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 0.3s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* --- Back to Top Button --- */
.back-to-top {
    position: fixed; bottom: 80px; right: 20px; z-index: 80;
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; border: none; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 20px; box-shadow: 0 4px 16px rgba(30,58,95,0.3);
    transition: all 0.3s ease;
}
.back-to-top.visible { display: flex; animation: fadeUp 0.3s ease; }
.back-to-top:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(30,58,95,0.4); }
@keyframes fadeUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

/* --- Table Responsive Wrapper --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }

/* --- Topic Card Enhanced --- */
.topic-card { position: relative; overflow: hidden; cursor: pointer; }
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.topic-card:hover .topic-card-color { width: 6px; }
.topic-card-color { position: absolute; top: 0; left: 0; width: 4px; height: 100%; transition: width 0.3s ease; }
.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; }

/* --- Set Card Enhanced --- */
.set-card { border-left: 4px solid var(--primary); position: relative; transition: all 0.3s ease; }
.set-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.set-card.locked { opacity: 0.6; }
.set-card.locked::after {
    content: '🔒'; position: absolute; top: 16px; right: 16px; font-size: 24px;
}

/* --- Notification Dot (for sidebar) --- */
.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--red); margin-left: auto;
    animation: notifPulse 2s infinite;
}
@keyframes notifPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.6;transform:scale(1.3)} }

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeletonShimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* --- Focus Visible (Accessibility) --- */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(30,58,95,0.2); }

/* --- Gradient Divider --- */
.gradient-divider {
    height: 3px; border: none;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
    margin: 32px 0; border-radius: 2px;
}

/* --- Stat Card Enhanced --- */
.stat-card { text-align: center; padding: 20px; position: relative; overflow: hidden; }
.stat-card::before {
    content: ''; position: absolute; top: -20px; right: -20px;
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(30,58,95,0.04);
}
.stat-value { font-size: 28px; font-weight: 900; color: var(--primary); position: relative; }
.stat-label { font-size: 13px; color: var(--text3); font-weight: 600; margin-top: 4px; }

/* --- Announce Card Enhanced --- */
.announce-card { border-left: 4px solid var(--blue); padding: 16px 20px; margin-bottom: 12px; transition: all 0.3s ease; }
.announce-card:hover { box-shadow: var(--shadow-md); transform: translateX(4px); }

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

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */
@media (max-width: 1100px) {
    .quiz-sidebar { width: 240px; }
    .main-content { padding: 24px 20px 100px; }
}

@media (max-width: 768px) {
    /* --- Layout --- */
    .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: 76px 16px 84px; }

    /* --- Quiz Header FIX (Submit Button Cutoff) --- */
    .quiz-header {
        margin: -76px -16px 16px;
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .quiz-header > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: auto;
    }
    #submitQuiz {
        display: inline-flex !important;
        white-space: nowrap;
        padding: 6px 14px;
        font-size: 13px;
        min-width: auto;
    }
    #paletteToggle {
        display: inline-flex !important;
        padding: 6px 10px;
        font-size: 13px;
    }

    /* --- Quiz Sidebar (Mobile Overlay) --- */
    .quiz-sidebar { display: none; }
    .quiz-sidebar.open {
        display: block;
        position: fixed; top: 0; right: 0; bottom: 0;
        width: 85%; max-width: 320px;
        z-index: 200;
        box-shadow: var(--shadow-lg);
        border-radius: 16px 0 0 16px;
    }

    /* --- Quiz Bottom Nav (Mobile) --- */
    .quiz-bottom-nav {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: 10px 16px;
        margin: 0;
        z-index: 50;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    }

    /* --- Question / Options --- */
    .options-grid { grid-template-columns: 1fr; }
    .question-box { padding: 16px; font-size: 15px; line-height: 1.8; margin-bottom: 14px; }
    .option-card { padding: 12px 14px; font-size: 14px; }
    .question-actions { gap: 6px; margin-top: 12px; }
    .q-action-btn { padding: 5px 10px; font-size: 12px; }

    /* --- Grids --- */
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* --- Dashboard --- */
    .welcome-banner { flex-direction: column; text-align: center; gap: 12px; padding: 20px; }
    .welcome-text h2 { font-size: 20px; }
    .welcome-streak { font-size: 40px; }

    /* --- Podium --- */
    .podium { gap: 8px; }
    .podium-item { min-width: 90px; padding: 12px; }

    /* --- Tables --- */
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .subject-header h1 { font-size: 20px; }

    /* --- Auth Page Mobile --- */
    .auth-page { padding: 16px; align-items: flex-start; padding-top: 40px; }
    .auth-card { border-radius: var(--radius); max-width: 100%; }
    .auth-header { padding: 24px 20px 0; }
    .auth-body { padding: 20px; }
}

@media (max-width: 480px) {
    .main-content { padding: 72px 12px 80px; }
    .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; gap: 8px; }
    .quick-action-card { padding: 12px; gap: 8px; }
    .quick-action-icon { font-size: 22px; }
    .quick-action-text { font-size: 13px; }

    /* --- Quiz 480px --- */
    .quiz-header { padding: 8px 10px; gap: 6px; }
    .quiz-header > div:first-child { font-size: 13px; }
    .quiz-timer { font-size: 18px; padding: 4px 10px; }
    .question-box { padding: 14px; font-size: 14px; }
    .option-card { padding: 10px 12px; font-size: 13px; }
    .option-letter { width: 28px; height: 28px; font-size: 12px; }
    .quiz-bottom-nav { padding: 8px 12px; }

    /* --- Auth 480px --- */
    .auth-page { padding: 12px; padding-top: 24px; }
    .auth-card { border-radius: var(--radius-sm); }
    .auth-logo { font-size: 32px; }

    /* --- Mobile Nav tighter --- */
    .mobile-nav { height: 56px; }
    .mobile-nav-icon { font-size: 20px; }
    .mobile-nav-label { font-size: 10px; }
}

/* =============================================
   CHATBOT WIDGET (Enhanced)
   ============================================= */
#chatbotWidget { position: fixed; bottom: 24px; right: 24px; z-index: 9000; }
.chatbot-fab {
    width: 60px; height: 60px; 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 6px 24px rgba(124,58,237,0.45);
    transition: all 0.3s ease; position: relative;
}
.chatbot-fab:hover { transform: scale(1.1) rotate(5deg); box-shadow: 0 8px 30px rgba(124,58,237,0.5); }
.chatbot-fab.active { background: linear-gradient(135deg, #dc2626, #ef4444); box-shadow: 0 6px 24px rgba(220,38,38,0.4); }
.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: 72px; right: 0;
    width: 380px; height: 520px;
    background: var(--surface); border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    display: none; flex-direction: column; overflow: hidden;
    border: 1px solid rgba(124,58,237,0.1);
}
.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, #5b21b6, #7c3aed, #a855f7);
    color: #fff; padding: 16px 18px;
    display: flex; align-items: center; justify-content: space-between;
}
.chatbot-header-info { display: flex; align-items: center; gap: 12px; }
.chatbot-avatar {
    font-size: 28px; width: 42px; height: 42px;
    background: rgba(255,255,255,0.15); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.chatbot-name { font-weight: 800; font-size: 16px; }
.chatbot-status {
    font-size: 11px; opacity: 0.85;
    display: flex; align-items: center; gap: 4px;
}
.chatbot-status::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #4ade80; display: inline-block;
    animation: statusPulse 2s infinite;
}
@keyframes statusPulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.chatbot-header-actions { display: flex; gap: 6px; }
.chatbot-btn {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.15); color: #fff;
    border: none; cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.chatbot-btn:hover { background: rgba(255,255,255,0.3); }
.chatbot-body {
    flex: 1; padding: 16px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px;
    background: linear-gradient(180deg, #f5f3ff, #faf8ff);
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble {
    max-width: 82%; padding: 12px 16px; border-radius: 18px;
    font-size: 14px; line-height: 1.65; word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.chat-msg.bot .chat-bubble {
    background: #fff; color: var(--text);
    border: 1px solid #e8e5f0; border-bottom-left-radius: 6px;
}
.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff;
    border-bottom-right-radius: 6px;
}
.chatbot-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chat-suggestion {
    padding: 8px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
    background: #fff; color: #7c3aed; border: 1.5px solid #ddd5f5; cursor: pointer;
    transition: all 0.2s;
}
.chat-suggestion:hover { background: #7c3aed; color: #fff; border-color: #7c3aed; transform: translateY(-1px); }
.chatbot-footer { padding: 12px 14px; border-top: 1px solid #e8e5f0; background: #fff; }
.chatbot-input-row { display: flex; gap: 8px; }
.chatbot-input {
    flex: 1; padding: 10px 16px; border: 2px solid #e8e5f0;
    border-radius: 24px; font-size: 14px; font-family: inherit;
    background: #faf8ff; outline: none; transition: border-color 0.2s;
}
.chatbot-input:focus { border-color: #7c3aed; background: #fff; }
.chatbot-send {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff; border: none; cursor: pointer; font-size: 18px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.chatbot-send:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(124,58,237,0.4); }
.chatbot-clear {
    border: none; background: none; color: var(--text3); font-size: 11px;
    cursor: pointer; padding: 6px 0; margin-top: 4px; width: 100%;
    text-align: center; transition: color 0.2s;
}
.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)} }

/* Chatbot Mobile */
@media (max-width: 480px) {
    #chatbotWidget { bottom: 76px; right: 12px; }
    .chatbot-fab { width: 52px; height: 52px; }
    .chatbot-fab-icon { font-size: 24px; }
    .chatbot-window { width: calc(100vw - 24px); right: -12px; height: 420px; border-radius: 16px; }
}

/* =============================================
   MATH / MATHJAX DISPLAY ENHANCEMENTS
   ============================================= */
/* Question box math formula rendering */
.question-text { font-size: 16px; line-height: 2; word-wrap: break-word; overflow-wrap: break-word; }
.question-text mjx-container, .option-text mjx-container { display: inline-block !important; vertical-align: middle; }
.question-text mjx-container[display="true"] { display: block !important; margin: 12px 0; overflow-x: auto; overflow-y: hidden; }
.option-text { font-size: 15px; line-height: 1.8; word-wrap: break-word; }
/* Make math formulas more readable */
.question-box .MathJax, .option-card .MathJax { font-size: 110% !important; }
/* Fix overflow for long math expressions */
.question-box { overflow-x: auto; overflow-y: visible; }
/* Better explanation box math */
.explanation-box mjx-container { display: inline-block !important; vertical-align: middle; }
.explanation-box mjx-container[display="true"] { display: block !important; margin: 8px 0; }
/* Mobile math sizing */
@media (max-width: 480px) {
    .question-text { font-size: 14px; line-height: 1.9; }
    .option-text { font-size: 13px; line-height: 1.7; }
    .question-text mjx-container[display="true"] { font-size: 90% !important; }
}

/* =============================================
   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; }
