/* ===== StudyTrack - Dark Galaxy Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1e1e2d;
  --border: #2a2a3d;
  --border-light: #333348;
  --accent: #6366f1;
  --accent-hover: #5355d4;
  --accent-2: #a855f7;
  --accent-3: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --gradient: linear-gradient(135deg, #6366f1, #a855f7);
  --gradient-2: linear-gradient(135deg, #06b6d4, #6366f1);
  --shadow: 0 4px 24px rgba(99,102,241,0.1);
  --shadow-lg: 0 8px 48px rgba(99,102,241,0.15);
  --radius: 12px;
  --radius-lg: 16px;
  /* v12 */
  --teal: #38bdf8;
  --violet: #818cf8;
  --rose: #fb7185;
  --emerald: #34d399;
  --amber: #fbbf24;
  --grad-primary: linear-gradient(135deg,#38bdf8,#818cf8);
}

/* ===== LIGHT MODE THEME ===== */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border: #cbd5e1;
  --border-light: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f51d8;
  --accent-2: #a855f7;
  --accent-3: #0891b2;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --gradient: linear-gradient(135deg, #6366f1, #a855f7);
  --gradient-2: linear-gradient(135deg, #0891b2, #6366f1);
  --shadow: 0 4px 24px rgba(99,102,241,0.08);
  --shadow-lg: 0 8px 48px rgba(99,102,241,0.12);
  --teal: #0891b2;
  --teal-dim: rgba(8,145,178,0.12);
  --violet: #6366f1;
  --rose: #e11d48;
  --emerald: #059669;
  --amber: #d97706;
}

/* Base */
[data-theme="light"],
[data-theme="light"] body,
[data-theme="light"] .app-layout { background: var(--bg-primary); color: var(--text-primary); }

/* Sidebar */
[data-theme="light"] .sidebar { background: #fff; border-right: 1px solid var(--border); }
[data-theme="light"] .sidebar-header { border-bottom: 1px solid var(--border); }
[data-theme="light"] .nav-item { color: var(--text-secondary); }
[data-theme="light"] .nav-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
[data-theme="light"] .nav-item.active { background: rgba(99,102,241,0.12); color: var(--accent); }
[data-theme="light"] .nav-section-title { color: var(--text-muted); }
[data-theme="light"] .sidebar-user { background: var(--bg-card); border-top: 1px solid var(--border); }

/* Topbar */
[data-theme="light"] .topbar { background: rgba(255,255,255,0.95); border-bottom: 1px solid var(--border); }
[data-theme="light"] .topbar-title { color: var(--text-primary); }
[data-theme="light"] .topbar-subtitle { color: var(--text-muted); }

/* Main content */
[data-theme="light"] .main-content { background: var(--bg-primary); }
[data-theme="light"] .page-content { background: var(--bg-primary); }

/* Cards */
[data-theme="light"] .card { background: #fff; border-color: var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
[data-theme="light"] .card:hover { border-color: var(--border-light); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
[data-theme="light"] .card-title { color: var(--text-primary); }
[data-theme="light"] .stat-card { background: #fff; border-color: var(--border); }

/* Forms */
[data-theme="light"] .form-control { background: var(--bg-secondary); border-color: var(--border); color: var(--text-primary); }
[data-theme="light"] .form-control:focus { border-color: var(--accent); background: #fff; }
[data-theme="light"] .form-control::placeholder { color: var(--text-muted); }
[data-theme="light"] .form-label { color: var(--text-secondary); }
[data-theme="light"] select.form-control { background-color: var(--bg-secondary); color: var(--text-primary); }

/* Buttons */
[data-theme="light"] .btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border-color: var(--border); }
[data-theme="light"] .btn-secondary:hover { background: #d1d9e6; border-color: var(--border-light); }

/* Alerts */
[data-theme="light"] .alert-info    { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.3); color: #4338ca; }
[data-theme="light"] .alert-success { background: rgba(5,150,105,0.08);  border-color: rgba(5,150,105,0.3);  color: #047857; }
[data-theme="light"] .alert-error   { background: rgba(220,38,38,0.08);  border-color: rgba(220,38,38,0.3);  color: #b91c1c; }
[data-theme="light"] .alert-warning { background: rgba(217,119,6,0.08);  border-color: rgba(217,119,6,0.3);  color: #92400e; }

/* Badges */
[data-theme="light"] .badge-purple { background: rgba(99,102,241,0.12); color: #4338ca; }
[data-theme="light"] .badge-cyan   { background: rgba(8,145,178,0.12);  color: #0e7490; }
[data-theme="light"] .badge-green  { background: rgba(5,150,105,0.12);  color: #047857; }
[data-theme="light"] .badge-yellow { background: rgba(217,119,6,0.12);  color: #92400e; }
[data-theme="light"] .badge-red    { background: rgba(220,38,38,0.12);  color: #b91c1c; }

/* Modals */
[data-theme="light"] .modal { background: #fff; border-color: var(--border); }
[data-theme="light"] .modal-title { color: var(--text-primary); }
[data-theme="light"] .modal-close { color: var(--text-muted); }
[data-theme="light"] .modal-close:hover { background: var(--bg-secondary); color: var(--text-primary); }
[data-theme="light"] .modal-overlay { background: rgba(15,23,42,0.5); }

/* Tables */
[data-theme="light"] table th { background: var(--bg-secondary); color: var(--text-secondary); border-color: var(--border); }
[data-theme="light"] table td { border-color: var(--border); color: var(--text-primary); }
[data-theme="light"] table tr:hover td { background: var(--bg-secondary); }

/* Empty state */
[data-theme="light"] .empty-state h3 { color: var(--text-secondary); }
[data-theme="light"] .empty-state p  { color: var(--text-muted); }

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border); }

/* Sidebar overlay */
[data-theme="light"] .sidebar-overlay { background: rgba(15,23,42,0.4); }

/* Auth */
[data-theme="light"] .auth-wrapper { background: var(--bg-primary); }
[data-theme="light"] .auth-card { background: #fff; border-color: var(--border); }

/* Countdown */
[data-theme="light"] .countdown-num { background: var(--bg-card); border-color: var(--border); color: var(--accent); }

/* Progress bars background */
[data-theme="light"] .progress-bar-bg,
[data-theme="light"] [style*="background:var(--bg-secondary)"] { background: var(--bg-secondary) !important; }


/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img, svg { max-width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }

/* ===== AUTH ===== */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg-primary); position: relative; overflow: hidden;
}
.auth-wrapper::before {
  content: ''; position: fixed; inset: 0;
  background: radial-gradient(ellipse at 25% 25%, rgba(99,102,241,0.08) 0%, transparent 55%),
              radial-gradient(ellipse at 75% 75%, rgba(168,85,247,0.06) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 24px;
  padding: 48px 40px; width: 100%; max-width: 460px; position: relative; z-index: 1;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-icon {
  width: 64px; height: 64px; background: var(--gradient); border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 16px; box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}
.auth-logo h1 { font-size: 24px; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-logo p  { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.auth-title   { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle{ color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 8px; letter-spacing: 0.3px;
}
.form-control {
  width: 100%; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; font-size: 14px;
  color: var(--text-primary); font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s;
  outline: none; -webkit-appearance: none; appearance: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-icon { position: relative; }
.input-icon .form-control { padding-left: 44px; }
.input-icon .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; pointer-events: none; }
.input-icon .toggle-password { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); cursor: pointer; font-size: 16px; background: none; border: none; padding: 0; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: all 0.18s; border: none; outline: none;
  white-space: nowrap; text-decoration: none; vertical-align: middle; flex-shrink: 0;
  /* NO width:100% here — only .btn-full gets that */
}
.btn-primary   { background: var(--gradient); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,0.3); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,0.45); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.btn-danger    { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover    { background: rgba(239,68,68,0.22); }
.btn-success   { background: rgba(16,185,129,0.12); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }
.btn-success:hover   { background: rgba(16,185,129,0.22); }
.btn-full { width: 100%; }
.btn-sm   { padding: 7px 13px; font-size: 12px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.alert-error   { background: rgba(239,68,68,0.08);  border: 1px solid rgba(239,68,68,0.25);  color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
.alert-info    { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.25); color: #a5b4fc; }
.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: #fcd34d; }

/* ===== OTP ===== */
.otp-input-group { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.otp-box { width: 52px; height: 60px; background: var(--bg-secondary); border: 2px solid var(--border); border-radius: 12px; font-size: 24px; font-weight: 700; color: var(--text-primary); text-align: center; outline: none; transition: all 0.2s; font-family: inherit; }
.otp-box:focus  { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.otp-box.filled { border-color: var(--accent); background: rgba(99,102,241,0.08); }

/* ===== APP LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 260px; background: var(--bg-secondary); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 300; transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.sidebar-header { padding: 22px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-logo   { display: flex; align-items: center; gap: 12px; }
.sidebar-logo .logo-icon { width: 40px; height: 40px; background: var(--gradient); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.sidebar-logo span { font-size: 18px; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; overflow-x: hidden; min-height: 0; -webkit-overflow-scrolling: touch; }
.nav-section  { margin-bottom: 22px; }
.nav-section-title { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.2px; padding: 0 10px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text-secondary); font-size: 13.5px; font-weight: 500; transition: all 0.15s; cursor: pointer; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover  { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--accent); font-weight: 600; }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--gradient); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 20px; font-weight: 700; flex-shrink: 0; }
.sidebar-user { padding: 14px 18px; border-top: 1px solid var(--border); flex-shrink: 0; }
.user-card    { display: flex; align-items: center; gap: 11px; }
.user-avatar  { width: 36px; height: 36px; border-radius: 10px; background: var(--gradient); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info .name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-info .role { font-size: 11px; color: var(--text-muted); }

/* Main Content */
.main-content {
  margin-left: 260px; flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; min-width: 0;
}
.topbar {
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
  position: fixed; top: 0; left: 260px; right: 0; z-index: 200; gap: 12px; min-width: 0;
  height: 62px; box-sizing: border-box; flex-shrink: 0;
}
.topbar-left    { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; overflow: hidden; }
.topbar-title   { font-size: 17px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-subtitle{ font-size: 13px; color: var(--text-muted); }
.topbar-right   { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.page-content   { padding: 24px; padding-top: 86px; flex: 1; min-width: 0; overflow-x: hidden; }

/* page-top-bar removed — inline styles used directly in PHP */

/* ===== CARDS ===== */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-light); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.card-title  { font-size: 15px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 9px; }
.card-icon   { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 15px; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card  { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; transition: all 0.2s; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card:nth-child(1)::before { background: var(--gradient); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg,var(--accent-3),var(--accent)); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg,var(--success),var(--accent-3)); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg,var(--warning),var(--danger)); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-light); }
.stat-icon  { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 19px; margin-bottom: 14px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.stat-change{ font-size: 12px; margin-top: 7px; display: flex; align-items: center; gap: 4px; }
.stat-change.up  { color: var(--success); }
.stat-change.down{ color: var(--danger); }

/* ===== COUNTDOWN ===== */
.countdown-card {
  background: linear-gradient(135deg,rgba(99,102,241,0.15),rgba(168,85,247,0.1));
  border: 1px solid rgba(99,102,241,0.3); border-radius: var(--radius-lg); padding: 24px;
  text-align: center; position: relative; overflow: hidden; margin-bottom: 24px;
}
.countdown-card::before { content: ''; position: absolute; top: -50%; right: -20%; width: 280px; height: 280px; background: radial-gradient(circle,rgba(99,102,241,0.1) 0%,transparent 70%); border-radius: 50%; pointer-events: none; }
.countdown-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.countdown-exam  { font-size: 19px; font-weight: 700; color: var(--text-primary); margin-bottom: 20px; }
.countdown-units { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.countdown-unit  { text-align: center; }
.countdown-num   { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; padding: 18px 32px; font-size: 48px; font-weight: 800; color: var(--accent); display: block; min-width: 110px; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.countdown-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 5px; display: block; }

/* ===== GRIDS ===== */
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3    { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.grid-dash { display: grid; grid-template-columns: 1fr 360px; gap: 18px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 9px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table td { padding: 11px 13px; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid rgba(42,42,61,0.5); vertical-align: middle; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg-secondary); color: var(--text-primary); }

/* ===== BADGE ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-purple{ background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-cyan  { background: rgba(6,182,212,0.15);  color: #67e8f9; }
.badge-green { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-yellow{ background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-red   { background: rgba(239,68,68,0.15);  color: #fca5a5; }

/* ===== PROGRESS ===== */
.progress-bar  { background: var(--bg-secondary); border-radius: 100px; height: 7px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; background: var(--gradient); transition: width 0.5s ease; }
.progress-fill.green  { background: linear-gradient(90deg,var(--success),var(--accent-3)); }
.progress-fill.yellow { background: linear-gradient(90deg,var(--warning),#f97316); }
.progress-fill.red    { background: linear-gradient(90deg,var(--danger),#dc2626); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px;
  padding: 24px; width: 100%; max-width: 500px; max-height: 90vh;
  overflow-y: auto; transform: scale(0.96) translateY(8px); transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.modal-title  { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.modal-close  { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 19px; padding: 4px; border-radius: 6px; transition: all 0.15s; flex-shrink: 0; line-height: 1; }
.modal-close:hover { color: var(--text-primary); background: var(--bg-secondary); }

/* ===== CHARTS ===== */
.chart-container { position: relative; height: 210px; }

/* ===== PERIOD SELECTOR ===== */
.period-selector {
  display: inline-flex; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 3px; gap: 2px;
}
.period-btn { padding: 5px 13px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all 0.15s; border: none; background: none; font-family: inherit; white-space: nowrap; }
.period-btn.active { background: var(--gradient); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }

/* ===== HEATMAP ===== */
.heatmap-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.heatmap { display: flex; gap: 3px; flex-wrap: nowrap; }
.heatmap-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--bg-secondary); border: 1px solid var(--border); transition: transform 0.15s; cursor: pointer; flex-shrink: 0; }
.heatmap-cell:hover { transform: scale(1.35); }
.heatmap-cell[data-level="1"] { background: rgba(99,102,241,0.3);  border-color: rgba(99,102,241,0.4); }
.heatmap-cell[data-level="2"] { background: rgba(99,102,241,0.55); border-color: rgba(99,102,241,0.6); }
.heatmap-cell[data-level="3"] { background: rgba(99,102,241,0.8);  border-color: rgba(99,102,241,0.9); }
.heatmap-cell[data-level="4"] { background: #6366f1; border-color: #6366f1; }

/* ===== MISC ===== */
.subject-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; vertical-align: middle; }
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 20px; cursor: pointer; padding: 4px; }
.sidebar-overlay { display: none; }
.announcement-bar { background: linear-gradient(90deg,rgba(99,102,241,0.12),rgba(168,85,247,0.08)); border: 1px solid rgba(99,102,241,0.25); border-radius: var(--radius); padding: 11px 15px; margin-bottom: 18px; display: flex; align-items: center; gap: 11px; font-size: 13px; }
.streak-count { font-size: 22px; font-weight: 800; color: var(--warning); }
.fab { position: fixed; bottom: 24px; right: 24px; width: 54px; height: 54px; background: var(--gradient); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; cursor: pointer; box-shadow: 0 6px 24px rgba(99,102,241,0.4); transition: all 0.2s; border: none; z-index: 200; }
.fab:hover { transform: scale(1.1) rotate(45deg); }


/* Spinner */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }

/* Empty state */
.empty-state { text-align: center; padding: 44px 20px; }
.empty-state .empty-icon { font-size: 44px; margin-bottom: 14px; opacity: 0.45; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }
.empty-state p  { font-size: 13px; color: var(--text-muted); }

/* Admin */
.admin-badge { background: linear-gradient(90deg,#f59e0b,#ef4444); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }

/* Week/Month selector */
.period-selector.full { display: flex; width: 100%; }
.period-selector.full .period-btn { flex: 1; text-align: center; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }
@keyframes pulse  { 0%,100%{box-shadow:0 0 0 0 rgba(99,102,241,0.4)} 50%{box-shadow:0 0 0 8px rgba(99,102,241,0)} }
@keyframes spin   { to{transform:rotate(360deg)} }
.animate-in { animation: fadeIn 0.35s ease forwards; }
.pulse { animation: pulse 2s infinite; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .grid-dash { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  /* Sidebar */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 299; opacity: 0; pointer-events: none; transition: opacity 0.28s;
  }
  .sidebar-overlay.active { opacity: 1; pointer-events: all; }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .topbar { left: 0 !important; padding: 0 14px; height: 58px; }
  .page-content { padding: 14px; padding-top: 72px; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card  { padding: 15px; }
  .stat-value { font-size: 21px; }
  .stat-icon  { width: 38px; height: 38px; margin-bottom: 12px; }

  /* Countdown */
  .countdown-num { font-size: 34px; min-width: 90px; padding: 14px 24px; }

  /* Cards */
  .card { padding: 15px; }

  /* Modal — centered on mobile (not bottom-sheet) */
  .modal-overlay { align-items: center; padding: 12px; }
  .modal { border-radius: 20px; max-height: 92vh; padding: 18px 16px; }

  /* Page top bar — natural wrap, NO forced full width on buttons */

  /* Period selector wraps naturally */
  .period-selector { flex-wrap: nowrap; overflow-x: auto; }


  /* Form grid single col */
  .form-grid-2 { grid-template-columns: 1fr; }

  /* Grids */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .auth-card  { padding: 26px 18px; }
  .page-content { padding: 11px; padding-top: 72px; }
  .topbar-title { font-size: 15px; }
  .countdown-num { font-size: 28px; min-width: 76px; padding: 12px 18px; }
  .otp-box { width: 44px; height: 54px; font-size: 20px; }
  .otp-input-group { gap: 7px; }
  .btn { padding: 9px 16px; font-size: 13px; }
  .btn-sm { padding: 6px 11px; font-size: 12px; }
  .card { padding: 13px; }
}

/* ===== STUDYTRACK LAYOUT FIX ===== */

/* Buttons always nowrap */
.btn { white-space: nowrap; flex-shrink: 0; }

/* Period selector always horizontal, scrollable */
.period-selector {
  display: inline-flex; flex-wrap: nowrap;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  max-width: 100%; scrollbar-width: none;
}
.period-selector::-webkit-scrollbar { display: none; }

/* Card header: one row, title truncates, button never wraps */
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: nowrap; gap: 10px; margin-bottom: 18px; min-width: 0;
}
.card-title {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.card-header > .btn,
.card-header > a.btn,
.card-header > button { flex-shrink: 0; white-space: nowrap; }

/* Cards */
.card { overflow: hidden; min-width: 0; word-break: break-word; }
.note-card { overflow: hidden; word-break: break-word; min-width: 0; }
.stat-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tables */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* Layout */
.page-content { overflow-x: hidden; }
.main-content { max-width: 100vw; }

/* Responsive */
@media (max-width: 640px) {
  .btn { font-size: 13px; }
  .btn-sm { font-size: 11px; padding: 6px 10px; }
}

/* Top 3 performers responsive */
@media (max-width: 600px) {
  .top3-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 900px) and (min-width: 601px) {
  .top3-grid { grid-template-columns: 1fr 1fr !important; }
}
/* ── Campus Explorer topbar button responsive ── */
@media (max-width: 600px) {
  .campus-btn-text { display: none; }
}