/* =========================================================
   Dienstposten-Finder – Grundgerüst
   ========================================================= */

/* ---------- Farb-Tokens ---------- */
:root,
:root[data-theme="dark"] {
  --bg:        #0a0d12;
  --panel:     #11151c;
  --panel-2:   #161b24;
  --line:      #222a36;
  --line-2:    #2c3544;
  --text:      #e7ebf2;
  --muted:     #8b95a7;
  --accent:    #6ea8fe;
  --shadow:    0 10px 40px rgba(0, 0, 0, .55);

  --radius-lg: 18px;
  --radius:    14px;
  --radius-sm: 12px;
}

:root[data-theme="light"] {
  --bg:        #eef1f5;
  --panel:     #ffffff;
  --panel-2:   #f6f8fb;
  --line:      #e2e7ee;
  --line-2:    #d3dae4;
  --text:      #141a23;
  --muted:     #5d6879;
  --accent:    #2563eb;
  --shadow:    0 10px 40px rgba(20, 30, 50, .18);
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  display: grid;
  grid-template-rows: 64px 1fr;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 Inter, system-ui, sans-serif;
}

/* ---------- Kopfzeile ---------- */
.kopfzeile {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.marke {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 300px;
  flex: none;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px dashed var(--line-2);
}

.suche {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.feld {
  height: 42px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.feld--was       { width: 300px; }
.feld--heimatort { width: 230px; }
.feld--umkreis   { width: 270px; }

.knopf-primaer {
  width: 110px;
  height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
}

.aktionen {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.icon-knopf {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
}

/* ---------- Hauptbereich: 3 Spalten ---------- */
.hauptbereich {
  display: grid;
  grid-template-columns: 340px 1fr 420px;
  min-height: 0;
}

.seitenleiste {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
.seitenleiste--links  { border-right: 1px solid var(--line); }
.seitenleiste--rechts { border-left: 1px solid var(--line); }

.scrollbereich {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.karte-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.karte-box--profil     { min-height: 560px; }
.karte-box--feinfilter { min-height: 180px; }

.fussleiste {
  height: 64px;
  border-top: 1px solid var(--line);
}

.ergebnis-kopf {
  height: 110px;
  border-bottom: 1px solid var(--line);
}

/* ---------- Mitte: Karte ---------- */
.kartenbereich {
  position: relative;
  min-width: 0;
}

#karte {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

/* OSM-Kacheln im Dunkelmodus abdunkeln */
:root[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.35);
}

/* Schwebende Bereiche über der Karte */
.overlay {
  position: absolute;
  z-index: 500;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(8px);
}

.overlay--zusammenfassung {
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 540px;
  height: 38px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.overlay--werkzeuge {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 130px;
  border-radius: var(--radius-sm);
}

.overlay--legende {
  left: 16px;
  bottom: 16px;
  width: 180px;
  height: 116px;
  border-radius: var(--radius-sm);
}

.overlay--detail {
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 390px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.overlay--detail[hidden] { display: none; }

/* Leaflet-Bedienelemente an das Design anpassen */
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--panel) 80%, transparent) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
