/* ============================================================
   MCQs SaaS — Global Design System
   Dark glassmorphism | Pakistan Green | Inter + Outfit fonts
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;600;700;800;900&display=swap');

/* ─── CSS Variables ──────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:        #07080D;
  --bg-surface:     #0F1117;
  --bg-card:        #161923;
  --bg-card-hover:  #1D2130;
  --bg-glass:       rgba(22, 25, 35, 0.7);
  --bg-glass-light: rgba(255,255,255,0.04);

  /* Brand Colors */
  --green-400: #4ADE80;
  --green-500: #22C55E;
  --green-600: #16A34A;
  --green-700: #00A651;
  --brand:     #00C461;

  /* Premium Purple */
  --purple-400: #C084FC;
  --purple-500: #A855F7;
  --purple-600: #9333EA;
  --purple-700: #7C3AED;

  /* Gold / Achievements */
  --gold-400: #FBBF24;
  --gold-500: #F59E0B;

  /* Danger / Wrong */
  --red-400: #F87171;
  --red-500: #EF4444;

  /* Text */
  --text-primary:  #F1F5F9;
  --text-secondary:#94A3B8;
  --text-muted:    #475569;
  --text-accent:   #00C461;

  /* Borders */
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --border-brand: rgba(0, 196, 97, 0.3);

  /* Shadows */
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.6);
  --shadow-brand: 0 0 24px rgba(0,196,97,0.2);
  --shadow-purple:0 0 24px rgba(168,85,247,0.25);

  /* Spacing */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full:9999px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Theme Defaults (Dark) */
  --bg-nav:        rgba(7,8,13,0.85);
  --bg-bottom-nav: rgba(15,17,23,0.95);
  --hero-grid:     rgba(255,255,255,0.02);
}

/* ─── Light Theme Variables ───────────────────────────────────── */
html.light-theme {
  /* Backgrounds */
  --bg-base:        #F8FAFC;
  --bg-surface:     #FFFFFF;
  --bg-card:        #F1F5F9;
  --bg-card-hover:  #E2E8F0;
  --bg-glass:       rgba(255, 255, 255, 0.75);
  --bg-glass-light: rgba(15, 23, 42, 0.04);

  /* Text */
  --text-primary:  #0F172A;
  --text-secondary:#475569;
  --text-muted:    #94A3B8;
  --text-accent:   #00A651;

  /* Borders */
  --border:       rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.15);
  --border-brand: rgba(0, 196, 97, 0.25);

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg:    0 10px 30px rgba(15, 23, 42, 0.12);
  --shadow-brand: 0 0 20px rgba(0, 196, 97, 0.15);
  --shadow-purple:0 0 20px rgba(168, 85, 247, 0.15);

  /* Navs */
  --bg-nav:        rgba(248, 250, 252, 0.85);
  --bg-bottom-nav: rgba(255,255,255,0.95);
  --hero-grid:     rgba(15,23,42,0.02);
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-card-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Typography ────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

p { color: var(--text-secondary); }
a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--green-400); }

/* ─── Layout ────────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 960px; margin: 0 auto; padding: 0 1.5rem; }

/* ─── Glass Card ────────────────────────────────────────────── */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1.5rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}
.card-glow:hover { box-shadow: var(--shadow-brand); }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: all var(--transition-bounce);
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--green-600));
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,196,97,0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,196,97,0.5);
  color: #fff;
}

.btn-premium {
  background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
  color: #fff;
  box-shadow: 0 4px 20px rgba(168,85,247,0.35);
}
.btn-premium:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(168,85,247,0.5);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-glass-light);
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  color: #fff;
}
.btn-danger:hover { transform: translateY(-2px); }

.btn-sm  { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.9rem 2.5rem; font-size: 1rem; }
.btn-xl  { padding: 1.1rem 3rem; font-size: 1.1rem; }
.btn-icon{ padding: 0.65rem; border-radius: var(--radius-md); }

/* ─── Form Inputs ───────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 0.4rem; }
.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input, select.input, textarea.input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,196,97,0.15);
}
.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 2.75rem; }
.input-icon-wrap .icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-green   { background: rgba(0,196,97,0.15); color: var(--brand); border: 1px solid rgba(0,196,97,0.25); }
.badge-purple  { background: rgba(168,85,247,0.15); color: var(--purple-400); border: 1px solid rgba(168,85,247,0.25); }
.badge-gold    { background: rgba(251,191,36,0.15); color: var(--gold-400); border: 1px solid rgba(251,191,36,0.25); }
.badge-red     { background: rgba(239,68,68,0.15); color: var(--red-400); border: 1px solid rgba(239,68,68,0.25); }
.badge-blue    { background: rgba(59,130,246,0.15); color: #60A5FA; border: 1px solid rgba(59,130,246,0.25); }
.badge-gray    { background: rgba(100,116,139,0.15); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-premium { background: linear-gradient(135deg,rgba(168,85,247,0.2),rgba(124,58,237,0.2)); color: var(--purple-400); border: 1px solid rgba(168,85,247,0.3); }

/* ─── Stats Card ────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition);
  cursor: default;
}
.stat-card:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-brand);
  transform: translateY(-2px);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon-green  { background: rgba(0,196,97,0.12); }
.stat-icon-purple { background: rgba(168,85,247,0.12); }
.stat-icon-gold   { background: rgba(251,191,36,0.12); }
.stat-icon-red    { background: rgba(239,68,68,0.12); }
.stat-icon-blue   { background: rgba(59,130,246,0.12); }

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ─── Progress Bar ──────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--brand), var(--green-400));
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.progress-fill-purple { background: linear-gradient(90deg, var(--purple-600), var(--purple-400)); }
.progress-fill-gold   { background: linear-gradient(90deg, var(--gold-500), var(--gold-400)); }

/* ─── MCQ Option Button ─────────────────────────────────────── */
.mcq-option {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-bounce);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.mcq-option:hover:not(:disabled) {
  border-color: var(--brand);
  background: rgba(0,196,97,0.05);
  transform: translateX(4px);
}
.mcq-option .opt-letter {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-glass-light);
  border: 1.5px solid var(--border-hover);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.mcq-option:hover:not(:disabled) .opt-letter {
  background: rgba(0,196,97,0.15);
  border-color: var(--brand);
  color: var(--brand);
}
.mcq-option.selected { border-color: var(--brand); background: rgba(0,196,97,0.08); }
.mcq-option.selected .opt-letter { background: var(--brand); border-color: var(--brand); color: #000; }
.mcq-option.correct  { border-color: var(--green-500)!important; background: rgba(34,197,94,0.1)!important; }
.mcq-option.correct .opt-letter { background: var(--green-500)!important; border-color: var(--green-500)!important; color: #fff; }
.mcq-option.wrong    { border-color: var(--red-500)!important; background: rgba(239,68,68,0.1)!important; }
.mcq-option.wrong .opt-letter { background: var(--red-500)!important; border-color: var(--red-500)!important; color: #fff; }
.mcq-option:disabled { cursor: default; }

/* ─── Explanation Panel ─────────────────────────────────────── */
.explanation-panel {
  background: rgba(0,196,97,0.06);
  border: 1px solid rgba(0,196,97,0.2);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  display: none;
  animation: slideDown 0.3s ease;
}
.explanation-panel.show { display: block; }
.explanation-panel .exp-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.4rem;
}
.explanation-panel.wrong-exp {
  background: rgba(239,68,68,0.06);
  border-color: rgba(239,68,68,0.2);
}
.explanation-panel.wrong-exp .exp-label { color: var(--red-400); }

/* ─── Navigation ────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text-primary);
  text-decoration: none;
}
.nav-brand .brand-dot { color: var(--brand); }
.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.nav-links a {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-glass-light);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--green-600));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #000;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.nav-avatar:hover { border-color: var(--brand); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}
.nav-toggle span {
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  }
  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.5rem;
  }
  .nav-links a {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 1rem;
  }
  .nav-menu .nav-user {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.75rem;
  }
  .nav-menu .nav-user .btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.5rem;
  }
  /* Keep dashboard and pages nav user horizontal and compact on mobile */
  .nav-inner > .nav-user {
    flex-direction: row !important;
    width: auto !important;
    gap: 0.4rem !important;
    align-items: center !important;
  }
  .nav-inner > .nav-user .btn {
    width: auto !important;
  }
}

/* ─── Sidebar (dashboard) ───────────────────────────────────── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 1.5rem 0;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  margin-bottom: 0.1rem;
}
.sidebar-item:hover { color: var(--text-primary); background: var(--bg-glass-light); }
.sidebar-item.active {
  color: var(--brand);
  background: rgba(0,196,97,0.07);
  border-left-color: var(--brand);
}
.sidebar-item .icon { width: 20px; flex-shrink: 0; }

/* ─── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 260px;
  max-width: 380px;
}
.toast-success { border-color: rgba(0,196,97,0.3); }
.toast-success .toast-icon { color: var(--brand); }
.toast-error   { border-color: rgba(239,68,68,0.3); }
.toast-error .toast-icon   { color: var(--red-400); }
.toast-info    { border-color: rgba(59,130,246,0.3); }
.toast-info .toast-icon    { color: #60A5FA; }
.toast-exit { animation: toastOut 0.25s ease forwards; }

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-glass-light);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.1rem;
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ─── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-card); }
th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-glass-light); }

/* ─── Skeleton Loader ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
.skeleton-text  { height: 14px; margin-bottom: 0.5rem; }
.skeleton-title { height: 22px; margin-bottom: 0.75rem; }
.skeleton-card  { height: 120px; }

/* ─── Streak Flame ──────────────────────────────────────────── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(251,191,36,0.12);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.85rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--gold-400);
}
.streak-flame { animation: flamePulse 1.2s ease-in-out infinite; }

/* ─── Rank Badge ─────────────────────────────────────────────── */
.rank-1 { color: var(--gold-400); }
.rank-2 { color: #94A3B8; }
.rank-3 { color: #CD7C32; }

/* ─── Divider ───────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* ─── Responsive Grid ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }

@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); } /* 2 columns for stats on mobile */
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    height: 100vh;
    z-index: 1010;
    box-shadow: var(--shadow-lg);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
  }
  .sidebar.active {
    left: 0;
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1009;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }
  .container, .container-sm { padding: 0 1rem; }

  /* Nav Container Responsive */
  .nav-container {
    padding: 0 1rem !important;
  }

  /* Streak badge responsive collapse */
  .streak-badge .streak-text {
    display: none !important;
  }
  .streak-badge {
    padding: 0.3rem 0.6rem !important;
  }

  /* Page body responsive padding */
  .page-body {
    padding: 1rem 1rem 1.5rem !important;
  }

  /* Responsive Stats Card */
  .stat-card {
    padding: 0.75rem 1rem !important;
    gap: 0.5rem !important;
  }
  .stat-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.1rem !important;
  }
  .stat-value {
    font-size: 1.35rem !important;
  }
  .stat-label {
    font-size: 0.7rem !important;
  }

  /* Responsive Quick Actions */
  .quick-actions {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .qa-card {
    padding: 1rem !important;
    gap: 0.5rem !important;
  }
  .qa-card h4 {
    font-size: 0.9rem !important;
  }
  .qa-card p {
    font-size: 0.75rem !important;
  }

  /* Practice Session Stats Bar Responsive */
  .session-stats {
    padding: 0.75rem 1rem !important;
    gap: 0.75rem !important;
    flex-wrap: wrap !important;
  }

  /* Mock Test Layout Mobile Stacking */
  .mock-layout {
    flex-direction: column !important;
  }
  .mock-palette {
    width: 100% !important;
    height: auto !important;
    position: static !important;
    border-right: none !important;
    border-top: 1px solid var(--border) !important;
    order: 2 !important; /* Stack below content */
    padding: 1rem !important;
  }
  .mock-main {
    order: 1 !important;
  }
  .mock-body {
    padding: 1rem !important;
  }
  .timer-bar {
    padding: 0.5rem 1rem !important;
  }
}

/* ─── Nav Container Default ───────────────────────────────────── */
.nav-container {
  padding: 0 2rem;
  width: 100%;
}

/* ─── Flex Utilities ────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }

/* ─── Spacing Utilities ─────────────────────────────────────── */
.mt-1{margin-top:0.25rem}.mt-2{margin-top:0.5rem}.mt-3{margin-top:0.75rem}
.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}
.mb-1{margin-bottom:0.25rem}.mb-2{margin-bottom:0.5rem}.mb-3{margin-bottom:0.75rem}
.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}
.p-4{padding:1rem}.p-6{padding:1.5rem}

/* ─── Text Utilities ────────────────────────────────────────── */
.text-brand   { color: var(--brand); }
.text-purple  { color: var(--purple-400); }
.text-gold    { color: var(--gold-400); }
.text-red     { color: var(--red-400); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm  { font-size: 0.85rem; }
.text-xs  { font-size: 0.75rem; }
.text-lg  { font-size: 1.1rem; }
.font-bold { font-weight: 700; }
.font-600  { font-weight: 600; }
.text-center { text-align: center; }

/* ─── Gradient Text ─────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--brand), var(--green-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-text-purple {
  background: linear-gradient(135deg, var(--purple-400), var(--purple-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Section Titles ────────────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.5rem;
}

/* ─── Alert Banners ─────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.alert-success { background: rgba(0,196,97,0.1); border: 1px solid rgba(0,196,97,0.2); color: var(--brand); }
.alert-error   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: var(--red-400); }
.alert-info    { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: #60A5FA; }
.alert-premium { background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.2); color: var(--purple-400); }

/* ─── Premium Lock Overlay ──────────────────────────────────── */
.premium-lock {
  position: relative;
  overflow: hidden;
}
.premium-lock::after {
  content: '🔒 Premium';
  position: absolute; inset: 0;
  background: rgba(7,8,13,0.85);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--purple-400);
  border-radius: inherit;
  border: 1px solid rgba(168,85,247,0.3);
}

/* ─── Animations ────────────────────────────────────────────── */
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes slideDown { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes modalIn { from{opacity:0;transform:scale(0.9) translateY(20px)} to{opacity:1;transform:scale(1) translateY(0)} }
@keyframes toastIn { from{opacity:0;transform:translateX(120%)} to{opacity:1;transform:translateX(0)} }
@keyframes toastOut { from{opacity:1;transform:translateX(0)} to{opacity:0;transform:translateX(120%)} }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
@keyframes flamePulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15) rotate(5deg)} }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes bounceIn {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes confettiFall {
  0%   { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes countUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

/* ─── Utility Animations ────────────────────────────────────── */
.animate-fadeIn   { animation: fadeIn 0.4s ease; }
.animate-slideUp  { animation: slideUp 0.4s ease; }
.animate-bounceIn { animation: bounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.animate-pulse    { animation: pulse 2s ease infinite; }
.animate-spin     { animation: spin 1s linear infinite; }

/* ─── Confetti ───────────────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  width: 10px; height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  z-index: 9999;
  pointer-events: none;
}

/* ─── Mobile Bottom Nav ─────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--bg-bottom-nav);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0 env(safe-area-inset-bottom,0.5rem);
  z-index: 99;
}
.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  transition: color var(--transition);
  border-radius: var(--radius-md);
}
.bottom-nav-item.active { color: var(--brand); }
.bottom-nav-item svg { width: 22px; height: 22px; }

@media (max-width: 768px) {
  .bottom-nav { display: block; }
  body { padding-bottom: 70px; }
}

/* ─── Global Utility Classes ────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Flashcards Spaced Repetition ──────────────────────────── */
.flashcards-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
  width: 100%;
}

.flashcard-perspective {
  perspective: 1000px;
  width: 100%;
  max-width: 550px;
  height: 360px;
  cursor: pointer;
  position: relative;
}

.flashcard-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.flashcard-perspective.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-y: auto;
}

.flashcard-back {
  transform: rotateY(180deg);
  border-color: rgba(0, 196, 97, 0.2);
}

.flashcard-subject-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  margin-bottom: 1rem;
}

.flashcard-question-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.flashcard-hint-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
  animation: pulse 2.5s infinite ease-in-out;
}

.flashcard-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  width: 100%;
  text-align: left;
}

.flashcard-mini-option {
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.flashcard-mini-option.correct-option {
  background: rgba(34, 197, 94, 0.08);
  border-color: var(--green-500);
  color: #4ADE80;
}

.flashcard-explanation {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  text-align: left;
}

.rating-buttons-group {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  margin-top: auto;
}

.rating-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-bounce);
  color: #fff;
  font-weight: 600;
}

.rating-btn:active {
  transform: scale(0.95);
}

.rating-btn-again {
  background: linear-gradient(135deg, #EF4444, #991B1B);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.rating-btn-again:hover {
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
}

.rating-btn-good {
  background: linear-gradient(135deg, #3B82F6, #1E40AF);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.rating-btn-good:hover {
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
  transform: translateY(-2px);
}

.rating-btn-easy {
  background: linear-gradient(135deg, var(--brand), var(--green-600));
  box-shadow: 0 4px 12px rgba(0, 196, 97, 0.2);
}

.rating-btn-easy:hover {
  box-shadow: 0 6px 16px rgba(0, 196, 97, 0.35);
  transform: translateY(-2px);
}

.rating-btn .interval-lbl {
  font-size: 0.7rem;
  opacity: 0.85;
  font-weight: normal;
  margin-top: 0.15rem;
}

.flashcards-progress-container {
  width: 100%;
  max-width: 550px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.flashcards-progress-tracker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.flashcard-status-counter {
  font-weight: 700;
  font-size: 0.9rem;
}

.study-completed-card {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
  margin: 2rem auto;
  animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Dynamic Subject Chips & Feedback Rating ───────────────── */
.subject-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.subject-chip {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.subject-chip:hover {
  border-color: var(--brand);
  color: var(--text-primary);
}
.subject-chip.active {
  background: rgba(0, 196, 97, 0.12);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(0, 196, 97, 0.1);
}
.rating-stars {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0 1rem;
}
.star-btn {
  font-size: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
  user-select: none;
}
.star-btn:hover {
  transform: scale(1.25);
}
.rating-emoji {
  font-size: 2.75rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}
#sidebarToggle.nav-toggle {
  display: none;
  justify-content: space-between;
  align-items: center;
}
@media (max-width: 768px) {
  #sidebarToggle.nav-toggle {
    display: flex !important;
  }
}

/* ─── Mobile: Hide top nav on internal app pages ──────────────── */
@media (max-width: 768px) {
  .app-inner-nav {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* ─── Notification Dropdown ─── */
.notification-bell-container {
  position: relative;
  display: inline-flex;
}

#btnNotificationBell {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  width: 36px;
  height: 36px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition);
  color: var(--text-primary);
  flex-shrink: 0;
}

#btnNotificationBell:hover {
  border-color: var(--brand);
  background: var(--bg-glass-light);
}

.noti-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red-500);
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 700;
  border: 2px solid var(--bg-surface);
  line-height: 1;
}

.noti-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  transform-origin: top right;
  animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.noti-dropdown.hidden {
  display: none !important;
}

.noti-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.noti-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.noti-header .btn-text {
  font-size: 0.75rem;
  color: var(--brand);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 600;
}

.noti-header .btn-text:hover {
  color: var(--green-400);
}

.noti-list {
  overflow-y: auto;
  flex: 1;
}

.noti-item {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: inherit;
}

.noti-item:hover {
  background: var(--bg-glass-light);
}

.noti-item.unread {
  background: rgba(0, 196, 97, 0.03);
}

.noti-item.unread::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--brand);
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.noti-item-content {
  flex: 1;
  min-width: 0;
}

.noti-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.15rem;
}

.noti-item-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.noti-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.noti-item-delete {
  font-size: 0.9rem;
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--transition);
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0 4px;
}

.noti-item:hover .noti-item-delete {
  opacity: 1;
}

.noti-item-delete:hover {
  color: var(--red-400);
}

.noti-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.noti-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  text-align: center;
  background: var(--bg-glass-light);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.noti-footer a {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.noti-footer a:hover {
  color: var(--text-secondary);
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
