/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Grüne Kampagnenfarben (Mach's GRÜN 2026) */
  --tanne:             #005437;   /* primäres Dunkelgrün, Hintergrund */
  --klee:              #008939;   /* mittleres Grün, Akzente */
  --grashalm:          #8abd24;   /* Hellgrün, Highlights */
  --sand:              #f5f1e9;   /* warmes Off-White */
  --magenta:           #e61981;   /* Signalfarbe / CTA */
  --sonnenblume:       #FFED00;   /* Selektiert / Highlight */
  --sonnenblume-dark:  #c8a800;

  /* Funktionale Aliases */
  --gruen:             var(--klee);
  --gruen-dark:        var(--tanne);
  --gruen-light:       #b8e090;
  --gruen-bg:          #e8f5dc;
  --text:              #1a1a1a;
  --text-muted:        #556655;
  --border:            #c0dca0;
  --white:             #ffffff;
  --radius:            8px;
  --shadow:            0 2px 12px rgba(0,84,55,0.13);
}

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

html, body {
  height: 100%;
  font-family: 'Barlow', system-ui, sans-serif;
  font-weight: 400;
  background: var(--tanne);
  color: var(--text);
  overflow: hidden;
}

/* Barlow Condensed ExtraBold for all headings / labels */
h1, h2, h3,
#overlay-title,
.kandidat-name,
.panel-region-title,
.ctrl-label,
.tab-btn,
.kandidat-badge,
.badge,
.wb-legend-title,
.wahl-section-title {
  font-family: 'Barlow Condensed', system-ui, sans-serif;
  font-weight: 800;
}

/* ─── Scene: centers the card ────────────────────────────────────────────── */
#scene {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  gap: 0;
}

/* ─── Map card: transparent — shape comes from the inverse mask ─────────── */
#map-card {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1280px;
  min-height: 0;
  background: transparent;
}

#map { width: 100%; height: 100%; min-height: 300px; }
.leaflet-container { background: transparent !important; }

/* Depth between sub-polygon seams */
.leaflet-overlay-pane {
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.45));
}

/* Hover: Gebiet hebt sich an — transition wird per JS ausgelöst */
.leaflet-gemeindenPane-pane path {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.18s ease, filter 0.18s ease;
}

/* Shadow layer sits above the inverse mask (z 450) → shadow visible on background */
.leaflet-shadowPane-pane {
  filter: blur(14px);
  opacity: 0.72;
  pointer-events: none !important;
}

/* Directional light overlay — simulates light from upper-left */
#map::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 800;
  pointer-events: none;
  background: linear-gradient(
    148deg,
    rgba(255,255,255,0.20)  0%,
    rgba(255,255,255,0.07) 30%,
    transparent            52%,
    rgba(0,0,0,0.18)      100%
  );
}

/* ─── Wahltyp-Stepper als Pill-Chips ─────────────────────────────────────── */
#wahltyp-stepper {
  width: 100%;
  max-width: 1280px;
  flex-shrink: 0;
  padding: 8px 12px;
}

.stepper-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  align-items: center;
  background: rgba(0,50,25,0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(138,189,36,0.22);
  border-radius: 12px;
  padding: 7px 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  width: 100%;
}

.stepper-chip {
  font-family: 'Barlow Condensed', system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(245,241,233,0.5);
  background: transparent;
  border: 1.5px solid rgba(245,241,233,0.15);
  border-radius: 999px;
  padding: 6px 15px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  line-height: 1;
}
.stepper-chip:hover {
  color: var(--sand);
  border-color: rgba(245,241,233,0.4);
  background: rgba(245,241,233,0.08);
}
.stepper-chip.done {
  color: var(--grashalm);
  border-color: rgba(138,189,36,0.35);
  background: rgba(138,189,36,0.08);
}
.stepper-chip.active {
  background: var(--grashalm);
  color: var(--tanne);
  border-color: var(--grashalm);
  box-shadow: 0 2px 10px rgba(138,189,36,0.35);
  font-weight: 800;
}

/* ─── Kandidaten overlay (zentriertes Modal) ─────────────────────────────── */
#kandidaten-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  width: min(380px, 88%);
  max-height: 78%;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(16px);
  border-radius: calc(var(--radius) * 1.5);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              opacity   0.22s ease;
  z-index: 900;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 48px rgba(0,0,0,0.30);
  overflow: hidden;
}
#kandidaten-overlay.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: all;
}

#overlay-header {
  background: var(--tanne);
  color: var(--sand);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--grashalm);
}
#overlay-title-wrap { flex: 1; }
#overlay-title { font-size: 0.92rem; font-weight: 700; line-height: 1.3; }
#overlay-sub { font-size: 0.71rem; opacity: 0.65; margin-top: 2px; }
#overlay-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.12s;
  font-family: inherit;
}
#overlay-close:hover { color: #fff; }

#overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ─── Kandidaten cards ───────────────────────────────────────────────────── */
.kandidat-card {
  background: rgba(255,255,255,0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.kandidat-header { display: flex; gap: 10px; align-items: flex-start; }
.kandidat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--gruen);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.92rem; font-weight: 700;
  flex-shrink: 0;
}
.kandidat-meta { flex: 1; min-width: 0; }
.kandidat-badge {
  display: inline-block;
  background: var(--sonnenblume);
  color: var(--tanne);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.kandidat-name { font-size: 0.88rem; font-weight: 700; color: var(--gruen-dark); margin-bottom: 2px; line-height: 1.2; }
.kandidat-rolle { font-size: 0.71rem; color: var(--gruen); font-weight: 600; margin-bottom: 2px; }
.kandidat-info { font-size: 0.71rem; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; }
.kandidat-profil { font-size: 0.76rem; color: var(--text); line-height: 1.55; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.schwerpunkte { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.schwerpunkt-tag {
  background: var(--gruen-bg);
  color: var(--gruen-dark);
  border: 1px solid var(--gruen-light);
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
}

.panel-region-title { font-size: 0.9rem; font-weight: 700; color: var(--gruen-dark); margin-bottom: 4px; }
.panel-region-sub { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 12px; }

.info-banner {
  background: #fff8d6;
  border: 1px solid var(--sonnenblume-dark);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #5a4800;
  margin-bottom: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.info-banner-icon { flex-shrink: 0; }

.empty-state {
  background: var(--gruen-bg);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  font-size: 0.79rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

.wahl-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ─── Kandidaten-Foto auf der Karte ─────────────────────────────────────── */
.kandidat-foto-marker { background: transparent; border: none; overflow: visible; }
.kandidat-foto-img {
  border-radius: 50%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* ─── OSM Lizenzhinweis ──────────────────────────────────────────────────── */
#osm-attribution {
  position: absolute;
  bottom: 6px;
  right: 8px;
  z-index: 1001;
  font-size: 0.60rem;
  color: rgba(255,255,255,0.55);
  pointer-events: all;
  line-height: 1;
}
#osm-attribution a {
  color: rgba(255,255,255,0.70);
  text-decoration: none;
}
#osm-attribution a:hover { color: #fff; text-decoration: underline; }

/* ─── Leaflet overrides ──────────────────────────────────────────────────── */
.leaflet-control-attribution { font-size: 0.62rem; }
.leaflet-tooltip {
  border-radius: 6px;
  border: 1px solid rgba(0,137,57,0.3);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 6px 11px;
  box-shadow: 0 2px 10px rgba(0,84,55,0.22);
  color: var(--tanne);
  font-weight: 500;
}

/* ─── Legend ─────────────────────────────────────────────────────────────── */
.wb-legend {
  background: rgba(0,84,55,0.92);
  border: 1px solid rgba(138,189,36,0.35);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  font-size: 0.75rem;
  backdrop-filter: blur(8px);
  max-height: min(60vh, 340px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(138,189,36,0.4) transparent;
  color: var(--sand);
}
.wb-legend-title {
  font-family: 'Barlow Condensed', system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--grashalm);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(138,189,36,0.3);
}
.wb-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 0.73rem;
  color: rgba(245,241,233,0.88);
}
.wb-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
