/* Specialized Charities Training Academy — main stylesheet.
   Brand colors come from Admin > Settings (served as CSS variables by index.php?p=theme). */
:root {
  --primary: #1F3A68; --accent: #C8102E; --gold: #C9A227;
  --ink: #1d2433; --muted: #5d6677; --line: #dde2ea; --bg: #f5f7fa; --card: #fff;
  --ok: #1e7a46; --ok-bg: #e5f5ec; --bad: #b42318; --bad-bg: #fdecea; --warn: #8a5a00; --warn-bg: #fff4dc; --info: #1f5fa8; --info-bg: #e7f0fb;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 2px 8px rgba(16,24,40,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; font-size: 17px; line-height: 1.6; color: var(--ink); background: var(--bg); }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--primary); margin: 1.2em 0 .5em; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin-top: .6em; }
h2 { font-size: 1.4rem; } .h3, h3 { font-size: 1.15rem; } .h4, h4 { font-size: 1rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 10px; }
.muted { color: var(--muted); } .small { font-size: .88rem; }
.inline { display: inline; } .hp { position: absolute; left: -5000px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* header */
.site-header { background: var(--primary); color: #fff; border-bottom: 4px solid var(--accent); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 8px 0; }
.brand:hover { color: #fff; }
.brand .logo { height: 52px; width: auto; background: #fff; border-radius: 6px; padding: 3px; }
.logo-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #fff; color: var(--primary); font-weight: 800; border: 3px solid var(--gold); }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { font-size: .78rem; opacity: .85; }
.main-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.main-nav a, .main-nav .linklike { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-size: .95rem; }
.main-nav a:hover, .main-nav .linklike:hover { background: rgba(255,255,255,.14); color: #fff; }
.main-nav .btn { background: var(--accent); }
.lang-switch { border: 1px solid rgba(255,255,255,.5); }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-toggle { display: none; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); border-radius: 6px; padding: 6px 12px; font: inherit; }
.admin-nav { background: #fff; border-bottom: 1px solid var(--line); }
.admin-nav .wrap { display: flex; gap: 2px; overflow-x: auto; }
.admin-nav a { padding: 12px 14px; text-decoration: none; white-space: nowrap; color: var(--ink); border-bottom: 3px solid transparent; font-size: .95rem; }
.admin-nav a.active, .admin-nav a:hover { border-bottom-color: var(--accent); color: var(--primary); }

main.wrap { padding-top: 12px; padding-bottom: 48px; min-height: 60vh; }

/* footer */
.site-footer { background: #121c30; color: #c8d0de; font-size: .9rem; padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: #fff; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }

/* buttons */
.btn { display: inline-block; background: var(--primary); color: #fff; border: 2px solid var(--primary); border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { filter: brightness(1.1); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); }
.btn-outline:hover { background: #eef2f8; color: var(--primary); }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-small { padding: 6px 12px; font-size: .9rem; } .btn-tiny { padding: 2px 8px; font-size: .85rem; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; } .btn-block { display: block; width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }

/* cards / layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > h2:first-child, .card > h3:first-child, .card > h1:first-child { margin-top: 0; }
.narrow { max-width: 520px; margin: 24px auto; } .narrow-wide { max-width: 820px; margin: 0 auto 20px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.course-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.crumbs { font-size: .9rem; color: var(--muted); margin: 8px 0 0; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 760px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent); margin: 0; }

/* hero */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; padding: 28px 0 10px; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: .2em 0 .3em; }
.hero-card { background: linear-gradient(135deg, var(--primary), #12264a); color: #fff; border-radius: 16px; padding: 40px 28px; border-bottom: 6px solid var(--gold); }
.slogan { font-size: 1.5rem; font-weight: 700; line-height: 1.35; margin: 0; }
.step-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: s; }
.step-list li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 18px 64px; position: relative; counter-increment: s; display: flex; flex-direction: column; }
.step-list li::before { content: counter(s); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.step-list span { color: var(--muted); font-size: .95rem; }

/* forms */
.form label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .95rem; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .filters input, .filters select, .inline-input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; font-weight: 400; border: 1px solid #b9c2d0; border-radius: 8px; background: #fff; color: var(--ink); }
.form input[type=color] { padding: 2px; height: 42px; max-width: 120px; }
.form textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form .check input { margin-top: 5px; width: 18px; height: 18px; flex: none; }
.form button { margin-top: 16px; }
.row2 { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }
.row4 { display: grid; gap: 0 16px; grid-template-columns: repeat(4, 1fr); align-items: end; }
.row-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-inline input { flex: 1 1 200px; width: auto !important; margin: 0 !important; }
.row-inline button { margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.filters input, .filters select { width: auto; margin: 0; }
.inline-input { display: inline-block; width: auto; margin: 0; }
.form-links { text-align: center; font-size: .95rem; }
.signature { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 1.5rem !important; }
.signature-display { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 1.4rem; }
.opt-row { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.opt-row input { margin: 0 !important; }
.opt-row label { margin: 0; }
.settings fieldset legend { font-weight: 700; color: var(--primary); font-size: 1.1rem; padding: 0 6px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.danger-zone { border-color: #f1b5b0; }

/* alerts & badges */
.alert { padding: 12px 16px; border-radius: 8px; margin: 12px 0; border: 1px solid; }
.alert ul { margin: 0; padding-left: 20px; }
.alert-ok { background: var(--ok-bg); border-color: #9fd6b5; color: #124d2c; }
.alert-error { background: var(--bad-bg); border-color: #f2b8b5; color: #7a1a12; }
.alert-warn { background: var(--warn-bg); border-color: #f0d28c; color: #5c3d00; }
.alert-info { background: var(--info-bg); border-color: #a9c6ec; color: #123f72; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; vertical-align: middle; }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-warn { background: var(--warn-bg); color: var(--warn); } .badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #eceff3; color: var(--muted); }

/* progress */
.progress { height: 10px; background: #e6e9ef; border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.progress.big { height: 14px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
.module-list { list-style: none; padding: 0; margin: 16px 0; }
.module-list li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.module-list .num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #e9edf4; font-weight: 700; color: var(--primary); }
.module-list li.done .num { background: var(--ok); color: #fff; }
.module-list li.open .num { background: var(--primary); color: #fff; }
.module-list li.locked { opacity: .65; }
.module-list a { font-weight: 600; }
.recert-box { margin-top: 12px; padding: 12px; background: var(--warn-bg); border-radius: 8px; }

/* lesson */
.prose { max-width: 820px; }
.lesson { margin: 14px auto; }
.lesson h2 { margin-top: 1.4em; padding-top: .4em; border-top: 1px solid var(--line); }
.lesson blockquote, .callout { margin: 16px 0; padding: 12px 16px; background: var(--info-bg); border-left: 5px solid var(--primary); border-radius: 6px; }
.lesson .key { background: var(--warn-bg); border-left-color: var(--gold); }
.lesson table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: .95rem; }
.lesson th, .lesson td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.lesson th { background: #f0f3f8; }
.quiz-callout { max-width: 820px; margin: 0 auto 16px; border-left: 6px solid var(--accent); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 820px; margin: 18px auto; }
.agreement-text { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; font-size: .95rem; }
.agreement-text.scroll { max-height: 420px; overflow-y: auto; }

/* quiz */
.quiz-form { max-width: 820px; }
.question { border: 1px solid var(--line); }
.question legend { font-weight: 700; padding: 0; font-size: 1.05rem; float: left; width: 100%; margin-bottom: 10px; }
.question legend + * { clear: both; }
.qnum { color: var(--accent); }
.option { display: flex !important; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 !important; cursor: pointer; font-weight: 400 !important; }
.option:hover { background: #f4f7fb; }
.option input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--primary); }
.option:has(input:checked) { border-color: var(--primary); background: #eef3fb; }
.quiz-actions { display: flex; gap: 12px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.quiz-actions.sticky { position: sticky; bottom: 0; background: rgba(245,247,250,.96); padding: 12px 0; border-top: 1px solid var(--line); }
.quiz-actions .btn { margin: 0; }
.quiz-actions span { margin-right: auto; }
.result { text-align: center; border-top: 6px solid var(--muted); }
.result.pass { border-top-color: var(--ok); } .result.fail { border-top-color: var(--bad); }
.result .score { font-size: 3.2rem; font-weight: 800; color: var(--primary); margin: 0; }
.result .actions { justify-content: center; }
.review { border-left: 5px solid var(--bad); } .review.ok { border-left-color: var(--ok); }
.review li { padding: 3px 0; } .review li.mine { font-weight: 700; } .review li.correct { color: var(--ok); font-weight: 700; }
ul.plain { list-style: none; padding: 0; margin: 6px 0; }
ul.plain li { padding: 4px 0; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; font-size: .95rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f0f3f8; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table.compact th, .table.compact td { padding: 6px 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 16px 0 22px; }
.stat { text-decoration: none; display: flex; flex-direction: column; margin: 0; }
.stat strong { font-size: 2rem; color: var(--primary); }
.stat span { color: var(--muted); font-size: .9rem; }

/* responsive */
@media (max-width: 900px) {
  .course-layout, .hero { grid-template-columns: 1fr; }
  .row4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  .main-nav.open { display: flex; }
  .main-nav form button { width: 100%; text-align: left; }
  .row2, .row4, .opt-row { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .table thead { display: none; }
  .table:not(.compact) tr { display: block; border-bottom: 2px solid var(--line); padding: 6px 0; }
  .table:not(.compact) td { display: block; border: 0; padding: 4px 10px; }
  .table:not(.compact) td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--muted); font-size: .85rem; }
  .brand-text small { display: none; }
}
@media print {
  .site-header, .site-footer, .admin-nav, .no-print, .pager, .quiz-callout, .crumbs { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; border: 0; }
}
