/* ===== CCNA 30-day course — main stylesheet ===== */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: rgba(20, 30, 60, 0.08);
  --border-strong: rgba(20, 30, 60, 0.16);
  --text: #14213d;
  --text-muted: #5a6480;
  --text-dim: #8892ad;
  --accent: #2563eb;
  --accent-2: #4f46e5;
  --accent-soft: #e0e8ff;
  --good: #14a163;
  --good-soft: #e1f5ec;
  --warn: #d97706;
  --warn-soft: #fdf3df;
  --bad: #d63d3d;
  --bad-soft: #fbe5e5;
  --code-bg: #0f1424;
  --code-text: #e6ebff;
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 30, 60, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 30, 60, 0.10);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --maxw: 1180px;
  --transition: 180ms cubic-bezier(.2,.7,.3,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2632;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e6ebf5;
  --text-muted: #9aa4bf;
  --text-dim: #6c7691;
  --accent: #6ea8ff;
  --accent-2: #8a7cff;
  --accent-soft: rgba(110, 168, 255, 0.18);
  --good: #4ade80;
  --good-soft: rgba(74, 222, 128, 0.16);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.16);
  --code-bg: #0a0d14;
  --code-text: #d6ddef;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--font-mono); font-size: 13px; }
pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
}
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 32px; height: 32px; color: var(--accent); }
.brand-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-muted); }
.topnav { display: flex; gap: 4px; flex: 1; margin-left: 12px; flex-wrap: wrap; }
.topnav a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
}
.topnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.streak {
  display: flex; align-items: center; gap: 6px;
  background: var(--warn-soft); color: var(--warn);
  padding: 6px 10px; border-radius: 999px;
  font-weight: 600; font-size: 13px;
}
.theme-toggle {
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-muted); width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  transition: var(--transition);
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

/* ===== Main layout ===== */
.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px;
}
.loading { color: var(--text-muted); padding: 60px 0; text-align: center; }

.page-head { margin-bottom: 24px; }
.page-head h1 {
  margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
}
.page-head .sub { color: var(--text-muted); font-size: 14px; }
.crumb {
  color: var(--text-muted); font-size: 13px;
  margin-bottom: 6px;
}
.crumb a { color: var(--text-muted); }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card.hoverable { cursor: pointer; }
.card.hoverable:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.card .muted { color: var(--text-muted); font-size: 13.5px; }

/* KPI */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.kpi .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi .value { font-size: 28px; font-weight: 600; margin-top: 6px; }
.kpi .delta { font-size: 12px; color: var(--good); margin-top: 2px; }

/* Progress bar */
.progress-track {
  height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 400ms ease;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: white;
  border: none; padding: 10px 16px; border-radius: var(--radius);
  font-weight: 500; font-size: 14px; cursor: pointer;
  transition: var(--transition); text-decoration: none;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.success { background: var(--good); }
.btn.danger  { background: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Pills / tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.good   { background: var(--good-soft);  color: var(--good);   border-color: transparent; }
.tag.warn   { background: var(--warn-soft);  color: var(--warn);   border-color: transparent; }
.tag.bad    { background: var(--bad-soft);   color: var(--bad);    border-color: transparent; }

/* ===== Lesson page ===== */
.lesson { max-width: 820px; margin: 0 auto; }
.lesson h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
.lesson .meta { color: var(--text-muted); font-size: 13.5px; margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.lesson section { margin-bottom: 28px; }
.lesson h2 { font-size: 19px; font-weight: 600; margin: 28px 0 10px; letter-spacing: -0.01em; }
.lesson h3 { font-size: 16px; font-weight: 600; margin: 22px 0 8px; }
.lesson p, .lesson ul, .lesson ol { font-size: 15px; line-height: 1.7; }
.lesson ul li, .lesson ol li { margin-bottom: 4px; }
.lesson blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  margin: 14px 0; padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}
.callout { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); margin: 14px 0; background: var(--surface); }
.callout.info { background: var(--accent-soft); border-color: transparent; }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.good { background: var(--good-soft); border-color: transparent; }

.keypoints { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 22px; }
.keypoints h3 { margin-top: 0; }

/* Lesson nav */
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ===== Quiz ===== */
.quiz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.quiz h3 { margin-top: 0; }
.quiz .qprompt { font-size: 15.5px; font-weight: 500; margin: 14px 0 12px; }
.quiz .options { display: grid; gap: 8px; }
.quiz .opt {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: var(--radius); cursor: pointer;
  transition: var(--transition); text-align: left; font-size: 14px;
  font-family: var(--font); color: var(--text);
}
.quiz .opt:hover { border-color: var(--accent); }
.quiz .opt.selected { background: var(--accent-soft); border-color: var(--accent); }
.quiz .opt.correct { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.quiz .opt.wrong   { background: var(--bad-soft);  border-color: var(--bad);  color: var(--bad); }
.quiz .opt:disabled { cursor: default; }
.quiz .feedback { margin-top: 12px; font-size: 14px; padding: 10px 12px; border-radius: var(--radius); }
.quiz .feedback.correct { background: var(--good-soft); color: var(--good); }
.quiz .feedback.wrong   { background: var(--bad-soft);  color: var(--bad); }
.quiz-progress { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }

/* ===== Subnet game ===== */
.game-board { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; max-width: 720px; margin: 0 auto; }
.game-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.game-stats .stat { background: var(--surface-2); padding: 8px 14px; border-radius: var(--radius); font-size: 13px; color: var(--text-muted); }
.game-stats .stat strong { color: var(--text); font-size: 17px; margin-right: 6px; }
.subnet-q { font-size: 22px; font-weight: 600; font-family: var(--font-mono); margin: 14px 0 18px; padding: 12px 14px; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); }
.subnet-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.subnet-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.subnet-form input { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-family: var(--font-mono); font-size: 14px; }
.subnet-form input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.subnet-result { padding: 12px 14px; border-radius: var(--radius); margin-top: 12px; font-size: 14px; }
.subnet-result.ok  { background: var(--good-soft); color: var(--good); }
.subnet-result.err { background: var(--bad-soft); color: var(--bad); }
.subnet-result table { width: 100%; margin-top: 8px; font-family: var(--font-mono); font-size: 12.5px; border-collapse: collapse; }
.subnet-result td { padding: 4px 8px; border-bottom: 1px dashed var(--border); }
.subnet-result td:first-child { color: var(--text-muted); width: 40%; }

/* ===== Flashcards ===== */
.flashcard-wrap { max-width: 600px; margin: 0 auto; perspective: 1200px; }
.flashcard { position: relative; min-height: 280px; transform-style: preserve-3d; transition: transform 500ms; cursor: pointer; }
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard .face {
  position: absolute; inset: 0; backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; text-align: center; box-shadow: var(--shadow-md);
}
.flashcard .face.back { transform: rotateY(180deg); background: var(--accent-soft); }
.flashcard .face .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.flashcard .face .content { font-size: 17px; line-height: 1.55; }
.flashcard-controls { display: flex; gap: 10px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.deck-progress { color: var(--text-muted); font-size: 13px; text-align: center; margin-bottom: 12px; }

/* ===== Packet sim ===== */
.sim-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.sim-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.sim-canvas { background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--border); }
.osi-stack { display: grid; gap: 4px; margin-top: 12px; }
.osi-layer { padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; font-size: 13px; transition: var(--transition); }
.osi-layer.active { background: var(--accent-soft); border-color: var(--accent); transform: translateX(4px); }
.osi-layer .lname { font-weight: 500; }
.osi-layer .lpdu  { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }

/* ===== 30-day plan grid ===== */
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.day-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  text-align: left; cursor: pointer; transition: var(--transition);
  text-decoration: none; color: var(--text); display: block;
}
.day-tile:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.day-tile.done { background: var(--good-soft); border-color: var(--good); }
.day-tile .num { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.day-tile .topic { font-weight: 600; font-size: 13.5px; margin-top: 4px; line-height: 1.3; }
.day-tile .domain { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.day-tile.done .domain, .day-tile.done .num { color: var(--good); }

/* ===== Footer ===== */
.footnote {
  text-align: center; padding: 24px; color: var(--text-dim); font-size: 12px;
  border-top: 1px solid var(--border); margin-top: 40px;
}
.footnote a { color: var(--text-muted); }

/* ===== Domain swatch colors ===== */
.dom-fund     { --domc: #2563eb; }
.dom-access   { --domc: #14a163; }
.dom-ipconn   { --domc: #d97706; }
.dom-ipsvc    { --domc: #db2777; }
.dom-security { --domc: #dc2626; }
.dom-auto     { --domc: #7c3aed; }
.dom-review   { --domc: #5a6480; }
.dom-bar { width: 100%; height: 4px; border-radius: 4px; background: var(--domc); margin-bottom: 8px; }

/* Small */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }

/* Animations */
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.app-main > * { animation: fadein 220ms ease both; }

/* Responsive */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 12px 14px; gap: 12px; }
  .topnav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .topnav a { white-space: nowrap; }
  .app-main { padding: 18px 14px; }
  .subnet-form { grid-template-columns: 1fr; }
}
