/* ════════════════════════════════════════════════════════════════
   NEXUS SHELL CSS — sidebar + main-wrapper aanvullingen (25 jul 2026)
   v2: hamburger-toggle + mobile overlay-menu (26 jul 2026)
   v3: desktop sidebar collapsed-mode (26 jul 2026)
       - burger zichtbaar op alle viewports
       - desktop: body.nx-sidebar-collapsed → 64px (was 232px)

   Wordt geladen na nexus-base.css zodat de sidebar over de
   bestaande ih-* componenten valt zonder gedoe. Alleen de
   sidebar-layout + nav-button styling zit hier. De deck zelf
   (logo, health-gauge, pills, clock) zit in nexus.css en
   nexus-base.css.
   ════════════════════════════════════════════════════════════════ */

/* layout: deck boven, sidebar links, main rechts */
body {
  margin: 0;
  min-height: 100vh;
  position: relative;
}

.nx-deck {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 22px;
  min-height: 60px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--nx-border);
  width: 100%;
  box-sizing: border-box;
}
.nx-deck > * { flex: none; }
.nx-deck > .nx-deck-spacer { flex: 1 1 auto; }

/* ── HAMBURGER (alle viewports, getoond als toggle-button) ──
   Op desktop/tablet: verbergt/verkleint sidebar (collapsed-mode).
   Op mobiel (≤720px): opent overlay-menu.
   Bij .is-active: lijntjes animeren naar een "X". */
.nx-burger {
  display: flex;          /* alle viewports */
  width: 38px;
  height: 38px;
  padding: 0;
  margin: 0 2px 0 -4px;
  border: 1px solid var(--nx-border);
  border-radius: 9px;
  background: rgba(26, 26, 46, 0.6);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  transition: border-color .18s, background-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.nx-burger:hover,
.nx-burger:focus-visible {
  border-color: var(--nx-accent);
  background: rgba(212, 175, 55, 0.10);
  outline: none;
}
.nx-burger > span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--nx-text-hi);
  border-radius: 1px;
  transition: transform .22s ease, opacity .18s ease, background-color .18s;
  transform-origin: center;
  /* Spans zijn decoratief: laat het pointer-event door naar de button zelf
     zodat Playwright de button als hit-target ziet, en klik-bubbling werkt
     op alle platforms (anders kan een child-span op de center-coord
     'm' blokkeren voor accessibility-tools). */
  pointer-events: none;
}
/* Open-state: wordt een "X" (alleen relevant op mobiel; op desktop
   toont is-active enkel een gouden border om visuele feedback te geven) */
.nx-burger.is-active > span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nx-burger.is-active > span:nth-child(2) { opacity: 0; }
.nx-burger.is-active > span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nx-burger.is-active {
  border-color: var(--nx-accent);
  background: rgba(212, 175, 55, 0.14);
}

.nx-sidebar {
  position: fixed;
  top: 64px;            /* wordt overschreven door syncDeckHeight() */
  left: 0;
  bottom: 0;
  width: 232px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: rgba(11, 11, 20, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--nx-border);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--nx-border) transparent;
  /* Transition voor desktop collapsed-mode: 0s = direct switch op toggle.
     Een toggle-button verwacht directe feedback; 250ms-animatie veroorzaakt
     een reflow-race die de breedte nooit daadwerkelijk verandert. */
  transition: none;
}
.nx-sidebar::-webkit-scrollbar { width: 6px; }
.nx-sidebar::-webkit-scrollbar-thumb { background: var(--nx-border); border-radius: 3px; }

.nx-main {
  margin-left: 232px;   /* ruimte voor sidebar */
  padding: 22px 26px 60px;
  min-height: calc(100vh - 64px);
  box-sizing: border-box;
  max-width: calc(100vw - 232px);
  /* Geen transition: 250ms-animatie wordt onderbroken door reflow
     (syncDeckHeight zet sidebar.style.top, body-class add/remove, etc).
     Een toggle verwacht directe feedback. */
  transition: none;
}
/* deck-only modus: main neemt volle breedte */
body.nx-deck-only .nx-main { margin-left: 0; max-width: 100%; }

/* ── DESKTOP COLLAPSED (≥1100px) ──
   Sidebar 232px → 168px, labels + iconen zichtbaar, section-titles + sidebar-head
   compact maar leesbaar. Main neemt vrijgekomen ruimte in. Geen overlay. */
@media (min-width: 1101px) {
  body.nx-sidebar-collapsed .nx-sidebar { width: 168px; }
  body.nx-sidebar-collapsed .nx-main { margin-left: 168px; max-width: calc(100vw - 168px); }
  /* Sidebar-head compacter maar leesbaar (geen verberg) */
  body.nx-sidebar-collapsed .nx-sidebar-head { padding: 14px 14px 10px; }
  body.nx-sidebar-collapsed .nx-sidebar-title { font-size: 0.95rem; }
  body.nx-sidebar-collapsed .nx-sidebar-title::before { width: 16px; height: 16px; }
  body.nx-sidebar-collapsed .nx-sidebar-sub { font-size: 0.55rem; margin-top: 3px; }
  body.nx-sidebar-collapsed .nx-sidebar-rule { width: 28px; margin-top: 7px; }
  /* Section-titles compacter maar zichtbaar */
  body.nx-sidebar-collapsed .nx-sidebar-section { padding: 10px 8px 2px; }
  body.nx-sidebar-collapsed .nx-sidebar-section-title {
    font-size: 0.55rem; padding: 3px 8px 4px; letter-spacing: 0.18em;
  }
  body.nx-sidebar-collapsed .nx-sidebar-section-title::before { width: 3px; height: 3px; }
  body.nx-sidebar-collapsed .nx-sidebar-divider { margin: 3px 12px; }
  /* Nav-buttons compacter: icon + label (ellipsis als te lang) */
  body.nx-sidebar-collapsed .nx-nav-btn {
    padding: 7px 10px; gap: 8px; font-size: 0.8rem;
  }
  body.nx-sidebar-collapsed .nx-nav-icon { width: 16px; height: 16px; }
  body.nx-sidebar-collapsed .nx-nav-label { font-size: 0.8rem; }
  /* Sidebar-foot compacter */
  body.nx-sidebar-collapsed .nx-sidebar-foot { padding: 8px 12px; font-size: 0.58rem; }
  #nx-sidebar-time { font-size: 0.58rem; }
}

/* sidebar head: titel + ondertitel + goud-rule */
.nx-sidebar-head {
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--nx-border);
  flex: 0 0 auto;
}
.nx-sidebar-title {
  font-family: var(--nx-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--nx-accent);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nx-sidebar-title::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d4af37 0%, #8a6b1f 80%);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
  flex: none;
}
.nx-sidebar-sub {
  font-family: var(--nx-font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--nx-text-faint);
  margin-top: 4px;
}
.nx-sidebar-rule {
  height: 2px;
  width: 40px;
  background: var(--nx-accent);
  margin-top: 10px;
  border-radius: 1px;
  opacity: 0.85;
}

/* sidebar section */
.nx-sidebar-section {
  padding: 12px 10px 4px;
  flex: 0 0 auto;
}
.nx-sidebar-section-title {
  font-family: var(--nx-font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nx-text-faint);
  padding: 4px 8px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nx-sidebar-section-title::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--nx-accent);
  opacity: 0.6;
}
.nx-sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--nx-border) 30%, var(--nx-border) 70%, transparent 100%);
  margin: 4px 16px;
  flex: 0 0 auto;
}

/* nav-button: per-item */
.nx-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 7px;
  text-decoration: none;
  color: var(--nx-text-mid);
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  transition: background-color .18s, color .18s, transform .18s;
}
.nx-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--nx-text-hi);
}
.nx-nav-btn.is-active {
  background: rgba(212, 175, 55, 0.10);
  color: var(--nx-accent-hi, #f0d06a);
  font-weight: 600;
}
.nx-nav-btn.is-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--nx-accent);
  border-radius: 0 2px 2px 0;
}
.nx-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nx-text-faint);
  flex: none;
  transition: background-color .2s, box-shadow .2s;
}
.nx-nav-btn:hover .nx-nav-dot {
  background: var(--nx-text-mid);
}
.nx-nav-btn.is-active .nx-nav-dot {
  background: var(--nx-accent);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}

/* nav-icon (inline SVG, 16x16) — gestyled via currentColor zodat kleur
   de text-kleur volgt (mid-gray normaal, goud bij active) */
.nx-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--nx-text-faint);
  transition: color .18s;
}
.nx-nav-icon svg { width: 100%; height: 100%; display: block; }
.nx-nav-btn:hover .nx-nav-icon { color: var(--nx-text-hi); }
.nx-nav-btn.is-active .nx-nav-icon { color: var(--nx-accent-hi, #f0d06a); }
.nx-nav-btn.is-active .nx-nav-icon svg [fill="currentColor"] { fill: currentColor; }

.nx-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* sidebar foot */
.nx-sidebar-foot {
  margin-top: auto;
  padding: 10px 16px;
  border-top: 1px solid var(--nx-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--nx-font-mono);
  font-size: 0.62rem;
  color: var(--nx-text-faint);
  flex: 0 0 auto;
}
#nx-sidebar-time { letter-spacing: 0.08em; }
.nx-sidebar-home {
  color: var(--nx-text-faint);
  text-decoration: none;
  font-size: 0.9rem;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--nx-border);
  transition: border-color .2s, color .2s;
}
.nx-sidebar-home:hover {
  color: var(--nx-accent);
  border-color: var(--nx-accent);
}

/* ── TABLET (721-1100px) ──
   Auto-collapsed 56px (geen toggle-state nodig; burger is hier
   niet functioneel omdat 56px-icon-mode is de canonieke UX voor tablet).
   We verbergen de burger op tablet om visuele ruis te vermijden. */
@media (max-width: 1100px) and (min-width: 721px) {
  .nx-sidebar { width: 56px; }
  .nx-main { margin-left: 56px; min-height: calc(100vh - 60px); max-width: calc(100vw - 56px); }
  .nx-sidebar-head { padding: 14px 8px 10px; }
  .nx-sidebar-title { font-size: 0; }
  .nx-sidebar-title::before { width: 22px; height: 22px; }
  .nx-sidebar-sub, .nx-sidebar-rule { display: none; }
  .nx-nav-label { display: none; }
  .nx-nav-btn { justify-content: center; padding: 8px; }
  .nx-sidebar-section-title { justify-content: center; padding: 4px; font-size: 0; }
  .nx-sidebar-section-title::before { margin: 0 auto; width: 8px; height: 8px; }
  .nx-sidebar-foot { padding: 10px 8px; font-size: 0; }
  #nx-sidebar-time { display: none; }
  .nx-burger { display: none; }    /* tablet: geen toggle, canonieke 56px-mode */
}

/* ── MOBILE OVERLAY (≤720px) ──
   Sidebar wordt een overlay die in/uit schuift. Bij .is-open: translateX(0) + schaduw. */
@media (max-width: 720px) {
  .nx-sidebar {
    width: 268px;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.8,.2,1), width 0s;
    border-right: 1px solid var(--nx-border);
    box-shadow: 0 0 0 transparent;
  }
  .nx-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 12px 0 48px rgba(0, 0, 0, 0.55);
  }

  /* Labels + titels terug in de overlay */
  .nx-nav-label { display: inline; }
  .nx-nav-btn { justify-content: flex-start; padding: 9px 12px; }
  .nx-sidebar-head { padding: 18px 16px 14px; }
  .nx-sidebar-title { font-size: 1.05rem; }
  .nx-sidebar-title::before { width: 18px; height: 18px; }
  .nx-sidebar-sub, .nx-sidebar-rule { display: block; }
  .nx-sidebar-section-title { justify-content: flex-start; padding: 4px 8px 6px; font-size: 0.58rem; }
  .nx-sidebar-section-title::before { width: 4px; height: 4px; margin: 0; }
  .nx-sidebar-foot { padding: 10px 16px; font-size: 0.62rem; }
  #nx-sidebar-time { display: inline; }

  /* Main: full width (sidebar zweeft eroverheen) */
  .nx-main { margin-left: 0; max-width: 100%; min-height: calc(100vh - 60px); }

  /* Body lock bij open menu */
  body.nx-sidebar-open { overflow: hidden; }
}

/* Backdrop: pseudo-element achter de sidebar die de main dimt.
   Alleen actief op mobiel wanneer het menu open is. */
.nx-sidebar::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 10, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: -1;
}
@media (max-width: 720px) {
  .nx-sidebar.is-open::after { opacity: 1; pointer-events: auto; }
}

/* Reduced motion: direct switch, geen animatie */
@media (prefers-reduced-motion: reduce) {
  .nx-sidebar,
  .nx-main,
  .nx-burger > span { transition: none !important; }
}

/* ────────── Globale search overlay (Cmd+K, 4 aug 2026) ────────── */
.nx-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(5, 5, 10, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}
.nx-search-overlay.open { opacity: 1; pointer-events: auto; }
.nx-search-box {
  width: min(640px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: #12121c;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.nx-search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.nx-search-ico { font-size: 1.1rem; color: #9a94a6; }
.nx-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #f2eef8;
  font-family: inherit;
  font-size: .95rem;
}
.nx-search-input::placeholder { color: #6d6878; }
.nx-search-kbd {
  flex: none;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .58rem;
  color: #9a94a6;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  padding: 3px 7px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nx-search-results {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nx-search-hint {
  padding: 18px 16px;
  font-size: .76rem;
  color: #6d6878;
  text-align: center;
  font-family: ui-monospace, Menlo, monospace;
}
.nx-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}
.nx-search-item.active { background: rgba(212, 175, 55, 0.09); border-color: rgba(212, 175, 55, 0.35); }
.nx-search-ico2 { flex: none; width: 22px; text-align: center; font-size: .9rem; }
.nx-search-body { flex: 1; min-width: 0; }
.nx-search-title {
  display: block;
  font-size: .82rem;
  color: #f2eef8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nx-search-sub {
  display: block;
  font-size: .64rem;
  color: #8a8596;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nx-search-type {
  flex: none;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .56rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #b39ce8;
  background: rgba(138, 95, 214, 0.14);
  padding: 2px 7px;
  border-radius: 4px;
}
body.nx-search-open { overflow: hidden; }
