/* W-2 Applied AI & GenAI — neural-network / data-flow aesthetic
   palette: deep indigo / electric violet / neon green / amber / ink white
   type: Space Grotesk (display) + Inter (body) + JetBrains Mono (code/labels)
*/

:root {
  --bg-0: #0a0820;
  --bg-1: #110e2c;
  --bg-2: #1a1640;
  --bg-3: #241e58;
  --line: #2c2566;
  --line-bright: #3e3387;
  --ink: #eef0fa;
  --ink-dim: #b3b3d8;
  --ink-mute: #7a78a8;
  --violet: #9d7aff;
  --violet-2: #7a4fff;
  --violet-glow: rgba(157, 122, 255, 0.18);
  --magenta: #ff5cf4;
  --green: #5ce8a8;
  --green-dim: rgba(92, 232, 168, 0.14);
  --amber: #ffb547;
  --red: #ff5c79;
  --red-dim: rgba(255, 92, 121, 0.14);

  --shadow-1: 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 0 1px rgba(157,122,255,0.42), 0 0 28px rgba(157,122,255,0.22);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;

  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(122,79,255,0.10), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(255,92,244,0.06), transparent 50%);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--violet); text-decoration: none; }
a:hover { color: var(--magenta); }

button, .btn {
  appearance: none;
  border: 1px solid var(--line-bright);
  background: var(--bg-2);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
button:hover, .btn:hover { background: var(--bg-3); border-color: var(--violet); }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary, .btn.primary {
  background: linear-gradient(135deg, var(--violet-2), var(--violet));
  border-color: var(--violet);
  color: white;
}
button.primary:hover, .btn.primary:hover { box-shadow: var(--shadow-glow); }
button.danger { background: var(--red-dim); border-color: var(--red); color: var(--red); }
button.ghost { background: transparent; }

input, select, textarea {
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-glow);
}
textarea { resize: vertical; min-height: 76px; font-family: var(--font-body); }
label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-dim);
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-weight: 500;
}

code, pre, .mono { font-family: var(--font-mono); }
pre {
  background: var(--bg-1); padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--line); overflow-x: auto;
}
code { background: var(--bg-1); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 12px 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Boot ────────────────────────────────────────────────────────────────── */
.boot {
  display: grid; place-items: center; min-height: 100vh;
  font-family: var(--font-mono); color: var(--ink-dim);
}
.boot-glyph { font-size: 56px; color: var(--violet); animation: pulse 1.4s ease-in-out infinite; }
.boot-text { margin-top: 12px; font-size: 13px; }
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 1.0; transform: scale(1.1); }
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: 56px; display: flex; align-items: center; padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 8, 32, 0.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px;
}
.topbar .brand .badge {
  font-family: var(--font-mono); font-size: 11px; color: var(--bg-0);
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  padding: 3px 8px; border-radius: 4px; font-weight: 700; letter-spacing: 0.5px;
}
.topbar .nav { margin-left: 32px; display: flex; gap: 4px; flex: 1; }
.topbar .nav a {
  padding: 6px 12px; border-radius: 6px; color: var(--ink-dim); font-size: 14px; font-weight: 500;
}
.topbar .nav a:hover { color: var(--ink); background: var(--bg-2); }
.topbar .nav a.active { color: var(--violet); background: var(--violet-glow); }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.topbar .user .who { color: var(--ink-dim); }
.topbar .user .who strong { color: var(--ink); }
.topbar .user .role-pill {
  font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: var(--violet-glow); color: var(--violet); text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.shell { padding: 24px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { margin-bottom: 4px; }
.page-head .sub { color: var(--ink-mute); font-size: 13px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card.hover:hover { border-color: var(--violet); transform: translateY(-1px); }
.card .head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.card .head h3 { margin: 0; }
.card .meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-mute); }

.pill {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; border-radius: 4px; letter-spacing: 0.5px; text-transform: uppercase; font-weight: 500;
  display: inline-block;
}
.pill.violet { background: var(--violet-glow); color: var(--violet); }
.pill.green  { background: var(--green-dim); color: var(--green); }
.pill.amber  { background: rgba(255, 181, 71, 0.16); color: var(--amber); }
.pill.red    { background: var(--red-dim); color: var(--red); }
.pill.mute   { background: var(--bg-2); color: var(--ink-mute); }

.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stretch { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--ink-mute); font-weight: 500;
}
tr:hover td { background: var(--bg-1); }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
}
.login .panel {
  width: 100%; max-width: 440px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 32px;
  position: relative; overflow: hidden;
}
.login .panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--violet), var(--magenta), var(--green));
}
.login .brand-big {
  font-family: var(--font-display); font-weight: 700; font-size: 24px;
  margin-bottom: 6px;
}
.login .sub {
  color: var(--ink-mute); font-size: 13px; margin-bottom: 24px;
  font-family: var(--font-mono);
}
.login .field + .field { margin-top: 14px; }
.login button.primary { width: 100%; padding: 11px; margin-top: 18px; }
.login .err {
  color: var(--red); font-size: 13px; margin-top: 12px;
  padding: 10px 12px; background: var(--red-dim); border-radius: var(--radius);
  border: 1px solid var(--red);
}

/* ── Module page ─────────────────────────────────────────────────────────── */
.module-meta { display: flex; gap: 14px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-mute); margin-bottom: 24px; }
.module-meta .item { display: inline-flex; align-items: center; gap: 6px; }
.section-block { margin-top: 24px; }
.section-block h3 { color: var(--violet); }
.section-block p { color: var(--ink-dim); margin: 8px 0; }
.outcomes {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  margin: 16px 0;
}
.outcomes h4 { color: var(--green); margin-bottom: 8px; font-family: var(--font-mono); font-size: 12px; }
.outcomes ul { margin: 0; padding-left: 20px; color: var(--ink-dim); font-size: 14px; }
.outcomes li { margin: 4px 0; }

/* ── MCQ ─────────────────────────────────────────────────────────────────── */
.mcq-item {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.mcq-item .qhead {
  display: flex; gap: 10px; margin-bottom: 12px; font-weight: 500;
}
.mcq-item .qnum {
  font-family: var(--font-mono); color: var(--violet); font-size: 13px; min-width: 28px;
}
.mcq-item .qtext { flex: 1; }
.mcq-opts { display: grid; gap: 8px; }
.mcq-opt {
  display: flex; align-items: start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
  background: var(--bg-2);
}
.mcq-opt:hover { border-color: var(--violet); }
.mcq-opt input { width: auto; }
.mcq-opt.correct { background: var(--green-dim); border-color: var(--green); }
.mcq-opt.wrong   { background: var(--red-dim);   border-color: var(--red); }
.mcq-explain {
  margin-top: 10px; padding: 10px 12px;
  background: var(--bg-2); border-left: 3px solid var(--violet);
  font-size: 13px; color: var(--ink-dim);
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; top: 20px; right: 20px; display: grid; gap: 10px; z-index: 1000; }
.toast {
  padding: 12px 16px; background: var(--bg-2); border: 1px solid var(--line-bright);
  border-radius: var(--radius); font-size: 13px; min-width: 240px;
  animation: slidein 0.18s ease;
}
.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); color: var(--red); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.empty {
  padding: 40px; text-align: center; color: var(--ink-mute); font-style: italic;
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg-1);
}
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.score-big { font-family: var(--font-display); font-size: 48px; font-weight: 700; color: var(--violet); line-height: 1; }
.score-tot { font-family: var(--font-mono); color: var(--ink-mute); font-size: 14px; }

.kpi {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.kpi .label { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi .value { font-family: var(--font-display); font-size: 28px; font-weight: 600; margin-top: 4px; }

.tabbar { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 16px; cursor: pointer; color: var(--ink-dim); font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--violet); border-color: var(--violet); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100;
}
.modal {
  background: var(--bg-1); border: 1px solid var(--line-bright); border-radius: var(--radius-lg);
  padding: 24px; max-width: 540px; width: 90%; max-height: 86vh; overflow-y: auto;
  box-shadow: var(--shadow-1);
}
.modal h3 { margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: end; margin-top: 20px; }

.modal.wide { max-width: 760px; }

/* ── Forms (general, not just login) ─────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 12px; }
.field label { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; box-sizing: border-box;
  background: var(--bg-0); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; font-family: var(--font-body); font-size: 14px;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(157,122,255,0.15);
}
.textarea { min-height: 90px; resize: vertical; font-family: var(--font-body); }
.textarea.mono { font-family: var(--font-mono); font-size: 13px; }
.input.small { padding: 6px 8px; font-size: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* ── Layout utilities ────────────────────────────────────────────────────── */
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.row.top { align-items: flex-start; }
.row.wrap { flex-wrap: wrap; }
.gap-s { gap: 8px; }
.gap-l { gap: 20px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.col.gap-s { gap: 8px; }
.col.gap-l { gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 880px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.spacer { flex: 1; }
.muted { color: var(--ink-mute); font-size: 13px; }
.tiny  { font-size: 12px; color: var(--ink-dim); }
.mono  { font-family: var(--font-mono); }
.right { text-align: right; }
.center-text { text-align: center; }
.mt-s { margin-top: 8px; } .mt-m { margin-top: 16px; } .mt-l { margin-top: 24px; }
.mb-s { margin-bottom: 8px; } .mb-m { margin-bottom: 16px; } .mb-l { margin-bottom: 24px; }
.hidden { display: none !important; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.5px; }
.table tr:hover td { background: var(--bg-2); }
.table td.num { font-family: var(--font-mono); text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

/* ── Buttons (extras) ────────────────────────────────────────────────────── */
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.icon  { padding: 6px 10px; }

/* ── Page heading ────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.page-head .sub { color: var(--ink-mute); font-size: 14px; margin-top: 4px; }

/* Print-friendly */
@media print {
  body { background: white; color: black; }
  .topbar, .actions, button { display: none !important; }
}
