/* =========================================================
   SHL Educational Services — main stylesheet
   Colours: navy #1e1450, emerald #1b8040, gold #c9a227
   ========================================================= */

/* ---------- Colour themes ---------- */
:root {
  --navy: #1e1450;
  --green: #1b8040;
  --gold: #c9a227;
  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #eeedf6;
  --text: #1a1730;
  --muted: #5d5a73;
  --border: #dddbe8;
  --primary: #1e1450;      /* headings, links, buttons */
  --primary-text: #ffffff;
  --accent: #1b8040;
  --good-bg: #e3f4ea;
  --bad: #b3261e;
  --bad-bg: #fbe7e6;
  --shadow: 0 2px 10px rgba(30, 20, 80, .08);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f0c22;
  --surface: #1a1636;
  --surface-2: #252046;
  --text: #ecebf7;
  --muted: #a9a6c2;
  --border: #322c5a;
  --primary: #b7acff;
  --primary-text: #120d2e;
  --accent: #3fc178;
  --good-bg: #133a24;
  --bad: #ff8a80;
  --bad-bg: #3d1a1a;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0c22;
    --surface: #1a1636;
    --surface-2: #252046;
    --text: #ecebf7;
    --muted: #a9a6c2;
    --border: #322c5a;
    --primary: #b7acff;
    --primary-text: #120d2e;
    --accent: #3fc178;
    --good-bg: #133a24;
    --bad: #ff8a80;
    --bad-bg: #3d1a1a;
    --shadow: 0 2px 10px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 76px; /* room for bottom nav on phones */
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--primary); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
main { padding: 20px 0 32px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header { background: #1e1450; color: #fff; border-bottom: 4px solid var(--gold); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; max-width: 860px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand img { width: 42px; height: 42px; border-radius: 10px; background: #fff; object-fit: contain; flex-shrink: 0; }
.brand strong { display: block; font-size: 1rem; line-height: 1.2; }
.brand small { display: block; font-size: .8rem; color: #e9d38a; }
.icon-btn {
  background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 12px;
  width: 46px; height: 46px; font-size: 1.3rem; cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Navigation ----------
   Phones: fixed bar at the bottom. Big screens: row under header. */
.mainnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.mainnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 62px; padding: 6px 2px; font-size: .72rem; color: var(--muted); text-decoration: none; gap: 2px;
}
.mainnav a svg { width: 24px; height: 24px; }
.mainnav a.active { color: var(--accent); font-weight: 700; }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .mainnav { position: static; box-shadow: none; border-top: 0; background: #2a1f66; max-width: none; justify-content: center; }
  .mainnav a { flex: 0 0 auto; flex-direction: row; gap: 8px; min-height: 48px; padding: 0 18px; font-size: .95rem; color: #d9d5f5; }
  .mainnav a svg { width: 20px; height: 20px; }
  .mainnav a.active { color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 22px; border-radius: 12px; border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  background: var(--primary); color: var(--primary-text);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-green { background: var(--green); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-gold { background: var(--gold); color: #1e1450; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.big-cards { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 20px 0; }
@media (min-width: 640px) { .big-cards { grid-template-columns: repeat(3, 1fr); } }
.big-card {
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--green);
  border-radius: 16px; padding: 18px; box-shadow: var(--shadow); min-height: 96px;
}
@media (min-width: 640px) { .big-card { flex-direction: column; text-align: center; border-left-width: 1px; border-top: 6px solid var(--green); } }
.big-card .ic { width: 54px; height: 54px; border-radius: 14px; background: var(--surface-2); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.big-card .ic svg { width: 30px; height: 30px; }
.big-card strong { display: block; font-size: 1.15rem; color: var(--primary); }
.big-card span { color: var(--muted); font-size: .92rem; }

/* ---------- Home hero ---------- */
.hero { text-align: center; padding: 10px 0 0; }
.hero img { width: 110px; height: 110px; border-radius: 22px; background: #fff; object-fit: contain; box-shadow: var(--shadow); }
.hero h1 { margin-top: 12px; font-size: 1.7rem; }
.tagline { color: var(--accent); font-weight: 700; font-size: 1.1rem; margin-bottom: 6px; }
.gold-line { width: 60px; height: 4px; background: var(--gold); border-radius: 4px; margin: 10px auto 14px; }

/* ---------- Lists ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list a { font-weight: 600; text-decoration: none; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--primary); }
.badge-green { background: var(--good-bg); color: var(--accent); }
.badge-gold { background: #f6ecc8; color: #6b5310; }
.badge-sample { background: #fff1c2; color: #7a5600; border: 1px dashed #c9a227; }
.notice { border-radius: 12px; padding: 12px 14px; background: var(--surface-2); border-left: 4px solid var(--gold); margin-bottom: 16px; font-size: .95rem; }

/* ---------- Forms ---------- */
.input {
  width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; color: var(--text);
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
}
.input:focus { border-color: var(--accent); outline: none; }

/* ---------- Quiz: course list ---------- */
.course-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .course-grid { grid-template-columns: 1fr 1fr; } }
.course-btn {
  text-align: left; width: 100%; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow);
}
.course-btn .code { font-size: 1.35rem; font-weight: 800; color: var(--primary); }
.course-btn .title { display: block; margin: 2px 0 8px; }

/* ---------- Quiz: unit picker ---------- */
.unit {
  display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 60px;
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--surface);
}
.unit input { width: 26px; height: 26px; accent-color: var(--green); flex-shrink: 0; }
.unit label { flex: 1; cursor: pointer; }
.unit.locked { background: var(--surface-2); flex-wrap: wrap; }
.unit .lock { font-size: 1.2rem; width: 26px; text-align: center; }
.unit.soon { background: transparent; border-style: dashed; opacity: .75; }
.unlock-card { border-top: 5px solid var(--gold); }
.unlock-card h2 { font-size: 1.15rem; }
.unlock-card .btn svg { width: 22px; height: 22px; }
.unlock-card .input { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.unit .buy { flex: 1 1 100%; min-height: 44px; padding: 8px 14px; font-size: .92rem; }
@media (min-width: 560px) { .unit .buy { flex: 0 0 auto; } }

/* ---------- Quiz: question ---------- */
.progress { height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; margin: 8px 0 18px; }
.progress > div { height: 100%; background: var(--green); transition: width .2s; }
.q-text { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.options { display: grid; gap: 10px; margin-bottom: 20px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%;
  font: inherit; color: var(--text); background: var(--surface); cursor: pointer;
  border: 2px solid var(--border); border-radius: 12px; padding: 14px; min-height: 56px;
}
.opt .letter {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 800; color: var(--primary);
}
.opt[aria-checked="true"] { border-color: var(--green); background: var(--good-bg); }
.opt[aria-checked="true"] .letter { background: var(--green); color: #fff; }

/* ---------- Quiz: result ---------- */
.score-ring {
  width: 150px; height: 150px; border-radius: 50%; margin: 6px auto 12px; display: grid; place-items: center;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--surface-2) 0);
}
.score-ring > div { width: 118px; height: 118px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.score-ring strong { font-size: 2rem; color: var(--primary); display: block; line-height: 1; }
.band { font-size: 1.25rem; font-weight: 800; color: var(--accent); }
.review-item { border-top: 1px solid var(--border); padding: 14px 0; }
.review-item .opt-line { padding: 8px 12px; border-radius: 10px; margin: 6px 0; border: 1px solid var(--border); }
.opt-line.correct { background: var(--good-bg); border-color: var(--accent); font-weight: 700; }
.opt-line.wrong { background: var(--bad-bg); border-color: var(--bad); text-decoration: line-through; }
.mark-ok { color: var(--accent); font-weight: 800; }
.mark-bad { color: var(--bad); font-weight: 800; }
.explain { font-size: .93rem; color: var(--muted); margin-top: 6px; }

/* ---------- History table ---------- */
.history { width: 100%; border-collapse: collapse; font-size: .92rem; }
.history th, .history td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.history th { color: var(--muted); font-weight: 600; }

/* ---------- AIOU Help ---------- */
.back-btn { min-height: 44px; padding: 8px 16px; margin-bottom: 14px; }
.search-form { margin: 6px 0 18px; }
.search-row { display: flex; gap: 8px; }
.search-row .btn { flex: 0 0 56px; padding: 0; }
.search-row .btn svg { width: 22px; height: 22px; }
.cat-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
.cat-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 14px; min-height: 130px;
  text-decoration: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-top: 4px solid var(--green); border-radius: 14px; box-shadow: var(--shadow);
}
.cat-card .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); color: var(--primary); display: grid; place-items: center; }
.cat-card .ic svg { width: 26px; height: 26px; }
.cat-card strong { color: var(--primary); line-height: 1.25; }
.cat-card .small { line-height: 1.35; }
.guide-list { display: grid; gap: 10px; }
.guide-item {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--green); border-radius: 12px; box-shadow: var(--shadow);
}
.guide-item strong { color: var(--primary); font-size: 1.05rem; }
.guide-item .badge { align-self: flex-start; }
.steps { padding-left: 0; margin: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 10px 0 10px 46px; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 9px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 800; display: grid; place-items: center;
}
.tips { margin: 0; padding-left: 20px; }
.tips li { margin-bottom: 8px; }
.source-list a, .list a svg { vertical-align: middle; }
.list a svg, .faq a svg { width: 16px; height: 16px; }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--primary); list-style-position: outside; }
.faq-a { padding: 0 0 10px; }
.result-group { margin-bottom: 20px; }
.result-group h2 { font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
mark { background: #f6ecc8; color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- Notes catalog ---------- */
.notes-grid { display: grid; gap: 14px; margin: 14px 0 18px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .notes-grid { grid-template-columns: 1fr 1fr; } }
.note-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-top: 5px solid var(--green); border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.note-card.highlight { outline: 3px solid var(--gold); outline-offset: 2px; }
.note-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.note-head .code { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.note-head .price { background: var(--gold); color: #1e1450; font-weight: 800; border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.note-card h2 { font-size: 1.15rem; color: var(--text); margin: 4px 0 6px; }
.note-card h3 { margin: 4px 0 4px; text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; }
.includes { margin: 0 0 14px; padding-left: 0; list-style: none; flex: 1; }
.includes li { position: relative; padding: 4px 0 4px 26px; }
.includes li::before { content: "\2713"; position: absolute; left: 2px; top: 4px; color: var(--accent); font-weight: 800; }
.note-actions { display: grid; gap: 8px; }
.note-head .price.free { background: var(--green); color: #fff; }
.paid-box { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.paid-box p { margin: 0 0 8px; }
.paid-box .btn svg { width: 22px; height: 22px; }
.note-actions .btn svg { width: 22px; height: 22px; }

/* ---------- App install bar + offline notice ---------- */
.install-bar {
  position: fixed; left: 10px; right: 10px; bottom: 76px; z-index: 70;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px;
  background: #1e1450; color: #fff; border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.3);
  border-bottom: 3px solid var(--gold); max-width: 560px; margin: 0 auto;
}
.install-bar img { border-radius: 10px; flex-shrink: 0; }
.install-bar .txt { flex: 1; line-height: 1.3; font-size: .95rem; }
.install-bar .btn { min-height: 44px; padding: 8px 16px; }
.install-x { background: none; border: 0; color: #fff; font-size: 1.6rem; width: 40px; height: 44px; cursor: pointer; }
@media (min-width: 760px) { .install-bar { bottom: 20px; } }
body:has(.install-bar) .wa-float { display: none; }
.offline-note { background: #fff1c2; color: #5a4300; text-align: center; padding: 8px 12px; font-size: .92rem; font-weight: 600; }

/* ---------- WhatsApp floating button ---------- */
.wa-float {
  position: fixed; right: 16px; bottom: 88px; z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 999px;
  background: #1fa855; color: #fff; text-decoration: none; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.wa-float svg { width: 24px; height: 24px; }
@media (min-width: 760px) { .wa-float { bottom: 22px; } }
/* Phones: small round icon so it covers less of the page */
@media (max-width: 759px) {
  .wa-float { width: 56px; height: 56px; padding: 0; justify-content: center; bottom: 84px; right: 12px; }
  .wa-float span { display: none; }
  .wa-float svg { width: 28px; height: 28px; }
  main { padding-bottom: 80px; }
}
body.in-quiz .wa-float { display: none; }

/* ---------- Footer ---------- */
.site-footer { background: #1e1450; color: #d9d5f5; padding: 24px 0 28px; font-size: .9rem; border-top: 4px solid var(--gold); }
.site-footer a { color: #fff; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.site-footer .links a { padding: 6px 0; }
.site-footer .disclaimer { color: #bfb9e6; font-size: .85rem; }
