/* CIC Introduction to Computing — exam site
   Same palette as the lecture decks: navy, teal, mint, amber. */

:root {
  --navy: #0B1D3A;
  --navy2: #13294B;
  --navy3: #1D3A63;
  --teal: #1C7293;
  --mint: #27C4A6;
  --amber: #FFB703;
  --coral: #E5717A;
  --ink: #16202E;
  --grey: #5A6B80;
  --line: #D8E2EE;
  --card: #FFFFFF;
  --paper: #F4F7FB;
  --shadow: 0 1px 3px rgba(11, 29, 58, .08), 0 6px 18px rgba(11, 29, 58, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.wrap { width: min(980px, 92%); margin: 0 auto; }
.wrap-wide { width: min(1500px, 96%); margin: 0 auto; }

/* ---------- masthead ---------- */
.masthead { background: var(--navy); color: #fff; border-bottom: 3px solid var(--amber); }
.masthead .inner { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.masthead h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .2px; }
.masthead p { margin: 0; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: rgba(255,255,255,.65); }
.masthead .spacer { flex: 1; }

/* ---------- cards, headings ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 22px; margin: 18px 0; }
h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.2px; }
h3 { font-size: 16px; margin: 22px 0 8px; color: var(--teal); }
.muted { color: var(--grey); font-size: 14px; }
.kicker { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--teal); font-weight: 700; margin: 0 0 6px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 5px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
textarea { resize: vertical; min-height: 72px; line-height: 1.55; }
.hint { font-size: 13px; color: var(--grey); margin-top: 4px; }
.err { color: var(--coral); font-size: 14px; font-weight: 600; margin-top: 8px; min-height: 20px; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--navy); background: var(--navy); color: #fff;
  padding: 10px 18px; border-radius: 8px;
}
button:hover, .btn:hover { background: var(--navy2); }
button.ghost { background: #fff; color: var(--navy); }
button.ghost:hover { background: #EEF3F9; }
button.danger { background: var(--coral); border-color: var(--coral); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small { padding: 5px 11px; font-size: 13px; border-radius: 6px; }

/* ---------- exam runner ---------- */
.examhead {
  position: sticky; top: 0; z-index: 30;
  background: var(--navy); color: #fff; border-bottom: 2px solid var(--amber);
}
.examhead .inner { display: flex; align-items: center; gap: 18px; padding: 10px 0; flex-wrap: wrap; }
.who { font-weight: 600; }
.who small { display: block; font-weight: 400; font-size: 12px; color: rgba(255,255,255,.6); }
.timer { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; color: var(--mint); }
.timer.warn { color: var(--amber); }
.timer.crit { color: #FF8A8A; }
.savestate { font-size: 12px; color: rgba(255,255,255,.6); min-width: 130px; }
.progressbar { height: 5px; background: var(--navy3); }
.progressbar > i { display: block; height: 100%; background: var(--mint); width: 0; transition: width .25s; }

.practicebar { background: var(--amber); color: var(--navy); font-weight: 700; text-align: center; padding: 7px; font-size: 14px; }

.part { margin: 30px 0 10px; }
.part h2 { color: var(--navy); }
.part .partinfo { background: #EAF1F8; border-left: 4px solid var(--teal); padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: 14px; }

.q { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin: 14px 0; box-shadow: var(--shadow); }
.q.answered { border-left: 4px solid var(--mint); }
.qhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.qnum { font-weight: 800; color: var(--teal); font-size: 15px; min-width: 40px; }
.qmarks { margin-left: auto; font-size: 12px; color: var(--grey); white-space: nowrap; }
.qtext { font-size: 16px; }
pre.block {
  background: var(--navy); color: #DCE8F5; padding: 14px 16px; border-radius: 8px;
  font-family: "Consolas", "Courier New", monospace; font-size: 13.5px; line-height: 1.5;
  overflow-x: auto; white-space: pre; margin: 12px 0;
}

.opts { margin: 12px 0 0; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; cursor: pointer; background: #fff; }
.opt:hover { background: #F2F7FC; }
.opt input { margin-top: 4px; flex: none; width: auto; }
.opt.sel { border-color: var(--teal); background: #EAF4F8; box-shadow: inset 0 0 0 1px var(--teal); }
.optletter { font-weight: 700; color: var(--grey); flex: none; }

.tfrow { display: flex; gap: 10px; margin: 10px 0; }
.tfrow .opt { flex: 1; justify-content: center; font-weight: 600; }
.sub { margin: 14px 0 0; padding-left: 14px; border-left: 3px solid var(--line); }
.sub .sublabel { font-weight: 700; color: var(--navy); }

/* jump grid */
.navgrid { position: fixed; right: 14px; top: 96px; width: 208px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; z-index: 20; max-height: calc(100vh - 130px); overflow: auto; }
.navgrid h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--grey); }
.navgrid .cells { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.navgrid .cells b { display: block; font-size: 12px; text-align: center; padding: 6px 0; border-radius: 5px; background: #EEF3F9; color: var(--grey); cursor: pointer; font-weight: 600; }
.navgrid .cells b.done { background: var(--mint); color: var(--navy); }
@media (max-width: 1300px) { .navgrid { display: none; } }

.submitbox { background: var(--navy2); color: #fff; border-radius: 12px; padding: 24px; margin: 30px 0 60px; }
.submitbox h2 { color: #fff; }
.submitbox .muted { color: rgba(255,255,255,.65); }

/* ---------- dashboard ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 0; }
.tabs button { background: #fff; color: var(--navy); border: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.subtabs button { border-radius: 999px; font-size: 14px; padding: 6px 14px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
table.grid th { background: var(--navy); color: #fff; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; position: sticky; top: 0; z-index: 5; }
table.grid tbody tr:hover { background: #F2F7FC; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid input[type=number] { width: 78px; padding: 5px 7px; text-align: right; }
.tablewrap { overflow: auto; max-height: 66vh; border: 1px solid var(--line); border-radius: 10px; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; letter-spacing: .4px; }
.pill.live { background: #DCF7F0; color: #0C5F4E; }
.pill.wait { background: #FFF0CC; color: #7A5600; }
.pill.done { background: #E3ECF7; color: var(--navy); }
.pill.practice { background: var(--amber); color: var(--navy); }
.pill.locked { background: #FADCDE; color: #8A2B33; }

/* slider switch */
.sw { position: relative; display: inline-block; width: 42px; height: 23px; vertical-align: middle; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw i { position: absolute; inset: 0; background: #C6D2E0; border-radius: 999px; transition: .18s; cursor: pointer; }
.sw i::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.sw input:checked + i { background: var(--mint); }
.sw input:checked + i::before { transform: translateX(19px); }
.sw input:disabled + i { opacity: .4; cursor: not-allowed; }
.sw.red input:checked + i { background: var(--coral); }
.swlabel { font-size: 11px; color: var(--grey); display: block; text-align: center; letter-spacing: .5px; text-transform: uppercase; }

.gate { max-width: 420px; margin: 12vh auto; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.toolbar .spacer { flex: 1; }
.statusdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); margin-right: 6px; }
.statusdot.off { background: var(--coral); }

.marksheet .item { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 12px 0; background: #fff; }
.marksheet .ans { background: #F4F7FB; border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; font-size: 14.5px; margin: 8px 0; }
.marksheet .key { background: #FFF8E6; border-left: 3px solid var(--amber); border-radius: 0 8px 8px 0; padding: 10px 14px; font-size: 13.5px; white-space: pre-wrap; }
.marksheet .right { color: #0C5F4E; font-weight: 700; }
.marksheet .wrong { color: #8A2B33; font-weight: 700; }

dialog { border: none; border-radius: 14px; padding: 0; box-shadow: 0 30px 80px rgba(11,29,58,.35); max-width: min(1000px, 94vw); width: 100%; }
dialog::backdrop { background: rgba(11,29,58,.5); }
dialog .dlgbody { padding: 24px; max-height: 82vh; overflow: auto; }
dialog .dlghead { position: sticky; top: 0; background: var(--navy); color: #fff; padding: 14px 24px; display: flex; align-items: center; gap: 12px; }
dialog .dlghead .spacer { flex: 1; }

/* ---------- print ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .noprint, .masthead, .toolbar, .tabs, .navgrid, dialog { display: none !important; }
  .card { box-shadow: none; border: none; padding: 0; margin: 0 0 14px; }
  .tablewrap { max-height: none; overflow: visible; border: none; }
  table.grid { font-size: 9.5pt; }
  table.grid th { background: #0B1D3A !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; position: static; }
  table.grid th, table.grid td { padding: 4px 6px; border-bottom: 1px solid #bbb; }
  tr, .item { page-break-inside: avoid; }
  .printonly { display: block !important; }
  @page { size: A4 landscape; margin: 12mm; }
}
.printonly { display: none; }

/* ---------- a paper that is not open yet ---------- */
.notopen {
  border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: 0 10px 10px 0; background: #FFFCF4;
  padding: 14px 18px; margin: 12px 0;
}
.notopen h3 { margin: 0 0 4px; color: var(--navy); font-size: 16.5px; }
.notopen .when { margin: 0; font-size: 15.5px; font-weight: 600; }
.notopen .again { margin: 4px 0 0; font-size: 14px; color: var(--grey); }

/* ---------- the exam on/off switch ---------- */
.examswitch { align-items: center; gap: 18px; }
.bigsw { display: flex; align-items: center; gap: 12px; }
.sw.big { width: 60px; height: 32px; }
.sw.big i::before { width: 24px; height: 24px; left: 4px; top: 4px; }
.sw.big input:checked + i::before { transform: translateX(28px); }
.sw.big input:checked + i { background: var(--mint); }
.bigsw strong { font-size: 15px; letter-spacing: .6px; }
.bigsw .muted { font-size: 13px; }
.datefield { display: flex; align-items: center; gap: 8px; }
.datefield label { margin: 0; white-space: nowrap; }
.datefield input { width: auto; }

.studentview {
  border: 1px dashed var(--line); border-left: 4px solid var(--amber);
  border-radius: 0 10px 10px 0; background: #FFFCF4;
  padding: 12px 18px; margin: 4px 0 16px;
}
.studentview .pvlabel {
  font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--grey); font-weight: 700; margin-bottom: 6px;
}
.studentview h3 { margin: 0 0 4px; color: var(--navy); font-size: 16px; }
.studentview .when { margin: 0; font-weight: 600; }
.studentview .again { margin: 3px 0 0; font-size: 14px; color: var(--grey); }
