/* =====================================================================
   Energy Viewer – Global Styles (Dark Theme)
   ===================================================================== */

:root {
  /* Dark theme palette */
  --bg-primary: #0f1117;
  --bg-secondary: #161b27;
  --bg-card: #1e2537;
  --bg-card-hover: #252d42;
  --border: #2a3352;
  --border-light: #3a4468;

  --text-primary: #e8eaf0;
  --text-secondary: #8b93b0;
  --text-muted: #545d7a;

  --accent: #4f8ef7;
  --accent-hover: #6ba3ff;

  /* Energy type colors (matches backend color map) */
  --color-solar: #f59e0b;
  --color-wind: #3b82f6;
  --color-biomasse: #22c55e;
  --color-wasser: #06b6d4;
  --color-konventionell: #6b7280;
  --color-geothermie: #ef4444;
  --color-speicher: #8b5cf6;
  --color-kern: #ec4899;
  --color-all: #94a3b8;

  /* Layout */
  --panel-left-width: 280px;
  --sidebar-width: 380px;
  --header-height: 0px;
}

/* ── Reset & Base ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

/* ── App Layout ─────────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Left Panel (Filter) ────────────────────────────────────────────── */
#panel-left {
  width: var(--panel-left-width);
  min-width: var(--panel-left-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  z-index: 10;
}

.panel-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-logo-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 2px;
  line-height: 1;
}

.panel-logo h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
}

.panel-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-search-section {
  padding: 12px 14px;
}

/* ── Gebietssuche ──────────────────────────────────────────────────── */
.search-container {
  position: relative;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  transition: border-color 0.15s;
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

#region-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 12.5px;
  min-width: 0;
}

#region-search-input::placeholder {
  color: var(--text-muted);
}

/* Clear button from browser */
#region-search-input::-webkit-search-cancel-button {
  filter: invert(0.6);
  cursor: pointer;
}

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  max-height: 280px;
  overflow-y: auto;
}

.search-dropdown.visible {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  cursor: pointer;
  transition: background 0.1s;
  gap: 8px;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--bg-card-hover);
}

.search-result-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-level {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-no-results {
  padding: 12px 13px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.panel-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Radio-button groups */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}

.radio-option:hover {
  background: var(--bg-card-hover);
}

.radio-option input[type="radio"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  flex-shrink: 0;
  transition:
    border-color 0.12s,
    background 0.12s;
  cursor: pointer;
}

.radio-option input[type="radio"]:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 142, 247, 0.25);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  flex: 1;
}

.radio-option input[type="radio"]:checked ~ .radio-label {
  color: var(--text-primary);
  font-weight: 500;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Metric toggle */
.metric-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 0;
}

.metric-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
  text-align: center;
}

.metric-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ── Map Container ──────────────────────────────────────────────────── */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* Overlay when zoom too low for Anlagen – no longer used, kept for safety */
#zoom-overlay {
  display: none !important;
}

/* Unified status bar for plant-layer messages (capacity filter + zoom hints) */
#capacity-info {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  border-radius: 6px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition:
    border-color 0.2s,
    background 0.2s;
  /* default: filter style (gold) */
  background: rgba(20, 20, 30, 0.82);
  border: 1px solid rgba(255, 215, 0, 0.35);
}

/* Zoom-hint style (grey) */
#capacity-info[data-type="zoom"] {
  border-color: var(--border);
  background: var(--bg-card);
}

#capacity-info svg {
  flex-shrink: 0;
}

/* default: show info icon, hide zoom icon */
#capacity-info .icon-zoom {
  display: none;
}
#capacity-info[data-type="zoom"] .icon-filter {
  display: none;
}
#capacity-info[data-type="zoom"] .icon-zoom {
  display: block;
  color: var(--text-muted);
}

#capacity-info-text {
  font-size: 12px;
  font-weight: 500;
  /* default: gold */
  color: #ffd700;
}

#capacity-info[data-type="zoom"] #capacity-info-text {
  color: var(--text-secondary);
  font-weight: 400;
}

/* Map loading spinner */
#map-loading {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#map-loading.visible {
  opacity: 1;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Right Sidebar (KPI) ────────────────────────────────────────────── */
#sidebar {
  width: 0;
  min-width: 0;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow: hidden;
  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

#sidebar.open {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
}

#sidebar-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding: 0;
}

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 2;
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 12px;
}

.sidebar-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-card);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.12s,
    color 0.12s;
}

.sidebar-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Generischer Sidebar-Action-Button (z.B. Teilen) */
.sidebar-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-card);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.12s,
    color 0.12s;
}

.sidebar-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Toast-Benachrichtigung für kopierten Link */
#share-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

#share-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* KPI Cards Grid */
.kpi-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px 18px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.kpi-card.full {
  grid-column: 1 / -1;
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 3px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Chart sections */
.sidebar-chart-section {
  padding: 0 18px 16px;
}

.sidebar-chart-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* PV Subtypen */
.pv-subtype-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 0;
}

.footnote-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 10px;
  width: 16px;
  height: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    color 0.1s,
    border-color 0.1s;
}

.footnote-btn:hover {
  color: var(--text-secondary);
  border-color: var(--border-light);
}

.footnote-box {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.pv-subtype-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pv-subtype-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pv-subtype-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pv-subtype-name {
  font-size: 12px;
  color: var(--text-secondary);
  width: 110px;
  flex-shrink: 0;
}

.pv-subtype-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}

.pv-subtype-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.pv-subtype-pct {
  font-size: 11px;
  color: var(--text-muted);
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}

.chart-wrap {
  position: relative;
  height: 200px;
}

/* Top sub-regions list */
.sub-regions-list {
  padding: 0 18px 20px;
}

.sub-region-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.12s;
}

.sub-region-item:last-child {
  border-bottom: none;
}

.sub-region-item:hover {
  color: var(--accent);
}

.sub-region-rank {
  font-size: 11px;
  color: var(--text-muted);
  width: 18px;
  text-align: right;
  flex-shrink: 0;
}

.sub-region-name {
  flex: 1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-region-bar-wrap {
  width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.sub-region-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

.sub-region-value {
  font-size: 11px;
  color: var(--text-secondary);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}

/* Energy badge */
.energy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* Status indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.active {
  background: #22c55e;
}
.status-dot.pending {
  background: #f59e0b;
}
.status-dot.off {
  background: #6b7280;
}

/* Coords link */
.coords-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}

.coords-link:hover {
  text-decoration: underline;
}

/* Level badge */
.level-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(79, 142, 247, 0.15);
  color: var(--accent);
}

/* ── Choropleth-Legende ─────────────────────────────────────────────── */
#map-legend {
  position: absolute;
  bottom: 32px;
  left: 16px;
  z-index: 4;
  background: rgba(15, 17, 23, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(58, 68, 104, 0.7);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 200px;
  pointer-events: none;
  transition: opacity 0.2s;
}

#map-legend.hidden {
  opacity: 0;
  pointer-events: none;
}

.legend-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.legend-energy-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.legend-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.legend-bar {
  height: 10px;
  border-radius: 4px;
  width: 100%;
  margin-bottom: 4px;
}

.legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Pie Chart Markers (D3/SVG) ─────────────────────────────────────── */
.pie-marker {
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transition: transform 0.15s;
}

.pie-marker:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.8));
}

/* MapLibre marker reset */
.maplibregl-marker {
  cursor: pointer;
}

/* ── Tooltip (MapLibre popup override) ──────────────────────────────── */
.maplibregl-popup-content {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  color: var(--text-primary) !important;
  font-family: inherit !important;
  font-size: 13px !important;
  min-width: 160px;
}

.maplibregl-popup-tip {
  border-top-color: var(--bg-card) !important;
  border-bottom-color: var(--bg-card) !important;
}

.maplibregl-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 16px !important;
  padding: 2px 6px !important;
}

.popup-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 3px;
}

.popup-key {
  font-size: 11px;
  color: var(--text-muted);
}

.popup-val {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Scrollbar styling ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ── MapLibre attribution override ─────────────────────────────────── */
.maplibregl-ctrl-attrib {
  background: rgba(15, 17, 23, 0.75) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
  color: var(--text-muted) !important;
}

/* ── Panel footer ───────────────────────────────────────────────────── */
.panel-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.admin-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  transition:
    background 0.12s,
    color 0.12s;
}

.admin-link:hover {
  background: var(--bg-card);
  color: var(--text-secondary);
}

/* ── Datenquellen-Block ────────────────────────────────────────────── */
.panel-sources {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.panel-sources-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.panel-sources-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.panel-sources-list li {
  font-size: 11px;
  color: var(--text-muted);
}
.panel-sources-list a {
  color: var(--text-muted);
  text-decoration: none;
}
.panel-sources-list a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}
.panel-sources-date {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
  margin: 0;
}

/* ── Utility ────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0 18px;
}

.text-muted {
  color: var(--text-muted);
}
.text-sm {
  font-size: 12px;
}

/* ── Empty state ────────────────────────────────────────────────────── */
.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.empty-state svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ── Checkbox option ────────────────────────────────────────────────── */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}

.checkbox-option:hover {
  background: var(--bg-card-hover);
}

.custom-checkbox {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-light);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.12s,
    background 0.12s;
  position: relative;
}

.custom-checkbox.checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 142, 247, 0.25);
}

.custom-checkbox.checked::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center/contain no-repeat;
}

.checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}

.checkbox-option:has(.checked) .checkbox-label {
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Timeline chart styles ──────────────────────────────────────────── */
.timeline-toggle-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.tl-btn {
  flex: 1;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s;
}

.tl-btn.tl-active {
  background: var(--accent);
  color: #fff;
}

.timeline-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* ── Mobile Navigation Bar ──────────────────────────────────────────── */
:root {
  --mobile-nav-height: 52px;
}

#mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  z-index: 30;
}

#menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.12s,
    color 0.12s;
}

#menu-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.mobile-nav-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* ── Mobile Backdrop ────────────────────────────────────────────────── */
#mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 20;
}

#mobile-backdrop.active {
  display: block;
}

/* ── Mobile Responsive ──────────────────────────────────────────────── */
@media (max-width: 767px) {
  #mobile-nav {
    display: flex;
  }

  #app {
    padding-top: var(--mobile-nav-height);
  }

  /* Left panel: overlay sliding from left */
  #panel-left {
    position: fixed;
    top: var(--mobile-nav-height);
    left: 0;
    bottom: 0;
    width: min(var(--panel-left-width), 88vw);
    min-width: unset;
    transform: translateX(-110%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 25;
    border-right: 1px solid var(--border);
  }

  #panel-left.mobile-open {
    transform: translateX(0);
  }

  /* Right sidebar: slides up from bottom */
  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    min-width: unset !important;
    height: 0;
    max-height: 78vh;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    z-index: 25;
  }

  #sidebar.open {
    height: 78vh;
  }

  /* Drag handle indicator on bottom sheet */
  #sidebar::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 10px auto 4px;
    flex-shrink: 0;
  }

  .kpi-cards {
    grid-template-columns: 1fr 1fr;
    padding: 12px 14px;
    gap: 8px;
  }

  #map-legend {
    left: 8px;
    right: 8px;
    min-width: unset;
    bottom: 20px;
  }
}

@media (max-width: 380px) {
  .kpi-cards {
    grid-template-columns: 1fr;
  }
  .kpi-card.full {
    grid-column: 1;
  }
}

/* ── Anlagen-Standort Picker ────────────────────────────────────────────── */
.plant-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.plant-picker-item:last-child {
  border-bottom: none;
}
.plant-picker-item:hover {
  background: rgba(79, 142, 247, 0.06);
}
.energy-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.plant-picker-info {
  flex: 1;
  min-width: 0;
}
.plant-picker-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plant-picker-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.plant-picker-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}
