/* ============================================================
   ECZ Grade 7 Quiz Platform — Main Stylesheet
   Mobile-first, modern, motivating for Zambian learners
   ============================================================ */

/* ── Google Fonts loaded in header.php ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@600;700;800&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Brand palette — Green & Gold */
  --primary:        #16a34a;
  --primary-light:  #22c55e;
  --primary-dark:   #15803d;
  --secondary:      #f59e0b;
  --secondary-dark: #d97706;

  /* Status */
  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #06b6d4;

  /* Neutrals */
  --bg:         #f0fdf4;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --border-md:  #cbd5e1;
  --text:       #0f172a;
  --text-md:    #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Subject colours */
  --clr-eng: #3b82f6;
  --clr-mat: #10b981;
  --clr-sci: #8b5cf6;
  --clr-cts: #f97316;
  --clr-soc: #ef4444;
  --clr-zam: #f59e0b;
  --clr-sp1: #06b6d4;
  --clr-sp2: #84cc16;

  /* Spacing scale */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* Radii */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);

  /* Transition */
  --transition: 0.2s ease;

  /* Nav height */
  --nav-h: 64px;
}

/* ── 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, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a  { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 1rem; }
ul { list-style: none; }

/* ── Typography ──────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
h3 { font-size: clamp(1.15rem, 3vw, 1.5rem); }
h4 { font-size: 1.15rem; }
p  { color: var(--text-md); margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }

/* ── Layout helpers ──────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--sp-5); }
.container-sm { max-width: 640px; }
.container-md { max-width: 900px; }
.flex  { display: flex; }
.grid  { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.text-center { text-align: center; }
.mt-4  { margin-top: var(--sp-4); }
.mb-4  { margin-bottom: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mb-6  { margin-bottom: var(--sp-6); }
.mt-8  { margin-top: var(--sp-8); }

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  position: sticky; top: 0; z-index: 900;
  box-shadow: var(--shadow-sm);
}
.navbar .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.navbar-brand {
  display: flex; align-items: center; gap: var(--sp-3);
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbar-brand .logo-badge {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.2rem; font-weight: 800;
  flex-shrink: 0;
}
.navbar-nav {
  display: none;
  align-items: center;
  gap: var(--sp-2);
}
.navbar-nav a {
  color: var(--text-md);
  font-weight: 500;
  font-size: 0.93rem;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  transition: background var(--transition), color var(--transition);
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: #dcfce7;
  color: var(--primary);
}
.navbar-actions { display: flex; align-items: center; gap: var(--sp-3); }
.hamburger {
  display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; padding: var(--sp-2);
  cursor: pointer;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--transition); }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none; flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-5);
  gap: var(--sp-2);
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  color: var(--text-md);
  font-weight: 500;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  transition: background var(--transition);
}
.mobile-menu a:hover { background: #dcfce7; color: var(--primary); }

@media(max-width: 767px) {
  /* Keep only first action button (Login / My Dashboard) on mobile */
  .navbar-actions .btn + .btn { display: none; }
  /* Prevent brand overflowing — allow it to shrink */
  .navbar-brand { max-width: calc(100% - 160px); }
  .brand-text { max-width: 100%; }
}
@media(max-width: 420px) {
  /* On very small phones, hide brand text — keep just the G7 badge */
  .brand-text { display: none; }
  .navbar-brand { max-width: none; }
}
@media(min-width: 768px) {
  .navbar-nav { display: flex; }
  .hamburger  { display: none; }
  .mobile-menu { display: none !important; }
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 0.625rem 1.25rem;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 0.9rem;
  border: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap; line-height: 1.4;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(22,163,74,.35); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-dark); color: #fff; transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #dc2626; color: #fff; }
.btn-light   { background: #f8fafc; border-color: var(--border-md); color: var(--text); }
.btn-light:hover   { background: #f1f5f9; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; border-radius: var(--r-md); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
}
.card-body  { padding: var(--sp-6); }
.card-footer {
  padding: var(--sp-4) var(--sp-6);
  background: #f8fafc;
  border-top: 1px solid var(--border);
}
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0; }

/* Stat cards */
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: var(--sp-4);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.stat-value { font-size: 1.85rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; margin-top: var(--sp-1); }
.stat-change { font-size: 0.78rem; font-weight: 600; margin-top: var(--sp-1); }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Subject cards */
.subject-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.subject-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.subject-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.subject-card .subject-name  { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.subject-card .subject-count { font-size: 0.8rem; color: var(--text-muted); }
.subject-card .quiz-count-badge {
  font-size: 0.75rem; font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-full);
  color: #fff; align-self: flex-start;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-5); }
.form-label {
  display: block;
  font-weight: 600; font-size: 0.87rem; color: var(--text-md);
  margin-bottom: var(--sp-2);
}
.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-md);
  font-size: 0.95rem; color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}
.form-control::placeholder { color: var(--text-light); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.invalid-feedback { font-size: 0.8rem; color: var(--danger); margin-top: var(--sp-1); }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: var(--sp-1); }
select.form-control { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* Checkbox / Radio */
.form-check { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px; height: 18px; flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.form-check-label { font-size: 0.9rem; color: var(--text-md); cursor: pointer; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  font-size: 0.9rem; font-weight: 500;
  margin-bottom: var(--sp-5);
  display: flex; align-items: flex-start; gap: var(--sp-3);
  border-left: 4px solid transparent;
}
.alert-info    { background: #ecfeff; border-color: var(--info);    color: #0e7490; }
.alert-success { background: #f0fdf4; border-color: var(--success); color: #15803d; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #b45309; }
.alert-danger  { background: #fef2f2; border-color: var(--danger);  color: #b91c1c; }
.alert-error   { background: #fef2f2; border-color: var(--danger);  color: #b91c1c; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase; white-space: nowrap;
}
.badge-primary  { background: #dcfce7; color: var(--primary); }
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-warning  { background: #fef9c3; color: #a16207; }
.badge-info     { background: #cffafe; color: #0e7490; }
.badge-gray     { background: #f1f5f9; color: var(--text-muted); }
.badge-orange   { background: #ffedd5; color: #c2410c; }
.badge-blue     { background: #dbeafe; color: #1d4ed8; }
.badge-purple   { background: #ede9fe; color: #7c3aed; }
.badge-green    { background: #dcfce7; color: #15803d; }

/* ── Progress bars ───────────────────────────────────────────── */
.progress { background: #e2e8f0; border-radius: var(--r-full); overflow: hidden; height: 8px; }
.progress-bar {
  height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  transition: width 0.6s ease;
}
.progress-bar.success { background: linear-gradient(90deg, #34d399, var(--success)); }
.progress-bar.warning { background: linear-gradient(90deg, #fbbf24, var(--warning)); }
.progress-bar.danger  { background: linear-gradient(90deg, #f87171, var(--danger)); }
.progress-lg { height: 12px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead tr { background: #f8fafc; }
th { padding: var(--sp-3) var(--sp-5); text-align: left; font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--border); color: var(--text-md); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.table-actions { display: flex; gap: var(--sp-2); align-items: center; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-6); }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-md); font-size: 0.87rem; font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  align-items: center; justify-content: center; padding: var(--sp-5);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-xl);
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: slide-up 0.2s ease;
}
.modal-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; font-size: 1.3rem; color: var(--text-muted);
  width: 32px; height: 32px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: #f1f5f9; }
.modal-body { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: var(--sp-3);
}

/* ── Hero section ────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #14532d 0%, var(--primary) 55%, #16a34a 100%);
  color: #fff;
  padding: var(--sp-16) 0 var(--sp-12);
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero h1 { color: #fff; margin-bottom: var(--sp-5); }
.hero p  { color: rgba(255,255,255,.85); font-size: 1.1rem; margin-bottom: var(--sp-8); }
.hero-actions { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.btn-hero-primary {
  background: var(--secondary);
  color: #fff; padding: 0.85rem 2rem;
  border-radius: var(--r-lg); font-weight: 700;
  font-size: 1rem; border: none;
  box-shadow: 0 4px 16px rgba(245,158,11,.45);
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.btn-hero-primary:hover { background: var(--secondary-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(245,158,11,.55); color: #fff; }
.btn-hero-outline {
  background: rgba(255,255,255,.1); backdrop-filter: blur(4px);
  color: #fff; padding: 0.85rem 2rem;
  border-radius: var(--r-lg); font-weight: 600;
  font-size: 1rem; border: 2px solid rgba(255,255,255,.3);
  transition: all var(--transition);
}
.btn-hero-outline:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn-hero-signin {
  background: #fff;
  color: var(--primary-dark);
  padding: 0.85rem 2rem;
  border-radius: var(--r-lg); font-weight: 700;
  font-size: 1rem; border: 2px solid #fff;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.btn-hero-signin:hover { background: transparent; color: #fff; transform: translateY(-2px); }
.btn-hero-register {
  background: rgba(255,255,255,.15); backdrop-filter: blur(4px);
  color: #fff; padding: 0.85rem 2rem;
  border-radius: var(--r-lg); font-weight: 700;
  font-size: 1rem; border: 2px solid rgba(255,255,255,.5);
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.btn-hero-register:hover { background: #fff; color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.15); }

/* ── Feature cards ───────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
  margin-top: var(--sp-10);
}
@media(min-width: 480px)  { .features-grid { grid-template-columns: repeat(2,1fr); } }
@media(min-width: 900px)  { .features-grid { grid-template-columns: repeat(3,1fr); } }
@media(min-width: 1100px) { .features-grid { grid-template-columns: repeat(4,1fr); } }

.feature-card {
  background: var(--surface);
  border-radius: var(--r-lg); padding: var(--sp-6);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-icon { font-size: 2rem; margin-bottom: var(--sp-4); }
.feature-title { font-weight: 700; margin-bottom: var(--sp-2); }
.feature-desc  { font-size: 0.88rem; color: var(--text-muted); margin: 0; }

/* ── Subjects showcase grid ──────────────────────────────────── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: var(--sp-4);
}
@media(min-width: 600px)  { .subjects-grid { grid-template-columns: repeat(3,1fr); } }
@media(min-width: 900px)  { .subjects-grid { grid-template-columns: repeat(4,1fr); } }
@media(min-width: 1100px) { .subjects-grid { grid-template-columns: repeat(4,1fr); } }

/* ── Pricing cards ───────────────────────────────────────────── */
.pricing-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); }
@media(min-width: 640px)  { .pricing-grid { grid-template-columns: repeat(2,1fr); } }
@media(min-width: 960px)  { .pricing-grid { grid-template-columns: repeat(3,1fr); } }

.pricing-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-6);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
}
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pricing-card.popular {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(34,197,94,.18);
}
.popular-badge {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-size: 0.75rem; font-weight: 700;
  padding: 4px 16px; border-radius: var(--r-full);
  text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
.pricing-price {
  font-size: 2.5rem; font-weight: 800; color: var(--text);
  line-height: 1;
}
.pricing-price sup { font-size: 1rem; vertical-align: super; }
.pricing-period { color: var(--text-muted); font-size: 0.9rem; }
.pricing-features { list-style: none; padding: 0; margin: var(--sp-6) 0; }
.pricing-features li {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 0.9rem; color: var(--text-md);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}
.pricing-features li:last-child { border: none; }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }

/* ── Section helpers ─────────────────────────────────────────── */
.section { padding: var(--sp-12) 0; }
.section-header { text-align: center; margin-bottom: var(--sp-10); }
.section-label {
  display: inline-block;
  font-size: 0.78rem; font-weight: 700;
  color: var(--primary-light);
  text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: var(--sp-3);
}
.section-title { margin-bottom: var(--sp-4); }
.section-subtitle { font-size: 1rem; color: var(--text-muted); max-width: 540px; margin: 0 auto; }

/* ── Dashboard layout ────────────────────────────────────────── */
.dash-layout { display: flex; min-height: 100vh; }
.dash-sidebar {
  width: 260px; flex-shrink: 0;
  background: #14532d;
  display: none; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 800;
  transition: transform var(--transition);
}
.dash-sidebar.open { display: flex; }
@media(min-width: 900px) {
  .dash-sidebar { display: flex; position: sticky; top: 0; height: 100vh; }
  .dash-content  { margin-left: 260px; }
}
.dash-content { flex: 1; padding: var(--sp-6); min-width: 0; }

.sidebar-brand {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: var(--sp-3);
}
.sidebar-brand .logo-badge { background: linear-gradient(135deg, var(--secondary), #fbbf24); }
.sidebar-brand-name { font-family: 'Poppins',sans-serif; font-weight: 700; color: #fff; font-size: 1rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-3); }
.nav-section-title {
  font-size: 0.68rem; font-weight: 700; color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: .1em;
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.sidebar-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  color: rgba(255,255,255,.7);
  font-size: 0.9rem; font-weight: 500;
  transition: all var(--transition);
  margin-bottom: var(--sp-1);
  text-decoration: none;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-left: 3px solid var(--secondary);
  padding-left: calc(var(--sp-4) - 3px);
}
.sidebar-link .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-link .badge { margin-left: auto; }
.sidebar-footer {
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user { display: flex; align-items: center; gap: var(--sp-3); }
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0;
}
.sidebar-user-info .name  { color: #fff; font-size: 0.87rem; font-weight: 600; }
.sidebar-user-info .role  { color: rgba(255,255,255,.5); font-size: 0.75rem; }

.dash-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-6);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  border-radius: var(--r-lg);
}
.topbar-title { font-size: 1.2rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-3); }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--sp-6);
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-4);
}
.page-header h1 { font-size: 1.5rem; margin: 0; }
.page-header p  { color: var(--text-muted); font-size: 0.9rem; margin: var(--sp-1) 0 0; }

/* ── Stats grid ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
@media(min-width: 640px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media(min-width: 900px) { .stats-grid { grid-template-columns: repeat(4,1fr); } }

/* ── Quiz-specific styles ────────────────────────────────────── */
.quiz-card {
  background: var(--surface); border-radius: var(--r-lg);
  padding: var(--sp-5); border: 1px solid var(--border);
  transition: all var(--transition); cursor: pointer;
  display: flex; flex-direction: column; gap: var(--sp-3);
  text-decoration: none;
}
.quiz-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.quiz-meta { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.quiz-meta .badge { flex-shrink: 0; }
.quiz-title { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.quiz-stats { display: flex; gap: var(--sp-4); font-size: 0.8rem; color: var(--text-muted); }
.quiz-stats span { display: flex; align-items: center; gap: var(--sp-1); }

/* ── Result display ──────────────────────────────────────────── */
.result-banner {
  border-radius: var(--r-xl); padding: var(--sp-8);
  text-align: center; margin-bottom: var(--sp-8);
}
.result-banner.pass { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border: 2px solid #86efac; }
.result-banner.fail { background: linear-gradient(135deg, #fff7ed, #ffedd5); border: 2px solid #fdba74; }
.result-score { font-size: 4rem; font-weight: 800; line-height: 1; }
.result-score.pass { color: var(--success); }
.result-score.fail { color: var(--secondary); }
.result-label { font-size: 1.1rem; color: var(--text-muted); margin-top: var(--sp-2); }

/* ── Answer review ───────────────────────────────────────────── */
.answer-item {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  border: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.answer-item.correct { border-left: 4px solid var(--success); }
.answer-item.incorrect { border-left: 4px solid var(--danger); }
.answer-item.skipped  { border-left: 4px solid var(--warning); }
.answer-option {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md); margin-top: var(--sp-2);
  font-size: 0.9rem;
}
.answer-option.selected-correct { background: #f0fdf4; border: 1px solid #86efac; }
.answer-option.selected-wrong   { background: #fef2f2; border: 1px solid #fca5a5; }
.answer-option.correct-answer   { background: #f0fdf4; border: 1px solid #86efac; }
.option-key {
  width: 28px; height: 28px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
  background: var(--border); color: var(--text-md);
}
.option-key.correct { background: var(--success); color: #fff; }
.option-key.wrong   { background: var(--danger); color: #fff; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); }
  50%     { box-shadow: 0 0 0 8px rgba(22,163,74,0); }
}

.animate-fade   { animation: fade-in 0.3s ease; }
.animate-up     { animation: slide-up 0.3s ease; }

/* ── Lucide icon baseline ────────────────────────────────────── */
[data-lucide] {
  display: inline-flex !important;
  align-items: center; justify-content: center;
  vertical-align: middle; flex-shrink: 0;
  stroke-width: 2;
}
.sidebar-link [data-lucide] { width: 18px; height: 18px; opacity: .85; }
.action-btn  [data-lucide] { width: 15px; height: 15px; }
.btn         [data-lucide] { width: 16px; height: 16px; }
.ico-lg  { width: 22px !important; height: 22px !important; }
.ico-sm  { width: 14px !important; height: 14px !important; }

/* ── PDF Past Papers Download Section ───────────────────────── */
.pdf-download-section { background: var(--bg); }

.pdf-filter-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 32px; justify-content: center;
}
.pdf-tab {
  padding: 8px 18px; border-radius: 99px;
  border: 1.5px solid var(--border);
  background: #fff; color: var(--text-md);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all .18s ease;
  white-space: nowrap;
}
.pdf-tab:hover { border-color: var(--primary); color: var(--primary); }
.pdf-tab.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}

.pdf-papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.pdf-paper-card {
  background: #fff;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .2s ease, transform .2s ease;
}
.pdf-paper-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,.1);
  transform: translateY(-3px);
}

.pdf-card-top {
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  min-height: 54px;
}
.pdf-subject-pill {
  font-size: 0.75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 99px;
  white-space: nowrap;
}
.pdf-year-badge {
  font-size: 0.78rem; font-weight: 800;
  background: rgba(0,0,0,.07);
  padding: 3px 10px; border-radius: 99px;
  color: var(--text-dark); white-space: nowrap;
}

.pdf-card-body {
  padding: 18px 18px 12px;
  flex: 1; display: flex; flex-direction: column; gap: 8px;
}
.pdf-card-icon { font-size: 2.2rem; line-height: 1; }
.pdf-card-title {
  font-size: 0.92rem; font-weight: 700;
  color: var(--text-dark); line-height: 1.4; margin: 0;
}
.pdf-card-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 0.78rem; color: var(--text-muted);
}

.pdf-download-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 0 14px 14px;
  padding: 11px 0;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; font-weight: 700; font-size: 0.88rem;
  border-radius: var(--r-md); text-decoration: none;
  transition: opacity .18s ease;
}
.pdf-download-btn:hover { opacity: .88; color: #fff; }

@media(max-width: 600px) {
  .pdf-papers-grid { grid-template-columns: 1fr; }
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: #14532d;
  color: rgba(255,255,255,.7);
  padding: var(--sp-10) 0 var(--sp-6);
  margin-top: var(--sp-16);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-8);
  margin-bottom: var(--sp-8);
}
@media(min-width: 640px) { .footer-grid { grid-template-columns: repeat(2,1fr); } }
@media(min-width: 900px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-brand .navbar-brand { color: #fff; margin-bottom: var(--sp-4); }
.footer-brand p { font-size: 0.88rem; line-height: 1.7; color: rgba(255,255,255,.72); }
.footer-col h4 { color: #fff; font-size: 0.9rem; margin-bottom: var(--sp-4); }
.footer-col ul { padding: 0; }
.footer-col ul li { margin-bottom: var(--sp-2); }
.footer-col ul li a { color: rgba(255,255,255,.6); font-size: 0.87rem; transition: color var(--transition); }
.footer-col ul li a:hover { color: #fff; }
.footer-bottom {
  padding-top: var(--sp-6);
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-4);
  font-size: 0.83rem;
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 0.83rem; color: var(--text-muted);
  margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.breadcrumb a { color: var(--primary-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-md); }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: var(--sp-16) var(--sp-6);
}
.empty-state .empty-icon { font-size: 4rem; margin-bottom: var(--sp-4); opacity: .5; }
.empty-state h3 { color: var(--text-md); margin-bottom: var(--sp-3); }
.empty-state p  { color: var(--text-muted); font-size: 0.9rem; }

/* ── Chip / tag ──────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 3px 10px; border-radius: var(--r-full);
  background: #f1f5f9; color: var(--text-md);
  font-size: 0.78rem; font-weight: 500;
}

/* ── Utility ─────────────────────────────────────────────────── */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-muted); }
.font-bold  { font-weight: 700; }
.font-semibold { font-weight: 600; }
.rounded-full { border-radius: var(--r-full); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none; }
.block  { display: block; }

/* ── Responsive dash ─────────────────────────────────────────── */
@media(max-width: 899px) {
  .dash-content { margin-left: 0; }
}

/* ── Page-header action group ───────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Strengths / weaknesses 2-col grid ──────────────────────── */
.sw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* ── Dashboard responsive grid classes ──────────────────────── */
.dash-hero-card {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, #22c55e 100%);
  border-radius: 20px;
  padding: 28px 32px 24px;
  color: #fff;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.dash-hero-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  position: relative;
}
.dash-hero-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.dash-hero-greeting {
  flex: 1;
  min-width: 0;
}
.greeting-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
.greeting-desc {
  font-size: 0.87rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 3px;
}
.dash-hero-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.dash-hero-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.dash-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  position: relative;
}
.dash-hero-stat-pill {
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
}
.stat-pill-icon {
  font-size: 1.1rem;
  margin-bottom: 3px;
}
.stat-pill-value {
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
.stat-pill-label {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.dash-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.dash-bottom-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  align-items: start;
}

/* ── Data card (shared between student + admin portals) ─────── */
.data-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: clip; /* clip without creating scroll context so inner table-wrap can scroll */
}
.data-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.data-card-title { font-weight: 700; font-size: 0.95rem; }

/* ── Table scroll wrapper ────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive table { min-width: 560px; }

/* ── Mobile breakpoints ──────────────────────────────────────── */
@media(max-width: 767px) {
  /* Dashboard content padding */
  .dash-content { padding: var(--sp-4); }

  /* Hero card responsive */
  .dash-hero-card { padding: 20px 16px 16px; border-radius: 16px; }
  .dash-hero-header { flex-wrap: wrap; gap: 12px; }
  .dash-hero-btn { width: 100%; text-align: center; margin-left: 0; margin-top: 4px; }
  .greeting-title { font-size: 1.3rem; }

  /* Strengths/weaknesses stack */
  .sw-grid { grid-template-columns: 1fr; }

  /* Hero stat pills: 4-col → 2×2 */
  .dash-hero-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Quick action cards: 2-col on small screens */
  .dash-action-grid { grid-template-columns: repeat(2, 1fr); }

  /* Bottom grid: stack vertically */
  .dash-bottom-grid { grid-template-columns: 1fr; }

  /* Modals full-width */
  .modal { max-width: calc(100vw - 32px); margin: 16px; }

  /* Data card header wrap */
  .data-card-header { flex-wrap: wrap; gap: 8px; }

  /* Stats grid: 2-col on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Page-level padding */
  .page-header { padding: var(--sp-4) 0 var(--sp-3); }
}

@media(max-width: 480px) {
  /* Single column action cards on very small screens */
  .dash-action-grid { grid-template-columns: 1fr; }

  /* Hero stat pills stay 2×2 even on very small */
  .dash-hero-stats { grid-template-columns: repeat(2, 1fr); }

  /* Reduce dash hero padding */
  .dash-content { padding: var(--sp-3); }
}

/* ── Score colours ───────────────────────────────────────────── */
.score-excellent { color: var(--success); }
.score-good      { color: #15803d; }
.score-average   { color: var(--warning); }
.score-poor      { color: var(--danger); }

/* ── Notification dot ────────────────────────────────────────── */
.notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}
