/* Geteilte View-Sidebar (createSidebar, docs/js/ui/sidebar.js).
   Gemeinsames Geruest fuer Canvas-Views (Karte, Netzwerk): Filter-Spalte links,
   Canvas-Bereich rechts. Die .vs-*-Klassen stylen die deklarativen Controls;
   view-spezifische Visuals (Karten-SVG, Netzwerk-Knoten) bleiben in den
   jeweiligen View-CSS. Nutzt die Tokens aus variables.css. */

:root {
  --view-sidebar-w: 300px;
}

/* --- Geruest ------------------------------------------------------------- */

.view-shell {
  display: grid;
  grid-template-columns: var(--view-sidebar-w) 1fr;
  height: calc(100vh - 130px);
  min-height: 560px;
}

.view-sidebar {
  background: var(--color-paper);
  border-right: 1px solid var(--border-color-light);
  padding: var(--space-3) var(--space-3) var(--space-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.view-main {
  position: relative;
  min-width: 0; /* Grid-Overflow-Fix: Canvas darf schrumpfen */
  background: var(--color-cream);
}

/* --- Sektion ------------------------------------------------------------- */

.vs-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vs-section--foot { margin-top: auto; }

.vs-section__title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin: 0;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border-color-light);
}

/* --- Legende als Filter (Toggle-Chips) ----------------------------------- */

.vs-legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.vs-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 8px;
  background: var(--color-paper);
  border: 1px solid var(--border-color-light);
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  cursor: pointer;
  text-align: left;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}
.vs-chip:hover { background: var(--color-cream); }
.vs-chip--off { opacity: 0.4; }
.vs-chip--off .vs-chip__swatch { background: var(--color-text-tertiary) !important; }

.vs-chip__swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.vs-chip__label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-chip__count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  flex: none;
}

/* --- Zeit-/Wertefenster (von–bis) ---------------------------------------- */

.vs-range { display: flex; flex-direction: column; gap: 6px; }

.vs-range__readout {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  align-self: flex-end;
}

/* Zwei Daumen auf einer Linie: zwei native Range-Inputs ueberlagert, nur die
   Daumen sind klickbar (pointer-events), die sichtbare Schiene liegt dahinter. */
.vs-range__dual { position: relative; height: 22px; }
.vs-range__rail {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  height: 4px; border-radius: 2px; background: var(--color-parchment);
}
.vs-range__input {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 0;
  background: transparent; pointer-events: none;
  -webkit-appearance: none; appearance: none;
}
.vs-range__input--from { z-index: 2; }
.vs-range__input--to { z-index: 1; }
.vs-range__input:focus { outline: none; }
.vs-range__input::-webkit-slider-runnable-track { height: 22px; background: transparent; }
.vs-range__input::-moz-range-track { height: 22px; background: transparent; }
.vs-range__input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto;
  width: 14px; height: 14px; margin-top: 4px; border-radius: 50%;
  background: var(--color-kug-blau); border: 2px solid var(--color-paper);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); cursor: pointer;
}
.vs-range__input::-moz-range-thumb {
  pointer-events: auto;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--color-kug-blau); border: 2px solid var(--color-paper);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); cursor: pointer;
}

/* --- Einzel-Slider ------------------------------------------------------- */

.vs-slider { display: flex; flex-direction: column; gap: 2px; }
.vs-slider__label { font-size: 11px; color: var(--color-text-secondary); }
.vs-slider__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
}
.vs-slider__input { width: 100%; accent-color: var(--color-kug-blau); cursor: pointer; }
.vs-slider__value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  min-width: 18px;
  text-align: right;
  color: var(--color-text-primary);
}

/* --- Toggle -------------------------------------------------------------- */

.vs-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  cursor: pointer;
  padding: 1px 0;
}
.vs-toggle input { margin: 0; accent-color: var(--color-kug-blau); }

/* --- Suche --------------------------------------------------------------- */

.vs-search {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

/* --- Statische Erklaer-Legende ------------------------------------------- */

.vs-static {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--color-text-primary);
  line-height: 1.4;
}
.vs-static__row {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
}
.vs-static__marker {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  justify-self: center;
  flex-shrink: 0;
}
.vs-static__text { min-width: 0; }
.vs-static__text strong { font-weight: var(--weight-semibold); color: var(--color-text-primary); }
.vs-static__text em { font-style: italic; color: var(--color-text-secondary); }

/* --- Button -------------------------------------------------------------- */

.vs-button {
  background: transparent;
  border: 1px solid var(--border-color-light);
  color: var(--color-text-tertiary);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  width: 100%;
}
.vs-button:hover { background: var(--color-cream); color: var(--color-text-primary); }
.vs-button--foot { margin-top: auto; }

.vs-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.vs-buttons__btn {
  flex: 1 1 auto;
  background: var(--color-paper);
  border: 1px solid var(--border-color-light);
  color: var(--color-text-secondary);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.vs-buttons__btn:hover { background: var(--color-cream); color: var(--color-text-primary); }

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
  .view-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: unset;
  }
  .view-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color-light);
    max-height: 50vh;
  }
  .view-main {
    height: 70vh;
    min-height: 480px;
  }
}
