/* NextSens ACADEMY — Sober Executive NST Theme (Light Default + Dark/System Toggle) */
:root {
  --bg: #F6F8FC;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --muted: #475569;
  --line: #E2E8F0;
  --brand: #233F9B;
  --brand-2: #2946BC;
  --brand-soft: #EEF2FF;
  --emerald: #047857;
  --emerald-bg: #ECFDF5;
  --amber: #B45309;
  --amber-bg: #FFFBEB;
  --danger: #B91C1C;
  --danger-bg: #FEF2F2;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none !important;
}
.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(35,63,155,0.25);
}
.brand span b { color: var(--brand); }
.main-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.main-nav a { color: #334155; font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.main-nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.15s;
}
.btn:hover { background: #F8FAFC; border-color: #CBD5E1; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff !important; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-emerald { background: var(--emerald-bg); color: var(--emerald) !important; border-color: #A7F3D0; }
.btn-emerald:hover { background: var(--emerald); color: #fff !important; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  font: 600 12.5px/1 inherit;
  cursor: pointer;
}
.theme-btn svg { width: 14px; height: 14px; color: var(--brand); }

/* Hero */
.hero {
  padding: 56px 0 44px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F0F4FF 100%);
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero h1 { font-size: clamp(30px, 4.5vw, 48px); line-height: 1.12; margin: 16px 0 14px; letter-spacing: -0.025em; }
.hero p.lead { max-width: 720px; font-size: 17px; color: var(--muted); margin: 0 0 24px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.stats-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat-card strong { display: block; font-size: 22px; color: var(--brand); }
.stat-card span { font-size: 12.5px; color: var(--muted); }

/* Sections & Cards */
.section { padding: 48px 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.card p { margin: 0; color: var(--muted); font-size: 13.8px; }
.pill { display: inline-block; width: fit-content; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pill-emerald { background: var(--emerald-bg); color: var(--emerald); }
.pill-blue { background: var(--brand-soft); color: var(--brand); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }

/* Lesson & Video */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 32px 0 56px; align-items: start; }
@media (max-width: 920px) { .lesson-layout { grid-template-columns: 1fr; } }
.equation-box {
  background: var(--brand-soft);
  border-left: 4px solid var(--brand);
  padding: 14px 18px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--brand);
  overflow-x: auto;
}
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.quiz-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.quiz-item label { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; cursor: pointer; font-size: 14px; }

/* Forms & Flashes */
.auth-card { max-width: 520px; margin: 44px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.form-row input, .form-row select {
  width: 100%; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: 9px; font: inherit; background: var(--surface); color: var(--ink);
}
.flash { padding: 11px 16px; border-radius: 10px; margin: 14px 0 0; font-size: 13.5px; font-weight: 600; }
.flash-success { background: var(--emerald-bg); color: var(--emerald); border: 1px solid #A7F3D0; }
.flash-info { background: var(--brand-soft); color: var(--brand); border: 1px solid #C7D2FE; }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #FECACA; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #F8FAFC; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 38px 0; margin-top: 40px; font-size: 13.5px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 24px; }
.footer-grid strong { display: block; margin-bottom: 10px; }
.footer-grid a { display: block; color: var(--muted); margin-bottom: 7px; }
.footer-grid a:hover { color: var(--brand); }

/* Dark Mode (Screen Only — Certificates Print Cleanly) */
@media screen {
  html.dark {
    color-scheme: dark;
    --bg: #0B1120;
    --surface: #111827;
    --ink: #F1F5F9;
    --muted: #94A3B8;
    --line: #1E293B;
    --brand: #3B82F6;
    --brand-2: #60A5FA;
    --brand-soft: rgba(59, 130, 246, 0.16);
    --emerald: #34D399;
    --emerald-bg: rgba(16, 185, 129, 0.16);
    --amber: #FBBF24;
    --amber-bg: rgba(245, 158, 11, 0.16);
  }
  html.dark .site-header { background: rgba(15, 23, 42, 0.94); }
  html.dark .hero { background: linear-gradient(180deg, #0F172A 0%, #0B1120 100%); }
  html.dark .main-nav a { color: #CBD5E1; }
  html.dark .theme-btn { background: #1E293B; border-color: #334155; color: #E2E8F0; }
  html.dark .theme-btn svg { color: #60A5FA; }
  html.dark th { background: #1E293B; color: #CBD5E1; }
  html.dark .form-row input, html.dark .form-row select { background: #0F172A; border-color: #334155; color: #F1F5F9; }
}
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
}
