/* ============================================================
   BluOcean Cyber Awareness — design system
   Palette: ink #0A1B2A · ocean #0E63B5 · signal #23C4CE
            foam #F4F8FB · coral (fail) #E2574C · kelp (pass) #1FA97A
   Type:    Space Grotesk (display) · Inter (body)
   To use BluOcean's real fonts/logo, edit public/brand/brand.css
   ============================================================ */

:root {
  --ink: #0a1b2a;
  --ink-soft: #15314a;
  --ocean: #0e63b5;
  --ocean-deep: #0a4a8a;
  --signal: #23c4ce;
  --foam: #f4f8fb;
  --line: #d9e4ee;
  --muted: #5b7186;
  --pass: #1fa97a;
  --fail: #e2574c;
  --font-display: "Space Grotesk", var(--brand-display, sans-serif);
  --font-body: "Inter", var(--brand-body, sans-serif);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--foam);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
}

/* ---------- header ---------- */

.topbar {
  background: var(--ink);
  color: #fff;
  padding: 16px clamp(20px, 5vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 34px; width: auto; display: block; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-tag {
  color: var(--signal);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.depth-line { height: 3px; background: linear-gradient(90deg, var(--ocean) 0%, var(--signal) 60%, transparent 100%); }

/* ---------- layout ---------- */

.wrap { max-width: 860px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) 20px 80px; }
.wrap-wide { max-width: 1100px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
  box-shadow: 0 1px 2px rgba(10, 27, 42, 0.04);
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: clamp(26px, 4.5vw, 38px); font-weight: 700; }
h2 { font-size: clamp(20px, 3vw, 26px); }
.eyebrow {
  color: var(--ocean);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 10px;
}
.lede { color: var(--muted); margin-top: 10px; font-size: 16px; max-width: 56ch; }

/* ---------- forms & buttons ---------- */

label { display: block; font-weight: 600; font-size: 14px; margin: 18px 0 6px; }

input[type="email"], input[type="password"], textarea, input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--signal); outline-offset: 1px; border-color: var(--ocean); }

.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 13px 28px;
  cursor: pointer;
  background: var(--ocean);
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--ocean-deep); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ocean); border: 1.5px solid var(--ocean); }
.btn-ghost:hover { background: rgba(14, 99, 181, 0.07); }

.error-msg { color: var(--fail); font-size: 14px; margin-top: 10px; min-height: 20px; }

/* ---------- quiz ---------- */

.progress-track { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 22px 0 6px; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--ocean), var(--signal)); transition: width 0.3s ease; }
.progress-label { font-size: 13px; color: var(--muted); }

.q-topic { color: var(--signal); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em; }
.q-text { font-family: var(--font-display); font-size: clamp(18px, 2.6vw, 23px); font-weight: 600; margin: 10px 0 22px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.option:hover { border-color: var(--ocean); background: rgba(14, 99, 181, 0.04); }
.option:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.option.selected { border-color: var(--ocean); background: rgba(14, 99, 181, 0.08); }
.option .dot {
  flex: 0 0 20px; height: 20px; margin-top: 2px;
  border: 2px solid var(--line); border-radius: 50%;
}
.option.selected .dot { border-color: var(--ocean); background: radial-gradient(circle, var(--ocean) 45%, transparent 50%); }

.quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }

/* ---------- sonar score (signature element) ---------- */

.sonar-wrap { display: flex; flex-direction: column; align-items: center; padding: 16px 0 8px; }
.sonar { position: relative; width: 190px; height: 190px; }
.sonar svg { transform: rotate(-90deg); }
.sonar .ring-bg { stroke: var(--line); }
.sonar .ring-val { stroke: var(--pass); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1); }
.sonar.fail .ring-val { stroke: var(--fail); }
.sonar-num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-family: var(--font-display);
}
.sonar-num strong { font-size: 44px; font-weight: 700; }
.sonar-num span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.15em; }

@keyframes ping {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.65); opacity: 0; }
}
.sonar::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--pass); animation: ping 1.6s ease-out 2;
}
.sonar.fail::after { border-color: var(--fail); }

@media (prefers-reduced-motion: reduce) {
  .sonar::after { animation: none; }
  .sonar .ring-val, .progress-fill { transition: none; }
}

.verdict { font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px); font-weight: 700; text-align: center; margin-top: 14px; }
.verdict.pass { color: var(--pass); }
.verdict.fail { color: var(--fail); }
.verdict-sub { text-align: center; color: var(--muted); margin-top: 6px; }

/* ---------- review ---------- */

.review-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--fail);
  border-radius: 10px;
  padding: 18px 20px;
  margin-top: 14px;
  background: #fff;
}
.review-item .q-topic { color: var(--muted); }
.review-q { font-weight: 600; margin: 6px 0 12px; }
.ans { font-size: 14px; margin-top: 6px; }
.ans .tag { font-weight: 700; }
.ans.wrong .tag { color: var(--fail); }
.ans.right .tag { color: var(--pass); }
.explain { font-size: 14px; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* ---------- admin ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 24px 0; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.stat .n { font-family: var(--font-display); font-size: 30px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 2px; }
.stat.passed .n { color: var(--pass); }
.stat.failed .n { color: var(--fail); }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.passed { background: rgba(31, 169, 122, 0.12); color: var(--pass); }
.pill.failed { background: rgba(226, 87, 76, 0.12); color: var(--fail); }
.pill.invited, .pill.registered { background: rgba(14, 99, 181, 0.1); color: var(--ocean); }
.pill.in_progress { background: rgba(35, 196, 206, 0.14); color: #0d7d85; }
.pill.retake { background: var(--ink); color: var(--signal); margin-left: 6px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.send-log { font-size: 13px; margin-top: 14px; max-height: 160px; overflow-y: auto; }
.send-log .ok { color: var(--pass); }
.send-log .bad { color: var(--fail); }

.reminder-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.btn-remind {
  font: inherit; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--ocean); color: var(--ocean);
  background: #fff; border-radius: 8px; padding: 5px 14px; cursor: pointer;
}
.btn-remind:hover { background: rgba(14, 99, 181, 0.08); }
.row-check, #select-all { width: 17px; height: 17px; cursor: pointer; accent-color: var(--ocean); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mt { margin-top: 20px; }

/* ---------- clickable rows + modal ---------- */

tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(14, 99, 181, 0.05); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 27, 42, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--foam);
  border-radius: var(--radius);
  width: 100%; max-width: 720px;
  box-shadow: 0 24px 60px rgba(10, 27, 42, 0.35);
}
.modal-head {
  position: sticky; top: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px clamp(20px, 4vw, 32px);
  background: #fff; border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-close {
  background: none; border: none; font-size: 30px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: clamp(16px, 4vw, 28px); }

.d-attempt { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.d-attempt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); font-family: var(--font-display); }
.d-attempt-head .muted { font-family: var(--font-body); font-size: 13px; }

.d-q { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.d-q:last-child { border-bottom: none; }
.d-qtopic { color: var(--signal); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; }
.d-qtext { font-weight: 600; margin: 4px 0 10px; }
.d-mark { font-weight: 700; }
.d-mark.ok { color: var(--pass); }
.d-mark.bad { color: var(--fail); }

.d-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1.5px solid var(--line); border-radius: 9px;
  padding: 9px 12px; margin-bottom: 7px; font-size: 14px;
}
.d-opt.correct { border-color: var(--pass); background: rgba(31, 169, 122, 0.1); }
.d-opt.wrong { border-color: var(--fail); background: rgba(226, 87, 76, 0.09); }
.d-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.d-tag.ok { color: var(--pass); }
.d-tag.bad { color: var(--fail); }
