/* ============================================================
   Kursus MTCNA — komponen khusus (tema portal)
   Dimuat SETELAH assets/style.css pada halaman it/mtcna/*
   ============================================================ */

/* ============ LAYOUT SIDEBAR + MAIN ============ */
.layout { display: flex; max-width: 1400px; margin: 0 auto; gap: 24px; padding: 0 16px; }
aside#sidebar {
  width: 300px; flex-shrink: 0; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; padding: 18px 8px 40px;
  border-right: 1px solid var(--line);
}
.layout main { flex: 1; min-width: 0; max-width: 900px; padding: 24px 8px 80px; }

/* ============ NAV SIDEBAR (TOC) ============ */
.brand { font-size: 16px; font-weight: 800; color: var(--accent); padding: 6px 10px 14px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.nav { list-style: none; }
.nav a { display: block; color: var(--muted); text-decoration: none; font-size: 13.5px; padding: 6px 10px; border-radius: 8px; transition: background .15s, color .15s; }
.nav a:hover { background: #eef2ff; color: var(--accent); }
.nav .lvl1 { font-weight: 700; color: var(--ink); margin-top: 8px; }
.nav .lvl2 { padding-left: 22px; font-size: 13px; display: none; }
.nav .lvl2.open { display: block; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .dot { float: right; color: var(--ok); font-weight: 800; }
.toc-extra { display: flex; gap: 8px; margin-bottom: 10px; }
.toc-search {
  flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--ink); background: var(--card); font-family: inherit;
}
.toc-search:focus { outline: 3px solid var(--accent2); outline-offset: 1px; border-color: var(--accent2); }
.expand-btn {
  flex-shrink: 0; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--ink);
  cursor: pointer; font-size: 13px; font-family: inherit;
}
.expand-btn:hover { border-color: var(--accent); }
#navList.all-open .lvl2 { display: block; }

/* ============ PROGRESS BAR + TOPBAR MOBILE ============ */
.prog { position: fixed; top: 0; left: 0; height: 4px; background: var(--accent2); z-index: 65; width: 0; transition: width .1s; }
.topbar { display: none; }
.scrim {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; z-index: 40;
}
.scrim.show { opacity: 1; visibility: visible; }

/* ============ TYPO MODUL ============ */
h2.mod, h2.sec {
  font-size: 22px; margin: 44px 0 6px; padding: 10px 16px;
  background: var(--card); border-left: 6px solid var(--accent);
  border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
h2.mod small, h2.sec small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.layout main h3 { font-size: 18px; margin: 34px 0 10px; color: var(--accent); }
.layout main h4 { font-size: 15.5px; margin: 22px 0 8px; }
.layout main p { margin: 10px 0; }
.layout main ul, .layout main ol { margin: 10px 0 10px 24px; }
.layout main li { margin: 5px 0; }
.layout main b { color: var(--ink); }
.layout main strong { color: var(--accent); }
h2.mod, h3, h4 { scroll-margin-top: 18px; }

/* ============ CALLOUTS (label ::before) ============ */
.def {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
  padding: 12px 16px; margin: 12px 0; font-size: 14.5px;
}
.def b { color: var(--accent); }
.analogi::before, .perhatian::before, .tip::before, .kunci::before, .ringkas::before {
  display: block; margin-bottom: 8px; width: fit-content;
  padding: 2px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--line);
}
.analogi::before { content: "Analogi"; background: var(--accent2); }
.perhatian::before { content: "Perhatian"; background: #b91c1c; }
.tip::before { content: "Tips"; background: var(--ok); }
.kunci::before { content: "Kunci Konsep"; background: #7c3aed; }
.ringkas::before { content: "Rangkuman"; background: #475569; }

/* ============ SVG DIAGRAM ============ */
.fig {
  margin: 14px 0; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; overflow-x: auto;
}
.fig svg { display: block; width: 100%; height: auto; min-width: 520px; }
.fig .cap { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 4px 2px; line-height: 1.5; }
.fig text { font-family: var(--font); }
.fig .lbl { fill: #334155; font-size: 11.5px; }
.fig .lbl-b { fill: #0f172a; font-size: 11.5px; font-weight: 700; }
.fig .lbl-d { fill: #475569; font-size: 10.5px; }
.fig .arr-line { stroke: #64748b; stroke-width: 1.6; fill: none; }
.fig .arr-line.dim { stroke: #94a3b8; stroke-width: 1.3; stroke-dasharray: 4 3; }
.fig .box { stroke: #94a3b8; stroke-width: 1.4; fill: #f1f5f9; rx: 8; ry: 8; }
.fig .box.fill-blue { fill: #dbeafe; stroke: #2563eb; }
.fig .box.fill-green { fill: #dcfce7; stroke: #16a34a; }
.fig .box.fill-amber { fill: #fef3c7; stroke: #d97706; }
.fig .box.fill-red { fill: #fee2e2; stroke: #dc2626; }
.fig .box.fill-violet { fill: #ede9fe; stroke: #7c3aed; }
.fig .box.fill-slate { fill: #e2e8f0; stroke: #475569; }
.fig .arrow { fill: #64748b; }

/* ============ CODE (.cfg + tombol salin) ============ */
.cfg {
  position: relative;
  background: #0f172a; color: #e2e8f0;
  border-radius: 10px; padding: 14px 16px; margin: 12px 0;
  font-family: var(--mono); font-size: 13px;
  overflow-x: auto; line-height: 1.6;
}
.cfg .cm { color: #64748b; }
.cfg b { color: #93c5fd; font-weight: 600; }
.cfg code { background: none; color: inherit; padding: 0; }
.copy-btn {
  position: absolute; bottom: 8px; right: 8px; padding: 4px 10px; border-radius: 7px;
  border: 1px solid #334155; background: #1e293b; color: #cbd5e1;
  font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.copy-btn:hover { color: #fff; }
.copyable { cursor: pointer; }
.copyable:hover { outline: 2px solid var(--accent2); }

/* ============ BOX LAB / SOAL / LAPANGAN ============ */
.lab { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; padding: 16px; margin: 16px 0; }
.lab h4 { margin-top: 0; color: #0369a1; }
.soal { background: #fdf4ff; border: 1px solid #e9d5ff; border-radius: 12px; padding: 16px; margin: 16px 0; }
.soal h4 { margin-top: 0; color: #7c3aed; }
.soal details { margin-top: 8px; }
.soal summary { cursor: pointer; color: #7c3aed; font-weight: 700; }
.soal ol > li { margin-bottom: 12px; }
.soal .opsi { display: block; margin-left: 18px; }
.lapangan { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 16px; margin: 16px 0; }
.lapangan h4 { margin-top: 0; color: #b45309; }
.lapangan ul { margin-left: 20px; }
.lapangan li { margin-bottom: 4px; }

/* ============ NAVIGASI MODUL ◀▶ ============ */
.mod-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 28px 0 6px; }
.mod-nav .mn {
  padding: 8px 14px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--line); color: var(--accent); font-weight: 700;
  font-size: 13px; text-decoration: none; cursor: pointer; font-family: inherit;
}
.mod-nav a.mn:hover { border-color: var(--accent); }
.mod-nav button.mn { background: var(--accent); color: #fff; border-color: var(--accent); }
.mod-nav button.mn.on { background: var(--ok); border-color: var(--ok); }
.mod-nav .mn:empty { display: none; }

/* ============ LAB MAP ============ */
.labmap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 26px; }
.labmap summary { cursor: pointer; font-weight: 800; font-size: 16px; color: var(--accent); }
.labmap-note { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.labmap-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.labmap-list li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; }
.labmap-list li.done { border-color: var(--ok); background: #f0fdf4; color: #14532d; }
.labmap-list input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ok); flex-shrink: 0; }
.labmap-list a { color: var(--accent); font-weight: 600; text-decoration: none; }
.labmap-list a:hover { text-decoration: underline; }

/* ============ DRILL SUBNETTING ============ */
.drill { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 14px 0 6px; }
.drill .drill-q { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.drill .opt {
  display: block; width: 100%; text-align: left; margin-bottom: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  cursor: pointer; font-size: 14px; font-family: inherit; color: var(--ink);
}
.drill .opt:hover { border-color: var(--accent); }
.drill .opt.correct { border-color: var(--ok); background: #dcfce7; color: #14532d; }
.drill .opt.wrong { border-color: #dc2626; background: #fee2e2; color: #7f1d1d; }
.drill .opt:disabled { cursor: default; opacity: .95; }
.drill .drow { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.dbtn { padding: 10px 16px; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; font-size: 14px; font-family: inherit; }
.dbtn.ghost { background: var(--card); color: var(--accent); border: 1px solid var(--line); }
.drill-score { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* ============ QUIZ MTCNA (tema terang portal) ============ */
header.qintro { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; }
header.qintro h1 { font-size: 22px; }
header.qintro p { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.6; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.stat b { color: var(--accent); }
.modes { display: flex; gap: 12px; flex-wrap: wrap; }
.explain {
  display: none; margin-top: 14px; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; font-size: 13.5px; line-height: 1.6; color: var(--ink);
}
.feedback { margin-top: 14px; font-weight: 700; font-size: 15px; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.hide { display: none !important; }
.qnav { margin: 0 0 16px; }

/* ============ TOPOLOGI (variabel + komponen) ============ */
.topo { --wan: #2563eb; --router: #1e293b; --mngmt: #16a34a; --lan: #ea580c; --vip: #7c3aed; --client: #0d9488; --bridge: #a16207; --switch: #cbd5e1; }
.topo h1 { font-size: 20px; margin-bottom: 4px; }
.topo svg { width: 100%; height: auto; display: block; }
.topo .seg-title { font-size: 13.5px; font-weight: 700; }
.topo .seg-line { font-size: 10.5px; fill: #475569; }
.topo .section { margin-top: 26px; }
.topo .section h2 { font-size: 15px; padding: 8px 14px; background: #f8fafc; color: #0f172a; border-left: 4px solid var(--router); border-radius: 6px; margin-bottom: 10px; }
.topo .section h2 small { color: #64748b; font-weight: normal; font-size: 12px; }
.topo .tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.topo .tag-on { background: #dcfce7; color: #15803d; }
.topo .tag-off { background: #fee2e2; color: #b91c1c; }
.topo .tag-warn { background: #fef3c7; color: #b45309; }

/* ============ RESPONSIVE: TABLET & PHONE ============ */
@media (max-width: 1080px) {
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(135deg, #1e3a8a, #0ea5e9); color: #fff;
    padding: 10px 14px; box-shadow: 0 2px 10px rgba(0,0,0,.15);
  }
  .toc-toggle {
    width: 44px; height: 44px; flex-shrink: 0;
    border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.16);
    color: #fff; border-radius: 8px; font-size: 18px; cursor: pointer; font-family: inherit;
  }
  .toc-toggle:hover { background: rgba(255,255,255,.3); }
  .topbar-title { font-weight: 800; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-link { color: #fff; text-decoration: none; font-size: 18px; }
  .topbar-link:hover { opacity: .85; }
  .layout { display: block; padding: 0; }
  aside#sidebar {
    position: fixed; top: 0; left: 0; width: 300px; max-width: 85vw;
    height: 100vh; z-index: 60; background: var(--bg);
    transform: translateX(-100%); transition: transform .28s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,.2);
    border-right: 1px solid var(--line); padding-top: 14px;
  }
  aside#sidebar.open { transform: translateX(0); }
  .layout main { max-width: none; padding: 16px 14px 70px; }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 21px; }
  h2.mod, h2.sec { font-size: 20px; }
  h2.mod, h3, h4 { scroll-margin-top: 76px; }
}
@media (max-width: 640px) {
  .hero { padding: 16px 14px; border-radius: 12px; }
  .hero h1 { font-size: 19px; }
  .hero p { font-size: 13.5px; }
  .hero .meta { font-size: 11.5px; gap: 10px; }
  body { font-size: 15px; }
  h2.mod, h2.sec { font-size: 18px; padding: 8px 12px; }
  .layout main h3 { font-size: 16.5px; }
  .cfg { font-size: 12px; padding: 12px; }
  table { font-size: 12.5px; }
  .to-top { right: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  aside#sidebar, .scrim, .nav a, .prog { transition: none; }
}

/* ============ DARK MODE: hover TOC + teks di atas isian aksen ============ */
html[data-theme="dark"] .nav a:hover { background: #1e293b; }
html[data-theme="dark"] .nav a.active,
html[data-theme="dark"] .mod-nav button.mn,
html[data-theme="dark"] .dbtn { color: #0b1220; }

/* ============ PRINT ============ */
@media print {
  aside#sidebar, .prog { display: none; }
  .layout { display: block; max-width: none; }
  .hero { background: #fff; color: #000; border: 1px solid #000; }
  body { font-size: 12px; }
  .cfg { background: #f1f5f9; color: #0f172a; }
  h2.mod, h2.sec { box-shadow: none; }
}
