/* ───── General Layout ───── */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: sans-serif;
}

/* ───── Code Formatting ───── */
code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95em;
  background-color: #f5f5f5;
  padding: 2px 4px;
  border-radius: 3px;
  color: #333;
}

/* ───── Interactive Legend Styles ───── */
.legend-category {
  transition: all 0.2s ease;
  user-select: none;
  padding: 2px 4px;
  margin: 2px -4px;
  border-radius: 3px;
}

.legend-category:hover {
  opacity: 0.7;
  background-color: rgba(0, 0, 0, 0.05);
}

.legend-category.disabled {
  opacity: 0.3;
}

.legend-category.disabled .legend-color {
  opacity: 0.3;
  border-color: #999 !important;
}

.legend-category.disabled .legend-text {
  text-decoration: line-through;
  color: #999;
}

.legend-subcategory {
  margin-left: 20px;
  font-size: 11px;
}

/* ───── Tab Styles ───── */
.tab-button {
  transition: all 0.2s ease;
}

.tab-button:hover {
  background: #e0e0e0 !important;
}

.tab-button.active {
  background: #f0f0f0 !important;
  font-weight: bold;
}

.tab-content {
  transition: opacity 0.2s ease;
}

/* ───── Popup Styles ───── */
/* Feature-Popups (Standard-maplibre-Popup) — dezent gerundet, passend zum Panel */
.maplibregl-popup-content {
  border-radius: 14px;
  border: 1px solid #e3e5e9;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  padding: 12px 14px;
}

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

/* ────────────── Legend Style ────────────── */

.legend-heading {
  font-size: 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-heading img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.legend-subtext {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
}

.legend-subtext a {
  color: #0066cc;
  text-decoration: none;
  border-bottom: 1px solid #0066cc;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.legend-subtext a:hover {
  color: #004499;
  border-bottom-color: #004499;
}

.info-icon {
  display: inline-block;
  font-size: 14px;
  cursor: help;
  color: #555;
  line-height: 1;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.info-icon:hover {
  opacity: 1;
}

.legend {
  position: absolute;
  top: 60px;
  right: 10px;
  width: 320px;
  max-width: 100%;
  max-height: calc(100dvh - 160px);
  /* 60 top + 80 bottom */
  /* background: rgb(254, 253, 255); */
  background: white;
  padding: 10px;
  font-size: 12px;
  border-radius: 14px;
  border: 1px solid #e3e5e9;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  /* overflow-y: auto; */
  overflow-y: scroll;
  scrollbar-gutter: stable;
}


.legend .legend-title .info-icon {
  font-size: 14px;
  cursor: help;
  color: #555;
}

.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 6px;
  cursor: pointer;
  gap: 12px;
  min-height: 48px;
}

.legend-header label {
  font-size: 12px;
}


.legend-section-divider {
  border-top: 1px solid #ccc;
  margin: 12px 0 6px;
}

.legend-subsection-divider {
  border-top: 1px solid #ddd;
  margin: 2px 0;
  margin-left: 16px;
  /* Einrückung nach rechts */
  width: calc(100% - 16px);
  /* Optional: macht's proportional */
}

/* Items and layout */
.legend-items {
  margin-left: 8px;
}

.legend-items.collapsed {
  display: none;
}


.legend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.label-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  /* ← This is the key part */
  min-width: 0;
  /* prevents overflow on long labels */
}


/* .legend-section {
    margin-top: 10px;
} */



.legend-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 6px;
  color: #333;
  cursor: pointer;
  gap: 6px;
}

.legend-section-title label {
  display: flex;
  align-items: center;
  gap: 6px;
}



.legend.collapsed>.legend-section {
  display: none;
}






/* ─────  ───── */
.color-box {
  width: 14px;
  height: 14px;
  display: inline-block;
  border-radius: 2px;
}



/* ───── Count Badges ───── */

.count-badge {
  font-size: 10px;
  padding: 0 4px;
  background: #eee;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
  white-space: nowrap;
  color: #333;
  display: inline-block;
  flex-shrink: 0;
}

/* ───── Toggle Arrows ───── */

/* Basis-Pfeil-Logik */
.toggle-arrow {
  display: inline-block;
  transform: rotate(135deg);
  transition: transform 0.2s ease;
}

/* Offener Zustand */
.toggle-arrow.open {
  transform: rotate(45deg);
}

/* Großer Root-Pfeil (nur bei legend-root) */
[data-arrow="legend-root"] {
  width: 14px !important;
  height: 14px !important;
  border-right: 5px solid #000 !important;
  border-bottom: 5px solid #000 !important;
  margin-left: auto;
  cursor: pointer !important;
  z-index: 1000 !important;
  position: relative !important;
  flex-shrink: 0 !important;
}

/* Mittlere Section-Pfeile */
.section-arrow {
  width: 10px;
  height: 10px;
  border-right: 4px solid #000;
  border-bottom: 4px solid #000;
  margin-left: 8px;
}

/* Kleine Pfeile bei legend-header */
.legend-header .toggle-arrow {
  width: 6px;
  height: 6px;
  border-right: 3px solid #000;
  border-bottom: 3px solid #000;
  margin-left: 6px;
}



/* Einklappbare Sektionen */
.legend-section.collapsed .legend-section-content {
  display: none;
}




/* ───── Hidden Section Defaults ───── */
#mapillary-legend,
#movebis-legend,
#hvs-legend,
#maxspeed-legend,
#obs-legend,
#schools-legend {
  display: none;
}




/* ────────────── Feature Count ────────────── */

#feature-count {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.3;
}

#feature-count-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}


/* ────────────── zoomlock ────────────── */
.zoom-lock {
  font-size: 0.8em;
  vertical-align: middle;
  opacity: 0.8;
}

/* ────────────── Photon Geocoder ────────────── */
.geocoder {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 7;
  width: 320px;
  max-width: calc(100vw - 24px);
  font-family: sans-serif;
}

.geocoder-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px);
}
.geocoder-input-wrapper:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14), 0 10px 28px rgba(15, 23, 42, 0.18);
}

#search {
  width: 100%;
  padding: 11px 38px 11px 40px;
  font-size: 14px;
  border: none;
  outline: none;
  background: transparent;
  color: #111827;
  box-sizing: border-box;
}
#search::placeholder { color: #64748b; }

.geocoder-icon {
  position: absolute;
  left: 12px;
  color: #64748b;
  pointer-events: none;
}

.geocoder-clear,
.geocoder-loading {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #64748b;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  border-radius: 8px;
}
.geocoder-clear:hover { background: #eef2f7; }
.geocoder-loading {
  pointer-events: none;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.geocoder-results {
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  display: none;
}
.geocoder-result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #d9e2ec;
}
.geocoder-result-item:last-child { border-bottom: none; }
.geocoder-result-item:hover,
.geocoder-result-item.selected { background: #eef2f7; }
.geocoder-result-primary {
  font-size: 14px;
  color: #111827;
  font-weight: 600;
}
.geocoder-result-secondary,
.geocoder-no-results {
  font-size: 12px;
  color: #64748b;
}
.geocoder-no-results { padding: 10px 12px; }

/* ───── Container Bottom Left ───── */
/* ───── Bottom-Left: Navigation + Karten-Panel (keyless) ───── */
#bottom-left-ui-container {
  position: absolute;
  bottom: 64px;            /* angehoben: Platz für den Karten-Panel-Button darunter */
  left: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  z-index: 2;
  font-family: sans-serif;
}

/* Nav (Zoom/Kompass) als 44px-Kacheln, passend zum Karten-Panel-Button */
#custom-nav-control .maplibregl-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 44px;
  background: transparent;
  border: none;
  box-shadow: none;
}
#custom-nav-control .maplibregl-ctrl-group button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e3e5e9;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.map-settings-toggle {
  position: absolute; left: 10px; bottom: 10px; z-index: 6;
  width: 44px; height: 44px; border-radius: 12px;
  background: #fff; border: 1px solid #e3e5e9;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  display: inline-flex; align-items: center; justify-content: center;
  color: #4b5563; padding: 0; cursor: pointer;
}
.map-settings-toggle:hover { background: #f3f4f6; }

.map-settings-panel {
  position: absolute; left: 10px; bottom: 64px; width: 300px;
  max-width: calc(100vw - 32px);
  background: #fff; border-radius: 16px; border: 1px solid #e3e5e9;
  box-shadow: 0 14px 40px rgba(0,0,0,.18); z-index: 5; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.map-settings-panel.is-collapsed { display: none; }
.map-settings-panel-content { display: flex; flex-direction: column; gap: 10px; }

.basemap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.basemap-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 6px; border: 1px solid transparent; border-radius: 10px;
  background: #f9fafb; cursor: pointer;
}
.basemap-btn:hover { background: #f3f4f6; }
.basemap-btn.selected { border-color: #1d4ed8; background: #eef2ff; }
.basemap-preview {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 8px;
  background-size: cover; background-position: center; background-color: #e5e7eb;
}
.basemap-preview-positron  { background-color: #eef3f7; background-image: url('./thumbs/thumb-standard.png'); }
.basemap-preview-osm       { background-color: #f5f1df; background-image: url('./thumbs/thumb-osm.png'); }
.basemap-preview-satellite { background-color: #516146; background-image: url('./thumbs/thumb-satellite.png'); }
.basemap-label { font-size: 11px; color: #4b5563; }

.terrain-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.terrain-row strong { font-size: 13px; }
.terrain-row p { margin: 2px 0 0; font-size: 11px; color: #6b7280; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; cursor: pointer; background: #cbd5e1;
  border-radius: 22px; transition: .2s;
}
.switch-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .switch-slider { background: #1d4ed8; }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }



/* ─── ─── */




.legend-section-subtitle {
  font-weight: 600;
  font-size: 12px;
  margin: 12px 10px 4px 10px;
  color: #333;
}