/* =============================================
   Drohnenwetter – style.css
   ============================================= */

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

/* --- CSS-Variablen Dunkel (Standard) --- */
:root,
[data-theme="dark"] {
  --bg:           #0f172a;
  --bg2:          #1e293b;
  --rand:         #334155;
  --text:         #e2e8f0;
  --text2:        #94a3b8;
  --akzent:       #38bdf8;
  --gruen:        #22c55e;
  --gelb:         #f59e0b;
  --rot:          #ef4444;
  --radius:       8px;
  --schrift:      'Segoe UI', system-ui, sans-serif;
  --schatten:     0 2px 8px rgba(0,0,0,0.4);
  --svg-bg:       url('/img/bg-dark.svg');
}

/* --- CSS-Variablen Hell --- */
[data-theme="light"] {
  --bg:           #f0f9ff;
  --bg2:          #ffffff;
  --rand:         #bae6fd;
  --text:         #0f172a;
  --text2:        #475569;
  --akzent:       #0284c7;
  --gruen:        #16a34a;
  --gelb:         #d97706;
  --rot:          #dc2626;
  --schatten:     0 2px 8px rgba(0,0,0,0.1);
  --svg-bg:       url('/img/bg-light.svg');
}

/* --- Basis --- */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- SVG-Hintergrund --- */
.hintergrund-svg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--svg-bg) center center / cover no-repeat;
  opacity: 1;
  pointer-events: none;
}

/* --- Header --- */
.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0.875rem 2rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--rand);
  gap: 1rem;
  box-shadow: var(--schatten);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-uhrzeit {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.site-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--akzent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--text2);
  font-size: 0.9rem;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* Theme-Button */
.btn-theme {
  background: transparent;
  border: 1px solid var(--rand);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.btn-theme:hover { background: var(--rand); }

/* --- Main --- */
.site-main {
  flex: 1;
  padding: 1.75rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* --- Footer --- */
.site-footer {
  padding: 1.25rem 2rem;
  background: var(--bg2);
  border-top: 1px solid var(--rand);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text2);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: auto;
}
.site-footer a { color: var(--text2); }
.site-footer a:hover { color: var(--akzent); }

/* --- Buttons --- */
.btn-primaer {
  background: var(--akzent);
  color: #0f172a;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.btn-primaer:hover { opacity: 0.85; }

.btn-sekundaer {
  background: transparent;
  color: var(--akzent);
  border: 1px solid var(--akzent);
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-sekundaer:hover { background: rgba(56,189,248,0.1); }

/* --- Startseite --- */
.start-container {
  max-width: 580px;
  margin: 4rem auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.start-titel {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--akzent);
}
.start-untertitel {
  color: var(--text2);
  font-size: 1.05rem;
}
.such-formular { width: 100%; }
.such-zeile { display: flex; gap: 0.5rem; }
.such-eingabe {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rand);
  background: var(--bg2);
  color: var(--text);
  font-size: 1rem;
}
.such-eingabe:focus { outline: 2px solid var(--akzent); }
.standort-zeile { display: flex; justify-content: center; }

/* --- Fehlerbanner --- */
.fehler-banner {
  background: rgba(239,68,68,0.12);
  border: 1px solid var(--rot);
  color: var(--rot);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* --- Warnbanner --- */
.warn-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  text-align: center;
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.warn-banner--gelb { background: var(--gelb); color: #0f172a; }
.warn-banner--rot  { background: var(--rot);  color: #ffffff; }

@keyframes blinken {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}
.blinken { animation: blinken 0.6s ease-in-out infinite; }

/* --- Ergebnisseite --- */
.ergebnis-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ergebnis-kopf {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.ergebnis-ort {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.link-zurueck {
  font-size: 0.85rem;
  color: var(--text2);
}

/* --- Ampel --- */
.ampel-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--rand);
  background: var(--bg2);
  box-shadow: var(--schatten);
}
.ampel-licht {
  width: 24px; height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ampel-licht--gruen { background: var(--gruen); box-shadow: 0 0 10px var(--gruen); }
.ampel-licht--gelb  { background: var(--gelb);  box-shadow: 0 0 10px var(--gelb); }
.ampel-licht--rot   { background: var(--rot);   box-shadow: 0 0 10px var(--rot); }
.ampel-licht--laden { background: var(--rand); }
.ampel--gruen { border-color: var(--gruen); }
.ampel--gelb  { border-color: var(--gelb); }
.ampel--rot   { border-color: var(--rot); }
.ampel-text small { color: var(--text2); font-size: 0.85rem; font-weight: 400; }

/* --- Widget-Raster --- */
.widget-raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.875rem;
}

.widget {
  background: var(--bg2);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  box-shadow: var(--schatten);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.widget-titel {
  font-size: 0.75rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.widget-wert-zeile {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}
.widget-wert {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.widget-einheit {
  font-size: 0.85rem;
  color: var(--text2);
}

/* --- Karten-Legende --- */
.karte-legende {
  position: absolute;
  bottom: 24px;
  right: 8px;
  z-index: 1000;
  background: var(--bg2);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--text);
  box-shadow: var(--schatten);
  min-width: 160px;
}
.karte-legende-kopf {
  padding: 0.4rem 0.75rem;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rand);
  user-select: none;
}
.karte-legende-inhalt {
  padding: 0.4rem 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.karte-legende-inhalt.versteckt { display: none; }
.legende-zeile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.legende-farbe {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.8;
}
.karte-panel-raster {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  align-items: start;
}
.karte-wrapper {
  border-radius: var(--radius);
  border: 1px solid var(--rand);
  overflow: hidden;
  box-shadow: var(--schatten);
  position: relative;
}
.karte-container {
  height: 420px;
  width: 100%;
  display: block;
}
.seiten-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.panel-block {
  background: var(--bg2);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--schatten);
}
.panel-titel {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--rand);
  background: var(--bg);
}
.panel-inhalt {
  padding: 0.5rem 0;
}
.panel-scroll {
  max-height: 180px;
  overflow-y: auto;
}
.panel-leer {
  font-size: 0.85rem;
  color: var(--text2);
  padding: 0.5rem 0.875rem;
}

/* Zoneneintrag */
.zonen-eintrag { border-bottom: 1px solid var(--rand); }
.zonen-eintrag:last-child { border-bottom: none; }
.zonen-kopf {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  transition: background 0.15s;
}
.zonen-kopf:hover { background: var(--rand); }
.zonen-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--akzent);
  flex-shrink: 0;
}
.zonen-name { flex: 1; }
.zonen-anzahl {
  font-size: 0.75rem;
  color: var(--text2);
  font-weight: 400;
}
.zonen-pfeil {
  font-size: 0.65rem;
  color: var(--text2);
  transition: transform 0.2s;
}
.zonen-eintrag.offen .zonen-pfeil { transform: rotate(90deg); }
.zonen-detail {
  display: none;
  padding: 0.25rem 0.875rem 0.5rem 1.75rem;
}
.zonen-eintrag.offen .zonen-detail { display: block; }
.zonen-gebiet {
  font-size: 0.82rem;
  color: var(--text);
  padding: 0.2rem 0;
}
.zonen-recht {
  font-size: 0.75rem;
  color: var(--text2);
}

/* --- Tabellen-Raster --- */
.tabellen-raster {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: start;
}

/* Widget-Titel Klammertext kleiner */
.widget-titel-sub {
  font-size: 0.68rem;
  opacity: 0.75;
  font-weight: 400;
}

/* --- Sections --- */
.section-block {
  background: var(--bg2);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--schatten);
}
.section-titel {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--rand);
  background: var(--bg);
}

/* --- Tabellen --- */
.daten-tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.daten-tabelle th,
.daten-tabelle td {
  text-align: left;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--rand);
}
.daten-tabelle tr:last-child td { border-bottom: none; }
.daten-tabelle th {
  color: var(--text2);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg);
}
.daten-tabelle--klein th,
.daten-tabelle--klein td { padding: 0.35rem 0.875rem; font-size: 0.82rem; }
.td-wert { text-align: right; font-weight: 600; color: var(--text); }
.zeile-warnung { background: rgba(239,68,68,0.1); }

/* --- Hinweise --- */
.hinweis-text { font-size: 0.8rem; color: var(--text2); padding: 0.5rem 1rem; }
.hinweis-inline { font-size: 0.75rem; color: var(--text2); font-weight: 400; }

/* --- Neue Suche Button in Nav --- */
.btn-neuesuche {
  background: var(--akzent);
  color: #0f172a;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}
.btn-neuesuche:hover { opacity: 0.85; text-decoration: none; }

/* --- Content-Seiten volle Breite --- */
.content-container {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.content-container h1 { font-size: 1.75rem; font-weight: 700; }
.content-container h2 { font-size: 1.1rem; font-weight: 600; margin-top: 0.25rem; color: var(--text2); }
.content-container p  { font-size: 0.95rem; color: var(--text); }

/* --- Changelog --- */
.changelog-eintrag {
  background: var(--bg2);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.changelog-version { font-size: 1rem; font-weight: 700; color: var(--akzent); }
.changelog-datum { font-size: 0.82rem; color: var(--text2); font-weight: 400; margin-left: 0.5rem; }
.changelog-liste {
  padding-left: 1.25rem;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* --- Ampel Farbtexte --- */
.ampel-gruen-text { color: var(--gruen); font-weight: 600; }
.ampel-gelb-text  { color: var(--gelb);  font-weight: 600; }
.ampel-rot-text   { color: var(--rot);   font-weight: 600; }

/* --- Responsiv --- */
@media (max-width: 900px) {
  .karte-panel-raster { grid-template-columns: 1fr; }
  .tabellen-raster    { grid-template-columns: 1fr; }
  .seiten-panel { flex-direction: row; }
  .panel-block  { flex: 1; }
}
@media (max-width: 640px) {
  .site-header  { grid-template-columns: auto auto; padding: 0.75rem 1rem; }
  .site-uhrzeit { display: none; }
  .site-main    { padding: 1.25rem 1rem; }
  .start-container { margin: 2rem auto; }
  .start-titel  { font-size: 1.75rem; }
  .such-zeile   { flex-direction: column; }
  .widget-raster { grid-template-columns: repeat(2, 1fr); }
  .karte-container { height: 260px; }
  .seiten-panel { flex-direction: column; }
}

/* --- Drucken --- */
@media print {
  .hintergrund-svg,
  .site-nav,
  .btn-theme,
  .warn-banner,
  .karte-panel-raster,
  .site-footer { display: none !important; }

  .site-header {
    grid-template-columns: auto 1fr;
    border-bottom: 1px solid #ccc;
    position: static;
    box-shadow: none;
  }

  body { background: white; color: black; }

  .ampel-box {
    border: 2px solid #333;
    background: white;
  }

  .widget {
    border: 1px solid #ccc;
    background: white;
    break-inside: avoid;
  }

  .widget-raster {
    grid-template-columns: repeat(3, 1fr);
  }

  .tabellen-raster {
    grid-template-columns: 2fr 1fr;
  }

  .section-block,
  .daten-tabelle th,
  .daten-tabelle td {
    background: white;
    color: black;
    border-color: #ccc;
  }

  .site-main {
    max-width: 100%;
    padding: 1rem;
  }

  .ergebnis-ort {
    font-size: 1rem;
  }
}
