/* ============================
   EduAI Zimbabwe - Main Styles
   ============================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --secondary: #7c3aed;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #1e1b4b;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

/* ─── App Layout ────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 10px; color: white; }
.logo-icon { font-size: 28px; }
.logo-name { display: block; font-size: 18px; font-weight: 700; color: white; }
.logo-country { display: block; font-size: 11px; color: rgba(255,255,255,0.6); letter-spacing: 0.5px; }

.sidebar-close {
  background: none; border: none; color: rgba(255,255,255,0.6);
  cursor: pointer; padding: 4px; display: none;
}
.sidebar-close svg { width: 20px; height: 20px; }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section { margin-bottom: 8px; }

.nav-section-title {
  display: block;
  padding: 4px 16px 8px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  margin: 1px 0;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { color: white; background: rgba(255,255,255,0.08); border-left-color: rgba(255,255,255,0.3); }
.nav-item.active { color: white; background: rgba(255,255,255,0.15); border-left-color: var(--accent); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.upgrade-banner {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(245,158,11,0.1));
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--border-radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.upgrade-icon { font-size: 24px; }
.upgrade-title { font-size: 12px; font-weight: 600; color: white; }
.upgrade-desc { font-size: 11px; color: rgba(255,255,255,0.6); }
.btn-upgrade {
  margin-left: auto;
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-upgrade:hover { background: #d97706; color: white; }

.user-profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.9);
  padding: 8px;
  border-radius: var(--border-radius-sm);
  transition: background 0.2s;
}
.user-profile-link:hover { background: rgba(255,255,255,0.08); color: white; }

.avatar-circle {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #f97316);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.6); }
.badge-premium {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px; margin-left: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ─── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-menu-btn {
  background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: 8px; color: var(--gray-600);
  display: none;
}
.topbar-menu-btn:hover { background: var(--gray-100); }
.topbar-menu-btn svg { width: 20px; height: 20px; }

.topbar-title { flex: 1; font-size: 16px; font-weight: 600; color: var(--gray-800); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.notification-btn {
  position: relative; cursor: pointer;
  padding: 8px; border-radius: 8px; color: var(--gray-600);
  background: none; transition: background 0.2s;
}
.notification-btn:hover { background: var(--gray-100); }
.notification-btn svg { width: 20px; height: 20px; display: block; }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.notification-dropdown {
  position: absolute; top: calc(var(--topbar-height) - 8px); right: 72px;
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--border-radius); box-shadow: var(--shadow-lg);
  width: 340px; max-height: 400px;
  overflow-y: auto; display: none; z-index: 200;
}
.notification-dropdown.show { display: block; }

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
  font-weight: 600; font-size: 14px; color: var(--gray-800);
}
.notif-mark-all {
  background: none; border: none; color: var(--primary);
  font-size: 12px; cursor: pointer; font-weight: 500;
}
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--gray-50);
  font-size: 13px;
}
.notif-item.unread { background: var(--primary-light); }
.notif-item-title { font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.notif-item-msg { color: var(--gray-600); font-size: 12px; }
.notif-loading { padding: 20px; text-align: center; color: var(--gray-500); font-size: 14px; }
.notif-empty { padding: 20px; text-align: center; color: var(--gray-400); font-size: 13px; }

.topbar-logout {
  padding: 8px; border-radius: 8px; color: var(--gray-600); transition: all 0.2s;
}
.topbar-logout:hover { background: #fef2f2; color: var(--danger); }
.topbar-logout svg { width: 20px; height: 20px; display: block; }

/* ─── Flash Messages ─────────────────────────────────────────────────────── */
.flash-container { padding: 12px 24px 0; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--border-radius-sm);
  font-size: 14px; margin-bottom: 8px;
}
.flash svg { width: 18px; height: 18px; flex-shrink: 0; }
.flash-close {
  margin-left: auto; background: none; border: none;
  cursor: pointer; font-size: 18px; line-height: 1; opacity: 0.7;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ─── Page Content ───────────────────────────────────────────────────────── */
.page-content { flex: 1; padding: 24px; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--border-radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.card-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ─── Stats Cards ────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--white); border-radius: var(--border-radius);
  padding: 20px; border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--border-radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 12px;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.stat-trend { font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px; border-radius: var(--border-radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.2s; white-space: nowrap;
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-800); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-warning { background: var(--accent); color: white; }
.btn-warning:hover { background: #d97706; color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--border-radius); }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-control {
  display: block; width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-300); border-radius: var(--border-radius-sm);
  font-size: 14px; font-family: var(--font); background: white;
  color: var(--gray-800); transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 16px;
  background: var(--gray-50); border-bottom: 2px solid var(--gray-200);
  font-weight: 600; color: var(--gray-700); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ─── Progress Bar ───────────────────────────────────────────────────────── */
.progress { height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.progress-primary { background: var(--primary); }
.progress-success { background: var(--success); }
.progress-warning { background: var(--warning); }
.progress-danger { background: var(--danger); }

/* ─── Subject Cards ──────────────────────────────────────────────────────── */
.subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

.subject-card {
  background: white; border-radius: var(--border-radius-lg);
  border: 1px solid var(--gray-200); overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.subject-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.subject-card-header {
  height: 100px; display: flex; align-items: center; justify-content: center;
  font-size: 40px; position: relative;
}
.subject-card-body { padding: 16px 20px 20px; }
.subject-card-name { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.subject-card-desc { font-size: 13px; color: var(--gray-500); margin-bottom: 12px; }
.subject-card-footer { display: flex; justify-content: space-between; align-items: center; }
.mastery-badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px;
}
.mastery-expert { background: #d1fae5; color: #065f46; }
.mastery-intermediate { background: #dbeafe; color: #1e40af; }
.mastery-beginner { background: var(--gray-100); color: var(--gray-600); }

/* ─── Achievement Cards ──────────────────────────────────────────────────── */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.achievement-card {
  background: white; border: 1px solid var(--gray-200); border-radius: var(--border-radius);
  padding: 20px; text-align: center; transition: transform 0.2s;
}
.achievement-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.achievement-icon { font-size: 40px; margin-bottom: 8px; }
.achievement-name { font-size: 13px; font-weight: 700; color: var(--gray-800); margin-bottom: 4px; }
.achievement-desc { font-size: 11px; color: var(--gray-500); }
.achievement-card.locked { opacity: 0.4; filter: grayscale(100%); }
.achievement-xp { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 6px; }

/* ─── XP/Level Bar ───────────────────────────────────────────────────────── */
.xp-bar-container { background: var(--gray-100); border-radius: 99px; height: 10px; overflow: hidden; }
.xp-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 99px; transition: width 0.5s ease; }

/* ─── Streak Widget ──────────────────────────────────────────────────────── */
.streak-widget { display: flex; align-items: center; gap: 12px; }
.streak-flame { font-size: 32px; }
.streak-count { font-size: 28px; font-weight: 800; color: var(--gray-900); line-height: 1; }
.streak-label { font-size: 13px; color: var(--gray-500); }

/* ─── Quiz Styles ────────────────────────────────────────────────────────── */
.quiz-question {
  background: white; border: 1px solid var(--gray-200); border-radius: var(--border-radius);
  padding: 24px; margin-bottom: 20px;
}
.question-number {
  font-size: 12px; font-weight: 600; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.question-text { font-size: 16px; font-weight: 500; color: var(--gray-900); margin-bottom: 16px; }
.question-options { display: flex; flex-direction: column; gap: 10px; }
.option-label {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 2px solid var(--gray-200);
  border-radius: var(--border-radius-sm); cursor: pointer; transition: all 0.2s;
}
.option-label:hover { border-color: var(--primary); background: var(--primary-light); }
.option-label input { display: none; }
.option-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-100); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; color: var(--gray-600);
}
.option-label:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.option-label:has(input:checked) .option-letter { background: var(--primary); color: white; }

.option-correct { border-color: var(--success) !important; background: #d1fae5 !important; }
.option-wrong { border-color: var(--danger) !important; background: #fee2e2 !important; }
.option-correct .option-letter { background: var(--success) !important; color: white !important; }
.option-wrong .option-letter { background: var(--danger) !important; color: white !important; }

/* ─── Result Card ────────────────────────────────────────────────────────── */
.result-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white; border-radius: var(--border-radius-lg); padding: 40px; text-align: center;
}
.result-score { font-size: 64px; font-weight: 800; line-height: 1; }
.result-grade { font-size: 24px; font-weight: 700; opacity: 0.9; }
.result-label { font-size: 16px; opacity: 0.8; margin-top: 8px; }

/* ─── Chat Styles (AI Tutor) ─────────────────────────────────────────────── */
.chat-container {
  display: flex; flex-direction: column; height: calc(100vh - var(--topbar-height) - 130px);
  background: white; border-radius: var(--border-radius); border: 1px solid var(--gray-200);
  overflow: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-message { display: flex; gap: 12px; max-width: 85%; }
.chat-message.user { flex-direction: row-reverse; align-self: flex-end; }
.chat-message.assistant { align-self: flex-start; }
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.chat-message.user .chat-avatar { background: var(--primary); color: white; font-size: 14px; font-weight: 700; }
.chat-message.assistant .chat-avatar { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.chat-bubble {
  padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.6;
}
.chat-message.user .chat-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.chat-message.assistant .chat-bubble {
  background: var(--gray-100); color: var(--gray-800); border-bottom-left-radius: 4px;
}
.chat-message.assistant .chat-bubble h1,
.chat-message.assistant .chat-bubble h2,
.chat-message.assistant .chat-bubble h3 { margin-top: 12px; margin-bottom: 6px; }
.chat-message.assistant .chat-bubble ul,
.chat-message.assistant .chat-bubble ol { padding-left: 20px; margin: 8px 0; }
.chat-message.assistant .chat-bubble strong { font-weight: 700; }
.chat-message.assistant .chat-bubble code {
  background: white; padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 13px;
}
.chat-input-area {
  padding: 16px; border-top: 1px solid var(--gray-200);
  display: flex; gap: 10px; align-items: flex-end;
}
.chat-input {
  flex: 1; padding: 12px 14px; border: 1.5px solid var(--gray-300);
  border-radius: var(--border-radius); font-size: 14px; font-family: var(--font);
  resize: none; min-height: 46px; max-height: 120px; overflow-y: auto;
  transition: border-color 0.2s;
}
.chat-input:focus { outline: none; border-color: var(--primary); }
.chat-send-btn {
  width: 46px; height: 46px; background: var(--primary); color: white;
  border: none; border-radius: var(--border-radius); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--primary-dark); }
.chat-send-btn svg { width: 18px; height: 18px; }
.chat-typing { display: flex; gap: 4px; align-items: center; padding: 8px; }
.chat-typing-dot { width: 8px; height: 8px; background: var(--gray-400); border-radius: 50%; animation: typing 1.2s infinite; }
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ─── Lesson Content ─────────────────────────────────────────────────────── */
.lesson-content h1 { font-size: 24px; color: var(--gray-900); margin-bottom: 16px; }
.lesson-content h2 { font-size: 18px; color: var(--gray-800); margin: 20px 0 10px; border-left: 4px solid var(--primary); padding-left: 12px; }
.lesson-content h3 { font-size: 15px; color: var(--gray-700); margin: 16px 0 8px; }
.lesson-content p { margin-bottom: 12px; color: var(--gray-700); }
.lesson-content ul, .lesson-content ol { padding-left: 24px; margin: 12px 0; }
.lesson-content li { margin-bottom: 6px; color: var(--gray-700); }

.key-points-card {
  background: var(--primary-light); border-left: 4px solid var(--primary);
  border-radius: var(--border-radius-sm); padding: 16px; margin: 16px 0;
}
.example-card {
  background: #f0fdf4; border-left: 4px solid var(--success);
  border-radius: var(--border-radius-sm); padding: 16px; margin: 16px 0;
}
.exercise-card {
  background: #fffbeb; border: 1px solid #fcd34d;
  border-radius: var(--border-radius); padding: 20px; margin: 12px 0;
}
.revision-card {
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--border-radius); padding: 16px;
}
.revision-card-term { font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.revision-card-def { font-size: 14px; color: var(--gray-700); }

/* ─── Study Plan ─────────────────────────────────────────────────────────── */
.plan-day {
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--border-radius); padding: 20px; margin-bottom: 16px;
}
.plan-day-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.plan-day-number {
  width: 40px; height: 40px; background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.plan-day-name { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.plan-day-theme { font-size: 13px; color: var(--gray-500); }
.plan-session {
  background: var(--gray-50); border-radius: var(--border-radius-sm);
  padding: 12px 14px; margin-bottom: 8px;
  display: flex; gap: 12px; align-items: flex-start;
}
.plan-session-time { font-size: 12px; font-weight: 600; color: var(--primary); min-width: 130px; }
.plan-session-content { flex: 1; }
.plan-session-subject { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.plan-session-activity { font-size: 13px; color: var(--gray-500); }

/* ─── Leaderboard ────────────────────────────────────────────────────────── */
.leaderboard-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px; border-bottom: 1px solid var(--gray-100);
}
.leaderboard-row:last-child { border-bottom: none; }
.lb-rank { font-size: 18px; font-weight: 800; min-width: 32px; text-align: center; }
.lb-rank-1 { color: #f59e0b; }
.lb-rank-2 { color: #9ca3af; }
.lb-rank-3 { color: #cd7f32; }
.lb-name { flex: 1; font-weight: 600; font-size: 14px; }
.lb-grade { font-size: 12px; color: var(--gray-500); }
.lb-xp { font-size: 14px; font-weight: 700; color: var(--primary); }

/* ─── Public Pages ───────────────────────────────────────────────────────── */
.public-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 48px; background: white; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm);
}
.pub-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--dark); }
.pub-logo span:first-child { font-size: 24px; }
.pub-nav-links { display: flex; align-items: center; gap: 24px; }
.pub-nav-links a { font-size: 15px; font-weight: 500; color: var(--gray-700); }
.pub-nav-links a:hover { color: var(--primary); }

/* Landing Hero */
.hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
  padding: 80px 48px; text-align: center; color: white;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 16px; border-radius: 99px; font-size: 13px; font-weight: 500;
  margin-bottom: 24px;
}
.hero-title { font-size: 52px; font-weight: 800; line-height: 1.15; margin-bottom: 20px; }
.hero-title span { color: var(--accent); }
.hero-subtitle { font-size: 18px; opacity: 0.85; max-width: 600px; margin: 0 auto 36px; line-height: 1.6; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; justify-content: center; gap: 48px;
  margin-top: 60px; flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-value { font-size: 32px; font-weight: 800; color: var(--accent); }
.hero-stat-label { font-size: 14px; opacity: 0.7; }

.features-section { padding: 80px 48px; background: var(--gray-50); }
.section-title { text-align: center; font-size: 36px; font-weight: 800; color: var(--gray-900); margin-bottom: 12px; }
.section-subtitle { text-align: center; font-size: 16px; color: var(--gray-500); max-width: 600px; margin: 0 auto 48px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 1200px; margin: 0 auto; }
.feature-card {
  background: white; border-radius: var(--border-radius-lg); padding: 28px;
  border: 1px solid var(--gray-200); text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 40px; margin-bottom: 16px; }
.feature-title { font-size: 18px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.feature-desc { font-size: 14px; color: var(--gray-600); line-height: 1.6; }

.cta-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 80px 48px; text-align: center; color: white;
}
.cta-title { font-size: 36px; font-weight: 800; margin-bottom: 16px; }
.cta-subtitle { font-size: 18px; opacity: 0.85; margin-bottom: 36px; }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; max-width: 800px; margin: 0 auto; }
.pricing-card {
  background: white; border-radius: var(--border-radius-lg); padding: 36px;
  border: 2px solid var(--gray-200); text-align: center;
}
.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}
.pricing-name { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.pricing-price { font-size: 48px; font-weight: 800; color: var(--primary); margin: 16px 0; }
.pricing-period { font-size: 14px; color: var(--gray-500); }
.pricing-features { list-style: none; text-align: left; margin: 24px 0; }
.pricing-features li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--gray-700); }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 700; }

/* Footer */
.public-footer { background: var(--dark); padding: 48px 48px 24px; }
.footer-content { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 24px; margin-bottom: 32px; }
.footer-brand { color: rgba(255,255,255,0.9); }
.footer-brand p { font-size: 14px; color: rgba(255,255,255,0.5); margin-top: 8px; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,0.6); font-size: 14px; }
.footer-links a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; text-align: center; }
.footer-bottom p { color: rgba(255,255,255,0.4); font-size: 13px; }

/* Auth Pages */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: white; border-radius: var(--border-radius-lg);
  padding: 40px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-icon { font-size: 40px; }
.auth-logo h1 { font-size: 22px; font-weight: 800; color: var(--gray-900); margin-top: 8px; }
.auth-logo p { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.auth-divider { text-align: center; color: var(--gray-400); font-size: 13px; margin: 16px 0; }
.role-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.role-tab {
  flex: 1; padding: 10px; text-align: center; border-radius: var(--border-radius-sm);
  font-size: 14px; font-weight: 600; border: 2px solid var(--gray-200);
  color: var(--gray-600); cursor: pointer; transition: all 0.2s; background: none;
  text-decoration: none; display: block;
}
.role-tab:hover { border-color: var(--primary); color: var(--primary); }
.role-tab.active { border-color: var(--primary); background: var(--primary); color: white; }

/* Sidebar Overlay */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }

/* Timer */
.exam-timer {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--danger); color: white;
  padding: 8px 16px; border-radius: var(--border-radius); font-weight: 700;
}
.exam-timer.warning { background: var(--warning); }

/* Page Header */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 800; color: var(--gray-900); margin-bottom: 4px; }
.page-header p { font-size: 14px; color: var(--gray-500); }

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

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: flex; }
  .sidebar-overlay.show { display: block; }

  .main-content { margin-left: 0; }
  .topbar-menu-btn { display: flex; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hero { padding: 48px 24px; }
  .hero-title { font-size: 32px; }
  .features-section { padding: 48px 24px; }
  .public-nav { padding: 16px 24px; }
  .pub-nav-links .btn-outline, .pub-nav-links .btn-primary { padding: 8px 14px; font-size: 13px; }
  .page-content { padding: 16px; }
  .notification-dropdown { right: 8px; width: calc(100vw - 16px); }
  .chat-container { height: calc(100vh - var(--topbar-height) - 200px); }
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 24px; }
  .hero-title { font-size: 26px; }
  .stat-value { font-size: 22px; }
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }

@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
.slide-in { animation: slideIn 0.3s ease; }

.loading-spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%; border-top-color: white;
  animation: spin 0.8s ease infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Markdown rendered content */
.md-content h1 { font-size: 22px; font-weight: 700; margin: 16px 0 8px; }
.md-content h2 { font-size: 18px; font-weight: 600; margin: 14px 0 8px; color: var(--primary); }
.md-content h3 { font-size: 15px; font-weight: 600; margin: 12px 0 6px; }
.md-content p { margin-bottom: 10px; line-height: 1.7; }
.md-content ul, .md-content ol { padding-left: 22px; margin: 10px 0; }
.md-content li { margin-bottom: 4px; }
.md-content strong { font-weight: 700; color: var(--gray-900); }
.md-content code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.9em; }
.md-content pre { background: var(--gray-900); color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.md-content blockquote { border-left: 4px solid var(--primary); padding-left: 16px; color: var(--gray-600); margin: 12px 0; }
