@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand */
  --brand-blue:  #99bdff;
  --brand-dark:  #1a2440;
  --brand-navy:  #202b3c;

  /* Page */
  --bg:       #eef4ff;
  --surface:  #ffffff;
  --surface2: #dce8ff;
  --border:   #c4d5f5;

  --text:   #202b3c;
  --muted:  #4e6482;
  --accent: #0056a7;
  --accent-hover: #00408a;

  /* Sidebar */
  --sb-bg:        #1a2440;
  --sb-text:      #8ba0c0;
  --sb-text-hover:#c8d8f0;
  --sb-text-active:#ffffff;
  --sb-active-bg: rgba(153,189,255,0.12);
  --sb-active-bar:#99bdff;
  --sb-border:    rgba(255,255,255,0.07);

  /* Semantic */
  --green:  #1a7a3a;
  --orange: #c05010;
  --purple: #5b21b6;
  --red:    #b91c1c;
  --yellow: #9a6800;
  --cyan:   #0e7490;

  /* Network diagram nodes */
  --pc:      #1a7a3a;
  --switch:  #0056a7;
  --router:  #c05010;
  --server:  #5b21b6;
  --internet:#0e7490;

  --canvas-bg: #0a0d14;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── App shell ──────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-logo-link {
  display: block;
  flex-shrink: 0;
  text-decoration: none;
  padding: 20px 18px 16px;
}
.sidebar-logo {
  width: 148px;
  display: block;
}

.sidebar-nav {
  padding: 8px 0 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ─── Category accordion (uses <details>/<summary>) ─────────────────────── */
.sidebar-category {
  /* no border, just spacing */
}

.sidebar-category-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  cursor: pointer;
  color: var(--sb-text);
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  user-select: none;
  list-style: none;
  transition: color 0.15s, background 0.15s;
  outline: none;
}
.sidebar-category-header::-webkit-details-marker { display: none; }
.sidebar-category-header::marker { display: none; }
.sidebar-category-header:hover {
  color: var(--sb-text-hover);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}
details[open] > .sidebar-category-header {
  color: var(--sb-text-hover);
}

.sidebar-cat-icon { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sidebar-cat-icon svg { width: 16px; height: 16px; }
.sidebar-cat-label { flex: 1; }

.sidebar-chevron {
  width: 14px; height: 14px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s;
}
details[open] > .sidebar-category-header .sidebar-chevron {
  transform: rotate(180deg);
  opacity: 0.8;
}

.sidebar-coming-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.28);
  border-radius: 10px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.sidebar-cat-items {
  padding: 2px 0 6px;
}

/* ─── Sidebar nav links (sub-items) ──────────────────────────────────────── */
.sidebar-link {
  display: block;
  padding: 7px 16px 7px 40px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-text);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.13s, background 0.13s;
  position: relative;
}
.sidebar-link::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 0.15s;
}
.sidebar-link:hover {
  color: var(--sb-text-hover);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}
.sidebar-link.active {
  color: var(--sb-text-active);
  background: var(--sb-active-bg);
  font-weight: 600;
}
.sidebar-link.active::before {
  background: var(--sb-active-bar);
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--sb-border);
  margin: 8px 0;
}

/* Disabled category */
.sidebar-cat-disabled .sidebar-category-header {
  cursor: default;
  opacity: 0.45;
}
.sidebar-cat-disabled .sidebar-category-header:hover {
  background: transparent;
  color: var(--sb-text);
}

/* ─── Main area ──────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar breadcrumb ──────────────────────────────────────────────────── */
.topbar {
  height: 50px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,86,167,0.05);
}
.topbar a {
  color: var(--muted);
  transition: color 0.13s;
  text-decoration: none;
}
.topbar a:hover { color: var(--text); }
.topbar-sep { color: var(--border); }
.topbar-current { color: var(--text); font-weight: 600; }

/* ─── Page content wrapper ───────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 32px 28px 64px;
}

/* ─── Hero banner (homepage / section pages) ─────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, #1a2440 0%, #0056a7 55%, #3d7bd8 100%);
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}
.hero-banner::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(153,189,255,0.2) 0%, transparent 70%);
  top: -180px; right: -80px;
  pointer-events: none;
}
.hero {
  padding: 52px 28px 40px;
  position: relative;
  z-index: 1;
  max-width: 660px;
}
.hero h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}
.hero h1 span { color: var(--brand-blue); }
.hero p { color: rgba(255,255,255,0.72); font-size: 1rem; line-height: 1.65; }

.hero-eyebrow {
  display: inline-block;
  background: var(--brand-blue);
  color: var(--brand-navy);
  border-radius: 20px;
  padding: 4px 13px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-family: 'DM Sans', sans-serif;
}

/* ─── Category / demo grids ──────────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 32px;
}
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 6px rgba(0,86,167,0.05);
}
.category-card:not(.disabled):hover {
  border-color: var(--brand-blue);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,86,167,0.13);
  text-decoration: none;
}
.category-card.disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.category-icon { font-size: 2rem; line-height: 1; }
.category-card h3 {
  font-family: 'Sora', sans-serif;
  font-size: 1.1rem; font-weight: 700;
  letter-spacing: -0.01em; color: var(--text);
}
.category-card p { font-size: 0.875rem; color: var(--muted); line-height: 1.55; }
.category-meta {
  margin-top: auto; padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted);
}
.demo-count {
  background: var(--brand-blue); color: var(--brand-navy);
  border-radius: 20px; padding: 2px 10px;
  font-weight: 700; font-size: 11px;
}
.coming-soon {
  background: var(--surface2); color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 2px 10px; font-weight: 600; font-size: 11px;
}

/* Demo card grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 24px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 1px 6px rgba(0,86,167,0.05);
}
.card:hover {
  border-color: var(--brand-blue);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,86,167,0.13);
  text-decoration: none;
}
.card-icon { font-size: 2rem; }
.card h3 {
  font-family: 'Sora', sans-serif;
  font-size: 1.05rem; font-weight: 700;
  letter-spacing: -0.01em; color: var(--text);
}
.card p { color: var(--muted); font-size: 0.875rem; line-height: 1.55; flex: 1; }
.card-badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--surface2); color: var(--accent);
  border: 1px solid var(--border); align-self: flex-start;
}
.card-badge.orange { background: rgba(192,80,16,0.08); color: var(--orange); border-color: rgba(192,80,16,0.2); }
.card-badge.red    { background: rgba(185,28,28,0.08);  color: var(--red);    border-color: rgba(185,28,28,0.2); }
.card-badge.green  { background: rgba(26,122,58,0.08);  color: var(--green);  border-color: rgba(26,122,58,0.2); }
.card-badge.purple { background: rgba(91,33,182,0.08);  color: var(--purple); border-color: rgba(91,33,182,0.2); }

/* ─── Demo page layout ───────────────────────────────────────────────────── */
.demo-header { padding: 0 0 20px; }
.demo-header h1 {
  font-family: 'Sora', sans-serif;
  font-size: 1.4rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.02em; color: var(--text);
}
.demo-header p { color: var(--muted); font-size: 0.9rem; margin-top: 5px; }

.demo-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
  contain: layout;
}
@media (max-width: 900px) { .demo-layout { grid-template-columns: 1fr; } }

/* ─── Canvas panel ───────────────────────────────────────────────────────── */
.canvas-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,86,167,0.07);
}
.canvas-wrap { position: relative; background: var(--canvas-bg); overflow: hidden; }
.canvas-wrap svg { display: block; width: 100%; }

/* ─── Step bar ───────────────────────────────────────────────────────────── */
.step-bar {
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap;
  background: var(--surface);
}
/* Controls row: dots flush left (margin-right:auto pushes buttons right), buttons flush right */
.step-bar > .progress-dots { order: 1; flex-shrink: 0; margin-right: auto; }
.step-bar > .btn            { order: 2; flex-shrink: 0; }
/* Description row: own full-width line below the controls */
.step-info {
  order: 9;
  flex-basis: 100%;
  min-width: 0;
  min-height: 52px;
  padding-top: 2px;
}
.step-info strong {
  font-family: 'Sora', sans-serif;
  color: var(--text);
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 3px;
}
.step-info span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer; border: none;
  transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0,86,167,0.3); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-reset { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-reset:hover { color: var(--text); border-color: var(--muted); }

/* ─── Progress dots ──────────────────────────────────────────────────────── */
.progress-dots { display: flex; gap: 5px; align-items: center; }
.progress-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background 0.3s;
}
.progress-dots span.done   { background: var(--green); }
.progress-dots span.active { background: var(--accent); }

/* ─── Side panel ─────────────────────────────────────────────────────────── */
.side-panel { display: flex; flex-direction: column; gap: 14px; }

.panel-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,86,167,0.05);
}
.panel-box-header {
  padding: 9px 14px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brand-navy);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
}

/* ─── Data tables ────────────────────────────────────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 11.5px; font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.data-table th {
  padding: 7px 10px; text-align: left;
  color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  font-family: 'DM Sans', sans-serif;
}
.data-table td { padding: 7px 10px; border-bottom: 1px solid rgba(196,213,245,0.5); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.highlight td  { background: rgba(153,189,255,0.15); }
.data-table tr.new-row td    { animation: rowFlash 1s ease; }
.data-table tr.active-row td { background: rgba(26,122,58,0.08); }

@keyframes rowFlash {
  0%   { background: rgba(153,189,255,0.35); }
  100% { background: transparent; }
}

.empty-table {
  padding: 16px; text-align: center;
  color: var(--muted); font-size: 12px; font-style: italic;
}

/* ─── Packet detail ──────────────────────────────────────────────────────── */
.packet-detail { padding: 12px 14px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.packet-field {
  display: flex; justify-content: space-between;
  padding: 4px 0; border-bottom: 1px solid rgba(196,213,245,0.5); gap: 8px;
}
.packet-field:last-child { border-bottom: none; }
.packet-field-label { color: var(--muted); }
.packet-field-value { color: var(--text); font-weight: 500; text-align: right; }
.packet-field-value.highlight { color: var(--accent); }
.packet-field-value.changed   { color: var(--orange); }

/* ─── Event log ──────────────────────────────────────────────────────────── */
.event-log {
  padding: 10px 14px; max-height: 160px; overflow-y: auto;
  font-size: 11.5px; font-family: 'JetBrains Mono', monospace;
  display: flex; flex-direction: column; gap: 3px;
}
.log-entry { color: var(--muted); display: flex; gap: 8px; }
.log-entry .log-time  { color: var(--border); min-width: 24px; }
.log-entry.info    .log-msg { color: var(--text); }
.log-entry.success .log-msg { color: var(--green); }
.log-entry.warn    .log-msg { color: var(--orange); }
.log-entry.accent  .log-msg { color: var(--accent); }

/* ─── SVG network elements ───────────────────────────────────────────────── */
.device-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; fill: #8b9ab8; }
.device-name  { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600; fill: #e6edf3; }
.link-line { stroke: #1e2d4a; stroke-width: 2; }
.link-line.active { stroke: #99bdff; animation: linkPulse 0.5s ease; }
@keyframes linkPulse { 0% { stroke-width: 4; } 100% { stroke-width: 2; } }
.svg-packet { pointer-events: none; }

/* ─── Tooltip ────────────────────────────────────────────────────────────── */
.tooltip {
  position: absolute; background: var(--text);
  border-radius: 6px; padding: 6px 10px;
  font-size: 11px; font-family: 'JetBrains Mono', monospace;
  color: #fff; pointer-events: none; white-space: nowrap;
  z-index: 10; transform: translate(-50%, -140%);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar-logo { width: 160px; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 6px; }
  .sidebar-cat-items { display: none; }
  details[open] .sidebar-cat-items { display: block; position: absolute; }
}
