/* ============================================================
   AHMAD ACADEMY — Design system
   Consistent with the School Management System (SMS) HCI:
   - Deep indigo for navigation and primary actions (calm, trustworthy, WCAG AA contrast)
   - Warm amber for highlights
   - Soft lavender-grey canvas, rounded friendly cards
   - Inter (body) + Nunito (display) — same font stack as the SMS
   - Same component vocabulary: .btn-primary, .btn-ghost, .card, .chip, .badge
   - Same focus ring, skip-link, and visibility-of-system-status patterns
   ============================================================ */
:root {
  --color-bg: #f5f6fb;
  --color-surface: #ffffff;
  --color-surface-alt: #fafbff;
  --color-border: #e3e6f2;
  --color-text: #1b1f3b;
  --color-text-muted: #5b6285;

  --color-accent: #4338ca;
  --color-accent-dark: #2f2a8c;
  --color-accent-soft: #eceafd;
  --color-amber: #f5a524;
  --color-amber-soft: #fff3d6;
  --color-success: #15803d;
  --color-success-soft: #e2f5e9;
  --color-warning: #a8590a;
  --color-warning-soft: #fdf0d8;
  --color-error: #c2272d;
  --color-error-soft: #fde8e8;

  --hero-bg: linear-gradient(135deg, #25216b 0%, #4338ca 60%, #6d5dd6 100%);
  --sidebar-bg: linear-gradient(180deg, #25216b 0%, #191646 100%);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Nunito', 'Inter', system-ui, sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(25, 22, 70, 0.05), 0 6px 18px rgba(25, 22, 70, 0.06);
  --shadow-lift: 0 8px 28px rgba(25, 22, 70, 0.12);
  --focus-ring: 0 0 0 3px rgba(67, 56, 202, 0.28);

  --container: 1140px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  line-height: 1.2;
}
h1 { font-size: clamp(1.85rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 14px; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.muted { color: var(--color-text-muted); font-size: 0.92rem; }
.hint  { color: var(--color-text-muted); font-size: 0.8rem; margin-top: 2px; }

:focus-visible {
  outline: 3px solid rgba(67, 56, 202, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Skip link — accessibility, matches SMS pattern */
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  z-index: 200;
  font-weight: 600;
}
.skip-link:focus { left: 12px; }

/* ============================================================
   Layout primitives
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 64px 0; }
.section--alt { background: var(--color-surface-alt); }
.section--tight { padding: 40px 0; }

.section-head { max-width: 720px; margin: 0 auto 36px; text-align: center; }
.section-head .eyebrow {
  display: inline-block;
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   Top navigation
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--color-text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--hero-bg);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-name { line-height: 1.1; }
.brand-name small { display: block; font-size: 0.7rem; font-weight: 600; color: var(--color-text-muted); letter-spacing: 0.05em; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.94rem;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.nav-links a:hover { background: var(--color-accent-soft); color: var(--color-accent-dark); }
.nav-links a[aria-current="page"] { color: var(--color-accent); background: var(--color-accent-soft); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--color-text);
}
.menu-toggle:hover { background: var(--color-accent-soft); }

@media (max-width: 880px) {
  .menu-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .nav-links {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 10px 16px 18px;
    gap: 4px;
    box-shadow: var(--shadow-card);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 12px; border-radius: 10px; }
}

/* ============================================================
   Buttons — matches SMS component vocabulary
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, transform .05s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover { background: var(--color-accent-dark); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-accent-soft); text-decoration: none; }
.btn-amber {
  background: var(--color-amber);
  color: #3a2600;
}
.btn-amber:hover { background: #d98a0f; text-decoration: none; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}
.card-icon.amber { background: var(--color-amber-soft); color: var(--color-warning); }
.card-icon.success { background: var(--color-success-soft); color: var(--color-success); }
.card-icon.error { background: var(--color-error-soft); color: var(--color-error); }

/* ============================================================
   Chips & badges — matches SMS pattern
   ============================================================ */
.chip, .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.chip { background: var(--color-accent-soft); color: var(--color-accent-dark); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-error   { background: var(--color-error-soft); color: var(--color-error); }

/* ============================================================
   Breadcrumbs
   ============================================================ */
.breadcrumbs {
  font-size: 0.86rem;
  color: var(--color-text-muted);
  padding: 14px 0 0;
}
.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.breadcrumbs li { display: flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before {
  content: "/";
  color: var(--color-border);
  margin: 0 2px;
}
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-accent); }
.breadcrumbs [aria-current="page"] { color: var(--color-text); font-weight: 600; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  background: var(--hero-bg);
  color: #fff;
  padding: 76px 0 88px;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(245, 165, 36, 0.18), transparent 60%),
    radial-gradient(700px 380px at 10% 110%, rgba(109, 93, 214, 0.45), transparent 60%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
.hero h1 { color: #fff; margin-bottom: 16px; }
.hero p { color: rgba(255, 255, 255, 0.88); font-size: 1.08rem; max-width: 560px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.hero-stat .num { font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; color: #fff; }
.hero-stat .label { color: rgba(255, 255, 255, 0.78); font-size: 0.85rem; }

.hero-card {
  background: rgba(255, 255, 255, 0.96);
  color: var(--color-text);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-lift);
}
.hero-card h2 { font-size: 1.25rem; margin-bottom: 6px; }
.hero-card .muted { margin-bottom: 18px; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .hero-stat .num { font-size: 1.4rem; }
}

/* ============================================================
   Feature / step lists
   ============================================================ */
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--color-border);
}
.feature-list li:last-child { border-bottom: 0; }
.feature-list .check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-success-soft);
  color: var(--color-success);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ============================================================
   Steps (numbered)
   ============================================================ */
.steps { counter-reset: step; display: grid; gap: 18px; }
.step-card { position: relative; padding-left: 56px; }
.step-card::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* ============================================================
   Tables
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}
.data-table thead th {
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--color-surface-alt); }
.table-wrap { overflow-x: auto; }

/* ============================================================
   Forms
   ============================================================ */
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}
.field textarea { min-height: 130px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.form-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}
.form-message.error { background: var(--color-error-soft); color: var(--color-error); }
.form-message.success { background: var(--color-success-soft); color: var(--color-success); }
.form-message-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: currentColor;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.78rem;
}
.form-message.success .form-message-icon::before { content: "\2713"; color: var(--color-success); }
.form-message.error .form-message-icon::before { content: "!"; color: var(--color-error); }

/* ============================================================
   Redirect / portal page — HCI-compliant countdown
   ============================================================ */
.redirect-hero {
  min-height: calc(100vh - var(--topbar-h));
  display: grid;
  place-items: center;
  padding: 50px 0;
  background:
    radial-gradient(700px 320px at 80% -10%, rgba(245, 165, 36, 0.14), transparent 60%),
    radial-gradient(600px 280px at 10% 110%, rgba(67, 56, 202, 0.10), transparent 60%),
    var(--color-bg);
}
.redirect-card {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 40px 32px;
}
.redirect-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--hero-bg);
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
}
.redirect-card h1 { font-size: 1.7rem; margin-bottom: 8px; }
.redirect-card .muted { margin-bottom: 22px; }

.redirect-progress {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--color-accent-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 14px;
}
.redirect-progress-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--color-accent), var(--color-amber));
  width: 0%;
  transition: width 1s linear;
}
.redirect-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-accent-soft);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.redirect-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.redirect-target {
  margin-top: 22px;
  padding: 12px 14px;
  background: var(--color-surface-alt);
  border: 1px dashed var(--color-border);
  border-radius: 10px;
  font-size: 0.86rem;
  color: var(--color-text-muted);
  word-break: break-all;
}
.redirect-target code { color: var(--color-accent-dark); font-weight: 600; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: linear-gradient(180deg, #1f1c5a 0%, #161445 100%);
  color: #d9d8f3;
  padding: 56px 0 24px;
  margin-top: 60px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 32px;
  margin-bottom: 36px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }
.footer-tag { color: rgba(217, 216, 243, 0.78); font-size: 0.92rem; max-width: 280px; }
.footer-col h3 { color: #fff; font-size: 0.95rem; margin-bottom: 12px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-col a { color: rgba(217, 216, 243, 0.85); font-size: 0.92rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85rem;
  color: rgba(217, 216, 243, 0.7);
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   CTA banner
   ============================================================ */
.cta-banner {
  background: var(--hero-bg);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lift);
}
.cta-banner h2 { color: #fff; margin: 0; }
.cta-banner p { color: rgba(255, 255, 255, 0.86); margin: 6px 0 0; }

/* ============================================================
   Page header (inner pages)
   ============================================================ */
.page-header {
  background: var(--hero-bg);
  color: #fff;
  padding: 48px 0 40px;
  position: relative;
  overflow: hidden;
}
.page-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 240px at 85% -10%, rgba(245, 165, 36, 0.18), transparent 60%);
  pointer-events: none;
}
.page-header .container { position: relative; z-index: 1; }
.page-header h1 { color: #fff; margin-bottom: 6px; }
.page-header p { color: rgba(255, 255, 255, 0.88); max-width: 640px; margin: 0; }
.page-header .breadcrumbs { color: rgba(255, 255, 255, 0.7); padding: 0 0 14px; }
.page-header .breadcrumbs a { color: rgba(255, 255, 255, 0.85); }
.page-header .breadcrumbs [aria-current="page"] { color: #fff; }
.page-header .breadcrumbs li + li::before { color: rgba(255, 255, 255, 0.4); }

/* ============================================================
   404 page
   ============================================================ */
.not-found {
  min-height: calc(100vh - var(--topbar-h));
  display: grid;
  place-items: center;
  padding: 60px 0;
  text-align: center;
  background: var(--color-bg);
}
.not-found .code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(5rem, 18vw, 9rem);
  line-height: 1;
  background: var(--hero-bg);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}
.not-found h1 { font-size: 1.6rem; }
.not-found .actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   Alerts / callouts
   ============================================================ */
.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-size: 0.92rem;
  margin-bottom: 16px;
}
.alert.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.alert.success { background: var(--color-success-soft); color: var(--color-success); }

/* ============================================================
   Misc
   ============================================================ */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* Print: hide nav, footer chrome */
@media print {
  .site-header, .site-footer, .cta-banner, .menu-toggle { display: none !important; }
  body { background: #fff; }
}
