/* tree-nav.css — Professional sidebar navigation */

/* Keep the shared sidebar geometry identical on every page. */
.sidebar { width: 280px; min-width: 280px; flex: 0 0 280px; display: flex; flex-direction: column; background: var(--bg2); border-right: 1px solid var(--border); overflow: hidden; }
.sidebar.collapsed { width: 68px; min-width: 68px; flex-basis: 68px; }

/* Sidebar header (logo / branding) */
.nav-sidebar-header {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; }
.nav-avatar { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.nav-brand-text {
  font-family: var(--font-ui); font-size: 15px; font-weight: 700;
  letter-spacing: 1px; color: var(--text); line-height: 1.3;
}

/* Version footer */
.nav-version {
  padding: 12px 16px; border-top: 1px solid var(--border);
  font-size: 10px; color: var(--text2); text-align: center; line-height: 1.4;
}

/* Workspace sections */
.nav-section { margin-bottom: 4px; }
.nav-ws-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; margin: 2px 4px;
  color: var(--text2); font-size: 18px; font-weight: 500;
  cursor: pointer; border-radius: 8px;
  transition: all 0.15s;
}
.nav-ws-header:hover { background: var(--bg3); color: var(--text); }
.nav-ws-header.ws-active { color: #FFFFFF; background: rgba(201,205,211,0.08); }
.nav-ws-header svg { opacity: 0.5; flex-shrink: 0; width: 18px; height: 18px; }
.nav-ws-header.ws-active svg { opacity: 0.9; }
.nav-ws-arrow { font-size: 11px; width: 14px; text-align: center; flex-shrink: 0; opacity: 0.5; }

/* General nav links (Home/Command Center, Platform, Settings) */
.nav-links { padding: 8px; flex: 1; overflow-y: auto; min-height: 0; }
/* Scrollbalken: Haus-Standard (tokens.css / qril_header_middleware) — 8px breit,
   damit die klassische 16-px-Leiste nicht die halbe Label-Breite kostet.
   Hier KEINE eigenen Breiten/Farben setzen (Gate: test_ui_scrollbar_standard.py). */
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; margin: 2px 4px;
  color: var(--text2); font-size: 18px; font-weight: 500;
  border-radius: 8px; text-decoration: none;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--bg3); color: var(--text); }
.nav-link.active { background: rgba(201,205,211,0.12); color: #FFFFFF; font-weight: 500; }
.nav-link svg { opacity: 0.5; flex-shrink: 0; width: 18px; height: 18px; }
.nav-link.active svg { opacity: 0.9; }
.nav-link:hover svg { opacity: 0.8; }
.nav-label { flex: 1; min-width: 0; }

/* All platform nav labels: single-line, no wrapping */
.nav-platform-agent .nav-label { white-space: nowrap; }
.nav-platform-activity .nav-label,
.nav-platform-notifications .nav-label,
.nav-platform-live-signals .nav-label { white-space: nowrap; }

/* Right-aligned meta group (voice toggle + count badge). Pushed to the far
 * right by .nav-label{flex:1}; the fixed-width badge keeps counts AND toggles
 * vertically aligned across Activity / Notifications / Live Signals. */
.nav-right {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}

/* Activity open-task badge (Unbenannt 7) — fixed slot, count centered. */
.nav-activity-badge {
  display: none; align-items: center; justify-content: center;
  width: 24px; height: 17px; padding: 0;
  border-radius: 9px;
  background: var(--accent, #C9CDD3); color: #0B0D0F;
  font-size: 10px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.nav-link:hover .nav-activity-badge { background: #C9CDD3; }

/* Per-entry voice toggle — compact, fixed slot inside .nav-right. */
.nav-voice-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; padding: 0;
  border: none; background: transparent; border-radius: 5px;
  color: var(--text2); cursor: pointer; flex-shrink: 0; opacity: 0.8;
}
.nav-voice-toggle svg { width: 14px; height: 14px; opacity: 0.55; flex-shrink: 0; }
.nav-voice-toggle .v-on { display: none; }
.nav-voice-toggle .v-off { display: block; }
.nav-voice-toggle.on { opacity: 1; color: var(--accent, #C9CDD3); }
.nav-voice-toggle.on .v-on { display: block; opacity: 1; }
.nav-voice-toggle.on .v-off { display: none; }
.nav-voice-toggle:hover { background: var(--bg3); color: var(--text); }
.sidebar.collapsed .nav-right { display: none; }

/* Collapsed sidebar */
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px 0; gap: 0; }
.sidebar.collapsed .nav-sidebar-header { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-brand-text,
.sidebar.collapsed .nav-version { display: none; }

/* Phase list */
.nav-phase-list { padding: 2px 0 2px 24px; }
/* Phasen-Labels: 16px statt 18px und flachere Kanten-Polsterung. Damit bleibt der
   Unterebenen-Versatz sichtbar (Label beginnt ~18px rechts der Gruppen-Überschrift)
   UND jedes Label passt einzeilig — "Market Data Vault" mit 16px Reserve. */
.nav-phase {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; margin: 1px 2px;
  color: var(--text2); font-size: 16px; font-weight: 500;
  border-radius: 8px; text-decoration: none;
  transition: all 0.15s;
}
.nav-phase:hover { background: var(--bg3); color: var(--text); }
.nav-phase.active { background: rgba(201,205,211,0.12); color: #FFFFFF; font-weight: 500; }
.nav-phase svg { width: 18px; height: 18px; opacity: 0.5; flex-shrink: 0; }
.nav-phase.active svg { opacity: 0.9; }
.nav-phase.placeholder { opacity: 0.4; font-style: italic; }
.nav-ph-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(201,205,211,0.12); color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-left: auto; flex-shrink: 0;
}

/* Dividers */
.nav-divider {
  height: 1px; background: var(--border); margin: 8px 12px;
}
.sidebar.collapsed .nav-divider { display: none; }

/* Collapsed rail: eine Gruppe zeigt nur ihr Icon, ihre Seiten erst nach dem
   Ausfahren der Sidebar. Ein Klick auf das Gruppen-Icon faehrt die Sidebar aus
   und oeffnet diesen Workspace (toggleWorkspace in sidebar_tree.js) — vorher lag
   jede Seite als eigenes Icon im Rail (bei zwei Workspaces 13 Symbole ohne
   sichtbare Gruppierung). No text (labels hidden globally); tooltips via title. */
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .nav-ws-header { display: flex; justify-content: center; padding: 12px 0; margin: 2px 4px; gap: 0; }
.sidebar.collapsed .nav-ws-arrow { display: none; }
.sidebar.collapsed .nav-phase-list { display: none; }
.sidebar.collapsed .nav-phase { justify-content: center; padding: 12px 0; margin: 2px 4px; gap: 0; }
.sidebar.collapsed .nav-phase svg { opacity: 0.5; }
.sidebar.collapsed .nav-phase.active svg { opacity: 0.9; }
/* Im Rail die Scrollleiste ausblenden: sie kostete 11 der 68px Breite und schob
   die Icons ~5px aus der Mitte, weil die drei Bottom-Links (Security/Settings/
   Abmelden) volle Breite haben und ihre Icons exakt mittig sitzen. */
.sidebar.collapsed .nav-links { scrollbar-width: none; }
.sidebar.collapsed .nav-links::-webkit-scrollbar { width: 0; height: 0; }

/* ── Quick Actions (Unbenannt 14) — SYSTEM section action tiles ── */
.qa-section { margin: 2px 4px 8px; }
.qa-header {
  font-size: 10px; font-weight: 600; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--text2); opacity: 0.75;
  padding: 6px 12px 5px; user-select: none;
}
.qa-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px; padding: 4px 8px 2px;
}
.qa-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 11px 4px 10px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text2); text-decoration: none; cursor: pointer;
  font-family: inherit; text-align: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.qa-tile:hover {
  background: var(--bg4); border-color: var(--text2); color: var(--text);
  transform: translateY(-1px);
}
.qa-tile:active { transform: translateY(0); }
.qa-tile:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.qa-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--qa-accent, #C9CDD3); background: var(--qa-soft, rgba(201,205,211,0.08));
  flex-shrink: 0;
}
.qa-icon svg { width: 16px; height: 16px; }
.qa-label {
  font-size: 11px; font-weight: 500; line-height: 1.25;
  color: var(--text); white-space: normal; overflow-wrap: break-word;
  text-align: center; max-width: 100%;
}

/* Collapsed: icon-only single column (Option A, §14) — tooltips via title attr */
.sidebar.collapsed .qa-header { display: none; }
.sidebar.collapsed .qa-grid { grid-template-columns: 1fr; gap: 4px; }
.sidebar.collapsed .qa-tile { padding: 8px 0; }
.sidebar.collapsed .qa-label { display: none; }

/* Breadcrumbs — removed system-wide (Unbenannt 108). Hidden so no empty bar
   / vertical gap is reserved; content uses the freed space. */
.breadcrumbs { display: none; }
.bc-link { color: var(--accent); text-decoration: none; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: var(--text2); font-size: 16px; }
.bc-label { color: var(--text2); }

/* Search overlay */
.search-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
  align-items: flex-start; justify-content: center;
  padding-top: 15vh;
}
.search-modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; width: 560px; max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  overflow: hidden;
}
.search-input-wrap {
  display: flex; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 10px 14px; border-radius: 8px;
  font-size: 16px; outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text2); }

.search-results { max-height: 50vh; overflow-y: auto; }
.search-count { padding: 8px 16px; font-size: 12px; color: var(--text2); border-bottom: 1px solid var(--border); }
.search-hint { padding: 24px 16px; text-align: center; color: var(--text2); font-size: 14px; }
.search-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; text-decoration: none;
  border-bottom: 1px solid rgba(48,54,61,0.3);
  transition: background 0.1s;
}
.search-item:hover { background: var(--bg3); }
.search-type {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(201,205,211,0.1); color: var(--accent);
  text-transform: uppercase; font-weight: 700; white-space: nowrap;
  min-width: 60px; text-align: center;
}
.search-title { font-size: 15px; color: var(--text); font-weight: 500; flex: 1; }
.search-sub { font-size: 13px; color: var(--text2); white-space: nowrap; }

/* Search icon in header */
.search-btn {
  background: none; border: 1px solid var(--border); color: var(--text2);
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; gap: 6px;
}
.search-btn:hover { border-color: var(--accent); color: var(--accent); }
.search-btn-kbd {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg3); border: 1px solid var(--border);
  font-family: var(--font-ui);
}
