/* ── reset ──────────────────────────────────────────────────────────────── */
html, body { margin: 0; height: 100%; overflow: hidden; }
:root {
  --bg-color:       #1a1b26;
  --viz-pane-width: 70%;
  --viz-padding:    20px;
}
body { background: var(--bg-color); }

/* ── split layout ───────────────────────────────────────────────────────── */
#layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
#viz-pane {
  flex: 0 0 var(--viz-pane-width);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
#detail-pane {
  flex: 1;
  overflow-y: auto;
  padding: 72px 28px 32px 0;
  color: #bbb;
  font: 15px/1.7 sans-serif;
}
.detail-empty {
  color: rgba(255,255,255,0.18);
  font-size: 15px;
  text-align: center;
  margin-top: 48px;
  line-height: 1.8;
}

#graph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

/* ── overlay container ──────────────────────────────────────────────────── */
#filters {
  position: absolute;
  top: 14px; left: 14px;
  display: flex; gap: 20px; align-items: flex-start;
  z-index: 10;
  pointer-events: none; /* pass clicks through to the canvas behind */
}
.nav-link:not(.nav-active), .chip, #menu-btn, .nav-menu { pointer-events: auto; }

/* ── nav ────────────────────────────────────────────────────────────────── */
.nav-stack { display: flex; flex-direction: column; gap: 14px; }
.nav-link {
  font: 14px sans-serif;
  color: rgba(255,255,255,0.35);
  text-decoration: none;
  padding: 5px 12px;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.35); }
.nav-active {
  color: rgba(255,255,255,0.75) !important;
  border-color: rgba(255,255,255,0.35) !important;
  pointer-events: none;
}

/* ── chips column (stacked filter chips, parallel to nav-stack) ─────────── */
.chips-col { display: flex; flex-direction: column; gap: 6px; }

/* ── filter chips ───────────────────────────────────────────────────────── */
.chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; border: 1.5px solid;
  font: 14px sans-serif; cursor: pointer; user-select: none;
  transition: opacity 0.15s;
}
.chip.off { opacity: 0.3; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── legend (static, non-interactive) ──────────────────────────────────── */
.legend { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font: 13px sans-serif;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid;
  user-select: none;
}
.legend-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── info panel (azure-deployments overlay; index.html uses #detail-pane) ── */
#info-panel {
  position: fixed;
  top: 14px; right: 14px;
  width: 280px;
  background: rgba(26,27,38,0.92);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 14px 16px;
  z-index: 10;
  pointer-events: none;
  font: 15px/1.6 sans-serif;
}
.info-id {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555;
  margin-bottom: 10px;
}
.info-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #555;
  margin: 10px 0 3px;
}
.info-text { margin: 0; color: #bbb; }

/* ── code block (syntax-highlighted <pre> in info panel) ───────────────── */
.code-block {
  margin: 4px 0 0; padding: 10px 12px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  font-family: monospace; font-size: 12px; line-height: 1.6;
  color: #e2e8f0; white-space: pre; overflow-x: auto;
}

/* ── info panel extras ──────────────────────────────────────────────────── */
.info-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-family: monospace;
  color: #1a1b26;
  margin-top: 2px;
}

/* ── theme toggle ───────────────────────────────────────────────────────── */
.theme-toggle {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 5px 12px;
  font: 16px sans-serif;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
}
.theme-toggle:hover { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.35); }

/* ── light theme ─────────────────────────────────────────────────────────── */
[data-theme="light"] { --bg-color: #f5f1e8; }
[data-theme="light"] body { background: var(--bg-color); }

[data-theme="light"] #detail-pane { color: #444; }
[data-theme="light"] .detail-empty { color: rgba(0,0,0,0.2); }
[data-theme="light"] .info-id    { color: #999; }
[data-theme="light"] .info-label { color: #999; }
[data-theme="light"] .info-text  { color: #555; }

[data-theme="light"] .nav-link {
  color: rgba(30,30,50,0.55);
  border-color: rgba(30,30,50,0.15);
}
[data-theme="light"] .nav-link:hover {
  color: rgba(30,30,50,0.85);
  border-color: rgba(30,30,50,0.4);
}
[data-theme="light"] .nav-active {
  color: rgba(30,30,50,0.85) !important;
  border-color: rgba(30,30,50,0.4) !important;
}

[data-theme="light"] .search-input {
  background: rgba(30,30,50,0.06);
  border-color: rgba(30,30,50,0.15);
  color: rgba(30,30,50,0.8);
}
[data-theme="light"] .search-input::placeholder { color: rgba(30,30,50,0.3); }
[data-theme="light"] .search-input:focus { border-color: rgba(30,30,50,0.4); }
[data-theme="light"] .search-dropdown {
  background: rgba(245,241,232,0.98);
  border-color: rgba(30,30,50,0.12);
}
[data-theme="light"] .search-result { color: rgba(30,30,50,0.65); }
[data-theme="light"] .search-result:hover {
  background: rgba(30,30,50,0.06);
  color: rgba(30,30,50,0.9);
}

[data-theme="light"] .theme-toggle {
  background: rgba(30,30,50,0.06);
  border-color: rgba(30,30,50,0.15);
  color: rgba(30,30,50,0.65);
}
[data-theme="light"] .theme-toggle:hover {
  color: rgba(30,30,50,0.9);
  border-color: rgba(30,30,50,0.4);
}

/* ── search box ─────────────────────────────────────────────────────────── */
.search-box { position: relative; }
.search-input {
  width: 160px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 5px 12px;
  font: 14px sans-serif;
  color: rgba(255,255,255,0.75);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.search-input::placeholder { color: rgba(255,255,255,0.25); }
.search-input:focus { border-color: rgba(255,255,255,0.35); }
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px); left: 0;
  min-width: 100%;
  background: rgba(22,23,34,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow-y: auto;
  max-height: 200px;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.search-result {
  padding: 6px 12px;
  font: 14px sans-serif;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.search-result:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }

/* ── hamburger button (mobile only) ─────────────────────────────────────── */
#menu-btn { display: none; }

/* ── nav-menu: transparent wrapper on desktop ───────────────────────────── */
.nav-menu { display: contents; }

/* ── detail pane collapse button (desktop) ──────────────────────────────── */
#detail-collapse-btn {
  position: absolute;
  right: 6px; top: 14px;
  width: 20px; height: 40px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  z-index: 5;
}
#detail-collapse-btn:hover {
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
}
#detail-collapse-btn::before { content: '›'; }
#layout[data-detail-hidden] #detail-collapse-btn::before { content: '‹'; }

[data-theme="light"] #detail-collapse-btn {
  background: rgba(30,30,50,0.06);
  border-color: rgba(30,30,50,0.12);
  color: rgba(30,30,50,0.4);
}
[data-theme="light"] #detail-collapse-btn:hover {
  color: rgba(30,30,50,0.85);
  border-color: rgba(30,30,50,0.3);
  background: rgba(30,30,50,0.1);
}

/* collapsed state */
#layout[data-detail-hidden] #detail-pane { display: none; }
#layout[data-detail-hidden] #viz-pane { flex: 1 1 100%; }

/* ── detail pane toggle (hidden on desktop) ─────────────────────────────── */
#detail-toggle { display: none; }

/* ── mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* graph fills the full viewport; detail pane overlays as a bottom sheet */
  #layout { flex-direction: column; }
  #viz-pane {
    flex: 0 0 100vh;
    overflow: visible; /* allow the nav dropdown to escape the container */
  }

  #detail-collapse-btn { display: none; }

  /* ── hamburger button ───────────────────────────────────────────────── */
  #menu-btn {
    display: flex;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: rgba(26,27,38,0.88);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 18px;
    cursor: pointer; flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
  }
  #menu-btn:active { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.3); }

  /* ── nav dropdown ───────────────────────────────────────────────────── */
  #filters { z-index: 20; gap: 10px; flex-wrap: nowrap; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 52px; left: 0;
    flex-direction: column; gap: 10px;
    min-width: 190px;
    background: rgba(22,23,34,0.97);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 20;
  }
  #filters.menu-open .nav-menu { display: flex; }
  .nav-menu .nav-stack { gap: 6px; }
  .nav-menu .nav-link,
  .nav-menu .chip { padding: 8px 14px; font-size: 15px; }
  .nav-menu .search-box { width: 100%; }
  .nav-menu .search-input { width: 100%; font-size: 15px; padding: 8px 14px; }
  .nav-menu .theme-toggle { width: 100%; font-size: 15px; padding: 8px 14px; text-align: left; box-sizing: border-box; }

  [data-theme="light"] #menu-btn {
    background: rgba(245,241,232,0.92);
    border-color: rgba(30,30,50,0.15);
    color: rgba(30,30,50,0.65);
  }
  [data-theme="light"] .nav-menu {
    background: rgba(245,241,232,0.98);
    border-color: rgba(30,30,50,0.1);
  }
  [data-theme="light"] #detail-pane {
    background: rgba(245,241,232,0.98);
    border-color: rgba(30,30,50,0.08);
  }

  /* ── bottom sheet ───────────────────────────────────────────────────── */
  #detail-pane {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 75vh;
    padding: 0 20px 40px;
    background: rgba(22,23,34,0.97);
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    z-index: 15;
  }
  #layout[data-panel-dismissed] #detail-pane { transform: translateY(100%); }

  /* ── drag handle / dismiss button ──────────────────────────────────── */
  #detail-toggle {
    display: flex;
    align-items: center; justify-content: center;
    width: 100%; height: 40px;
    background: rgba(22,23,34,0.97);
    border: none;
    cursor: pointer;
    position: sticky; top: 0;
    z-index: 1;
    margin-bottom: 4px;
    flex-shrink: 0;
  }
  #detail-toggle::before {
    content: '✕';
    display: flex;
    align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    font-size: 16px;
    transition: background 0.15s, color 0.15s;
  }
  #detail-toggle:active::before { 
    background: rgba(255,255,255,0.2); 
    color: rgba(255,255,255,0.8); 
  }
}
