/* Kartenseite: Karte füllt den Platz unter der Kopfzeile, Legende schwebt darüber. */

.seite-karte .site-main { position: relative; display: flex; }
.karte { flex: 1; min-height: calc(100dvh - var(--header-height)); background: #111; }

.legende {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 2;
  width: min(20rem, calc(100% - 2 * var(--space-sm)));
  padding: var(--space-sm) 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 0.75rem 1.75rem rgba(4, 10, 18, 0.45);
}
.legende__titel { font-family: var(--font-display); font-size: 1.25rem; font-weight: 400; line-height: 1.2; }
.legende__kopf { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
/* Ein-/Ausklappen nur auf schmalen Schirmen (unten) */
.legende__klappe {
  display: none;
  flex: none;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
/* Punktgröße Bestand nach Leistung (static/js/grundkarte.js, SCHNELL_KW) */
.leistung-skala { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; margin: 0.15rem 0 0.2rem 1.6rem; padding: 0; list-style: none; color: var(--text-muted); font-size: 0.75rem; }
.leistung-skala li { display: flex; align-items: center; gap: 0.35rem; }
.leistung-skala__punkt { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--c-light-blue); border: 1px solid var(--c-white); }
.leistung-skala__punkt--gross { width: 0.75rem; height: 0.75rem; border-width: 2px; }
[data-thema="hell"] .leistung-skala__punkt { background: var(--c-petrol-blue); border-color: var(--c-light-blue); }
.legende__liste { list-style: none; padding: 0; margin-top: 0.75rem; display: grid; gap: 0.35rem; }
.legende__ebene { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; line-height: 1.25; }
.legende__ebene input { accent-color: var(--c-light-blue); width: 1rem; height: 1rem; flex: none; }
.legende__ebene strong { display: block; font-weight: 600; }
.legende__ebene small { display: block; color: var(--text-muted); font-size: 0.8125rem; }
.legende__ebene--aus { cursor: default; opacity: 0.6; }

.legende__symbol { flex: none; width: 1rem; height: 1rem; border-radius: 50%; }
.legende__symbol--bestand { background: var(--c-light-blue); border: 2px solid var(--c-white); }
.legende__symbol--geplant { border: 3px solid #8cc6d8; }
[data-thema="hell"] .legende__symbol--bestand { background: var(--c-petrol-blue); border-color: var(--c-light-blue); }
[data-thema="hell"] .legende__symbol--geplant { border-color: var(--c-light-blue); }
/* Bedarf je Landkreis (static/js/bedarf.js): Farben = PALETTE dort, auf einem Stück „Grundkarte“ */
.legende__symbol--bedarf { border-radius: 0.2rem; background: rgba(238, 143, 73, 0.66); border: 1px solid #f6b27a; }
[data-thema="hell"] .legende__symbol--bedarf { background: rgba(226, 74, 27, 0.62); border-color: #8f2c0c; }
.legende__ebene small[hidden] { display: none; }
.bedarf-skala { margin: 0.35rem 0 0.15rem 1.6rem; font-size: 0.75rem; color: var(--text-muted); }
.bedarf-skala[hidden] { display: none; }
.bedarf-skala__band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0.3rem 0.45rem;
  border-radius: var(--radius-sm, 0.35rem);
  background: #0b0b0b;
  color: #d8d8d8;
  font-variant-numeric: tabular-nums;
}
.bedarf-skala__band li { display: flex; align-items: center; gap: 0.3rem; }
.bedarf-skala__feld { flex: none; width: 1rem; height: 0.8rem; border: 1px solid rgba(246, 178, 122, 0.85); }
.bedarf-skala__feld--1 { background: rgba(122, 46, 18, 0.5); }
.bedarf-skala__feld--2 { background: rgba(201, 68, 26, 0.58); }
.bedarf-skala__feld--3 { background: rgba(238, 143, 73, 0.66); }
.bedarf-skala__feld--4 { background: rgba(255, 192, 138, 0.76); }
[data-thema="hell"] .bedarf-skala__band { background: #e4e4e4; color: #333; }
[data-thema="hell"] .bedarf-skala__feld { border-color: rgba(143, 44, 12, 0.85); }
[data-thema="hell"] .bedarf-skala__feld--1 { background: rgba(244, 210, 187, 0.6); }
[data-thema="hell"] .bedarf-skala__feld--2 { background: rgba(240, 167, 116, 0.62); }
[data-thema="hell"] .bedarf-skala__feld--3 { background: rgba(226, 74, 27, 0.62); }
[data-thema="hell"] .bedarf-skala__feld--4 { background: rgba(143, 44, 12, 0.68); }
.bedarf-skala__einheit { margin: 0.1rem 0.45rem 0; }

.legende__fuss { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.legende__thema {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.legende__thema:hover { border-color: var(--c-light-blue); }
.legende__quelle { margin-top: 0.6rem; color: var(--text-muted); font-size: 0.75rem; line-height: 1.45; }
.legende__quelle a { color: var(--accent); }

.karte__hinweis { position: absolute; inset: auto 0 50% 0; text-align: center; }

/* Infofenster */
.maplibregl-popup-content {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.45;
  box-shadow: 0 0.5rem 1.25rem rgba(4, 10, 18, 0.5);
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--bg); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--bg); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--bg); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--bg); }
.maplibregl-popup-close-button { color: var(--text-muted); font-size: 1.1rem; padding: 0 0.4rem; }
.popup__art { color: var(--c-light-blue); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }
.popup__name { font-weight: 600; font-size: 1rem; margin: 0.1rem 0 0.4rem; padding-right: 1rem; }
.popup__daten { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.75rem; }
.popup__daten dt { color: var(--text-muted); }
.popup__daten dd { margin: 0; }

.maplibregl-ctrl-attrib { font-family: var(--font-body); }

@media (max-width: 40rem) {
  .legende { top: auto; bottom: 2.75rem; left: var(--space-sm); padding: 0.75rem 1rem; }
  .legende__titel { font-size: 1.05rem; }
  .legende__quelle { display: none; }
  .legende__liste { margin-top: 0.4rem; gap: 0.2rem; }
  .legende__ebene small { display: none; }
  .bedarf-skala__einheit { display: none; }
  .legende__fuss { margin-top: 0.4rem; padding-top: 0.4rem; }
  .legende__klappe { display: block; }
  .legende--zu { width: auto; padding-block: 0.5rem; }
  .legende--zu .legende__inhalt { display: none; }
}

/* --- Interne Erfassung: Karte links, Seitenleiste rechts ------------------ */
.seite-erfassen .site-footer { display: none; }
.seite-erfassen .site-main { height: calc(100dvh - var(--header-height)); }
.seite-erfassen .karte { min-height: 0; }
.erfassen {
  width: 25rem;
  flex: none;
  overflow-y: auto;
  padding: var(--space-sm) 1.1rem var(--space-md);
  border-left: 1px solid var(--border);
  background: var(--bg);
}
.erfassen__kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-sm); }
.erfassen__titel { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; line-height: 1.2; }
.erfassen__hinweis { margin-top: 0.5rem; color: var(--text-muted); font-size: 0.875rem; }
.erfassen__form {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  gap: 0.7rem;
}
.erfassen__form[hidden] { display: none; }
.erfassen__formkopf { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.erfassen__pos { color: var(--text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.erfassen__zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.erfassen .feld > span { font-size: 0.8125rem; }
.erfassen .feld input, .erfassen .feld select, .erfassen .feld textarea { padding: 0.4rem 0.55rem; font-size: 0.9375rem; }
.erfassen__schalter { display: flex; gap: 0.55rem; align-items: baseline; font-size: 0.9375rem; cursor: pointer; }
.erfassen__schalter input { accent-color: var(--c-light-orange); }
.erfassen__schalter small { color: var(--text-muted); font-size: 0.8125rem; }
.erfassen__ausgedacht {
  padding: 0.05rem 0.4rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 400;
  vertical-align: 0.1em;
}
.erfassen__meta { color: var(--text-muted); font-size: 0.75rem; }
.erfassen__meta:empty { display: none; }
.erfassen__knoepfe { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.erfassen__knoepfe .button { padding: 0.5rem 1.1rem; }
.erfassen__loeschen { margin-left: auto; padding: 0; border: 0; background: none; color: var(--c-light-orange); font: inherit; font-size: 0.875rem; cursor: pointer; text-decoration: underline; }
.erfassen__liste-kopf { display: flex; justify-content: space-between; align-items: baseline; margin-top: var(--space-md); padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.erfassen__export { color: var(--text-muted); font-size: 0.8125rem; }
.erfassen__export a { color: var(--accent); }
.erfassen__liste { list-style: none; padding: 0; margin-top: 0.3rem; }
.erfassen__eintrag {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.erfassen__eintrag:hover, .erfassen__eintrag--aktiv { background: var(--surface); }
.erfassen__eintrag--aktiv { box-shadow: inset 3px 0 0 var(--c-light-orange); }
.erfassen__eintrag strong { display: block; font-weight: 600; font-size: 0.9375rem; }
.erfassen__eintrag small { color: var(--text-muted); font-size: 0.8125rem; }
.erfassen__marker {
  width: 22px;
  height: 22px;
  border: 3px solid var(--c-white);
  border-radius: 50%;
  background: var(--c-dark-orange);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-light-orange) 45%, transparent), 0 2px 8px rgba(0, 0, 0, 0.5);
  cursor: grab;
}

@media (max-width: 52rem) {
  .seite-erfassen .site-main { flex-direction: column; height: auto; }
  .seite-erfassen .karte { flex: none; height: 55dvh; }
  .erfassen { width: auto; border-left: 0; border-top: 1px solid var(--border); }
}
