@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=DM+Sans:wght@400;500;600&family=JetBrains+Mono:wght@600&display=swap');

:root {
  /* Light mode (DEFAULT) */
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-input: #F1F5F9;
  --bg-surface: #F1F5F9;
  --accent-primary: #059669;
  --accent-primary-light: #D1FAE5;
  --accent-secondary: #7C3AED;
  --accent-secondary-light: #EDE9FE;
  --accent-warning: #F59E0B;
  --accent-warning-light: #FEF3C7;
  --accent-danger: #EF4444;
  --accent-danger-light: #FEE2E2;
  --accent-info: #3B82F6;
  --accent-info-light: #DBEAFE;
  --accent-pink: #EC4899;
  --accent-pink-light: #FCE7F3;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-on-accent: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --gradient-success: linear-gradient(135deg, #059669, #10B981);
  --gradient-xp: linear-gradient(135deg, #7C3AED, #A855F7);
  --gradient-fire: linear-gradient(135deg, #F59E0B, #EF4444);
  --gradient-premium: linear-gradient(135deg, #F59E0B, #EC4899);
  --gradient-hero: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 50%, #F8FAFC 100%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-glow-green: 0 0 20px rgba(5,150,105,0.15);
  --shadow-glow-purple: 0 0 20px rgba(124,58,237,0.15);
  --shadow-glow-red: 0 0 20px rgba(239,68,68,0.15);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 10px;
}

.dark-mode {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: #1E293B;
  --bg-card-hover: #334155;
  --bg-input: #0F172A;
  --bg-surface: #1E293B;
  --accent-primary: #10B981;
  --accent-primary-light: rgba(16,185,129,0.15);
  --accent-secondary-light: rgba(124,58,237,0.15);
  --accent-warning-light: rgba(245,158,11,0.15);
  --accent-danger-light: rgba(239,68,68,0.15);
  --accent-info-light: rgba(59,130,246,0.15);
  --accent-pink-light: rgba(236,72,153,0.15);
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-on-accent: #FFFFFF;
  --border: #334155;
  --border-light: #1E293B;
  --gradient-hero: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -4px rgba(0,0,0,0.2);
  --shadow-glow-green: 0 0 20px rgba(16,185,129,0.3);
  --shadow-glow-purple: 0 0 20px rgba(124,58,237,0.3);
  --shadow-glow-red: 0 0 20px rgba(239,68,68,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
  padding-bottom: 80px;
}
@media (min-width: 768px) { body { padding-bottom: 0; } }

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.2; color: var(--text-primary); }
h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.75rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

a { color: var(--accent-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-secondary); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 60px;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.3rem; color: var(--text-primary);
}
.logo span { color: var(--accent-primary); }
.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a { color: var(--text-secondary); font-weight: 500; font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-primary); }
.header-right { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  background: var(--bg-surface); border: 1px solid var(--border);
  cursor: pointer; padding: 8px; border-radius: 8px;
  font-size: 1rem; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-card-hover); }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger svg { width: 24px; height: 24px; stroke: var(--text-primary); }
@media (max-width: 767px) {
  .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--bg-secondary); padding: 16px 20px; gap: 16px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
  .nav-links.open { display: flex; }
  .hamburger { display: block; }
  .header-right .btn { display: none; }
}

/* ── Mobile Bottom Nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  height: 64px; padding: 0 8px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-muted); font-size: 0.65rem; font-weight: 500;
  padding: 8px 12px; border-radius: 12px; transition: all 0.2s;
  text-decoration: none;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--accent-primary); background: var(--accent-primary-light); }
@media (min-width: 768px) { .bottom-nav { display: none; } }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px; border: none; border-radius: var(--radius-sm);
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 0.95rem;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gradient-success); color: var(--text-on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: var(--shadow-glow-green); transform: translateY(-1px); color: var(--text-on-accent); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent-primary); }
.btn-purple { background: var(--gradient-xp); color: white; }
.btn-danger { background: var(--accent-danger); color: white; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 0.85rem; }
.btn-full { width: 100%; }
.btn-ghost { background: transparent; color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.btn-ghost:hover { background: var(--accent-primary-light); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── Form Elements ── */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; height: 48px; padding: 0 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-primary);
  font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { height: auto; min-height: 80px; padding: 12px 16px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(5,150,105,0.1); }
input::placeholder { color: var(--text-muted); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; -webkit-appearance: none; }
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 500; }
.input-group input { padding-left: 36px; }

/* ── Quiz Option Buttons ── */
.quiz-option {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 16px 20px;
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 1rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s; text-align: left;
  min-height: 56px;
}
.quiz-option:hover { border-color: var(--accent-primary); background: var(--accent-primary-light); }
.quiz-option.selected { border-color: var(--accent-info); background: var(--accent-info-light); }
.quiz-option.correct { border-color: var(--accent-primary); background: var(--accent-primary-light); animation: correctPulse 0.5s ease; }
.quiz-option.wrong { border-color: var(--accent-danger); background: var(--accent-danger-light); animation: wrongShake 0.5s ease; }
.quiz-option .option-letter {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg-surface); display: flex;
  align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 600;
  font-size: 0.9rem; flex-shrink: 0;
  border: 1px solid var(--border);
}
.quiz-option.correct .option-letter { background: var(--accent-primary); color: var(--text-on-accent); border-color: var(--accent-primary); }
.quiz-option.wrong .option-letter { background: var(--accent-danger); color: white; border-color: var(--accent-danger); }

/* ── Progress Bar ── */
.progress-bar { height: 6px; background: var(--bg-surface); border-radius: 3px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--gradient-success); border-radius: 3px; transition: width 0.3s ease; }

/* ── XP Badge ── */
.xp-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gradient-xp); color: white;
  padding: 4px 12px; border-radius: 100px;
  font-size: 0.8rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Streak ── */
.streak-display {
  font-family: 'JetBrains Mono', monospace; font-weight: 600;
  color: var(--accent-warning);
}

/* ── Quizzy Bot ── */
.quizzy-container {
  position: fixed; bottom: 80px; right: 16px; z-index: 90;
}
@media (min-width: 768px) { .quizzy-container { bottom: 24px; right: 24px; } }
.quizzy-bubble {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  max-width: 280px; font-size: 0.9rem; color: var(--text-secondary);
  box-shadow: var(--shadow-md); margin-bottom: 12px;
  animation: fadeUp 0.3s ease;
}
.quizzy-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--gradient-success);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; cursor: pointer;
  box-shadow: var(--shadow-glow-green);
  animation: float 3s ease-in-out infinite;
}

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: 16px; text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600; font-size: 1.5rem;
  color: var(--accent-primary);
}
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Exam Cards Grid ── */
.exams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.exam-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 24px; border: 1px solid var(--border);
  transition: all 0.2s; cursor: pointer; text-decoration: none; color: inherit;
  display: block; box-shadow: var(--shadow-sm);
}
.exam-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow-green); border-color: var(--accent-primary); }
.exam-card .exam-icon { font-size: 2rem; margin-bottom: 12px; }
.exam-card h3 { margin-bottom: 8px; }
.exam-card .exam-stats { font-size: 0.85rem; color: var(--text-muted); }

/* ── Subject Accordion ── */
.subject-accordion { margin-bottom: 12px; }
.subject-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: 16px 20px; cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.subject-header:hover { background: var(--bg-card-hover); }
.subject-header .arrow { transition: transform 0.2s; color: var(--text-muted); }
.subject-header.open .arrow { transform: rotate(180deg); }
.topic-list { display: none; padding: 8px 0; }
.topic-list.open { display: block; }
.topic-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px 12px 40px;
  border-bottom: 1px solid var(--border-light);
}
.topic-item:last-child { border-bottom: none; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes correctPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(5,150,105,0.3); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(5,150,105,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(5,150,105,0); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}
@keyframes fireGlow {
  0%, 100% { text-shadow: 0 0 5px rgba(245,158,11,0.3); }
  50% { text-shadow: 0 0 15px rgba(245,158,11,0.5), 0 0 30px rgba(239,68,68,0.2); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes levelUpBurst {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes timerUrgent {
  0%, 100% { color: var(--accent-danger); }
  50% { color: #FF6B6B; transform: scale(1.1); }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Hero Section ── */
.hero-section {
  background: var(--gradient-hero);
  padding: 60px 0 40px; text-align: center;
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-section::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(5,150,105,0.06) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(124,58,237,0.04) 0%, transparent 50%);
}
.hero-section > * { position: relative; z-index: 1; }
.hero-section h1 { margin-bottom: 12px; }
.hero-section .subtitle { color: var(--text-secondary); font-size: 1.05rem; max-width: 600px; margin: 0 auto 24px; }

/* ── Section Styling ── */
.section { padding: 48px 0; }
.section-title { text-align: center; margin-bottom: 32px; }
.section-title h2 { margin-bottom: 8px; }
.section-title p { color: var(--text-secondary); }

/* ── Ad Slot ── */
.ad-slot {
  background: var(--bg-surface); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 24px; text-align: center;
  color: var(--text-muted); font-size: 0.8rem; margin: 24px 0;
  min-height: 60px; display: flex; align-items: center; justify-content: center;
}

/* ── Quiz Timer ── */
.quiz-timer { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 1.2rem; color: var(--text-primary); }
.quiz-timer.urgent { animation: timerUrgent 1s ease-in-out infinite; }

/* ── Quiz Header Bar ── */
.quiz-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 20px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  flex-wrap: wrap; gap: 8px;
}
.quiz-header-bar .stat { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-secondary); }

/* ── Level Up Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); align-items: center; justify-content: center;
  padding: 24px; backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--bg-secondary); border-radius: var(--radius);
  padding: 32px; max-width: 400px; width: 100%; text-align: center;
  animation: levelUpBurst 0.5s ease;
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}

/* ── Leaderboard Table ── */
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.leaderboard-table th { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg-surface); }
.leaderboard-table .rank { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.leaderboard-table .you { background: var(--accent-primary-light); }

/* ── Current Affairs ── */
.affairs-category {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-info-light); color: var(--accent-info);
  padding: 4px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 600;
}

/* ── Badge Grid ── */
.badge-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.badge-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: 16px; min-width: 80px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.badge-item .badge-icon { font-size: 1.5rem; }
.badge-item .badge-name { font-size: 0.7rem; color: var(--text-muted); text-align: center; }
.badge-item.locked { opacity: 0.4; }

/* ── Breadcrumb ── */
.breadcrumb { padding: 16px 0; font-size: 0.85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-primary); }
.breadcrumb span { margin: 0 8px; }

/* ── Tab Filters ── */
.tab-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tab-filter {
  padding: 8px 16px; border-radius: 100px; font-size: 0.85rem; font-weight: 500;
  background: var(--bg-card); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer; transition: all 0.2s;
}
.tab-filter:hover, .tab-filter.active {
  background: var(--accent-primary); color: var(--text-on-accent);
  border-color: var(--accent-primary);
}

/* ── Footer ── */
.site-footer {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 48px 0 24px; margin-top: 48px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px; }
.footer-col h4 { color: var(--text-primary); margin-bottom: 16px; font-size: 0.95rem; }
.footer-col a { display: block; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.footer-col a:hover { color: var(--accent-primary); }
.footer-bottom { text-align: center; color: var(--text-muted); font-size: 0.8rem; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ── Responsive helpers ── */
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: block; } }
.show-mobile { display: block; }
@media (min-width: 768px) { .show-mobile { display: none; } }
