/* ============================================================================
   Unwetter-Modus: Alarm-Dashboard der Startseite ("Lagezentrum").
   Aktiv über body.unwetter-takeover (gesetzt in partials/head.php für "/").
   Navigation/Footer bleiben sichtbar (public-Layout) — das Ein-Bildschirm-
   Dashboard auf großen Bildschirmen wird gemeinsam mit home-leitstand/
   weather-leitstand in cockpit.css umgesetzt (dort werden .topbar/.footer-min
   auf den Bildschirmrand gepinnt, .uw füllt die Restfläche).
   ========================================================================== */

/* Admin-Dashboard: 3-Zustand-Umschalter (Auto/An/Aus) */
.admin-surface .unwetter-switch { align-items: center; margin-top: 8px; }
.admin-surface .unwetter-switch-label { font-size: 13px; color: var(--muted, #6b7280); font-weight: 600; margin-right: 4px; }
.admin-surface .unwetter-switch .inline-form { display: inline; }

.uw {
  --uw-red: #e8323f;
  --uw-red-dark: #c8132c;
  --uw-ink: #0b0d10;
  --uw-panel: #141922;
  --uw-panel-2: #1b2230;
  --uw-line: #28313f;
  --uw-muted: #9aa7b8;
  --uw-text: #eef2f7;
  --uw-warn: #d46000;
  --uw-warn-2: #e07828;
  --uw-yellow: #e9c000;
  color: var(--uw-text);
}
.uw-pegel-val { color: var(--uw-text); }

/* Dauerhafte Identität (Farben) — die Ein-Bildschirm-Fixierung (Höhe/Overflow)
   für große Bildschirme kommt aus cockpit.css (gemeinsam mit home-leitstand/
   weather-leitstand), damit Navigation & Footer dort oben/unten sichtbar bleiben. */
body.unwetter-takeover {
  margin: 0;
  background: var(--uw-ink);
  color: var(--uw-text);
}

/* Dezenter Alarm-Akzent in Navigation & Footer — beide bleiben ansonsten
   unverändert (Identität/Navigierbarkeit der Website bleibt erhalten). */
body.unwetter-takeover .topbar { border-bottom: 3px solid var(--primary); }
body.unwetter-takeover .footer-min { border-top: 3px solid var(--primary); }

.uw {
  display: flex;
  flex-direction: column;
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
}

/* ── Alarm-Kopf ──────────────────────────────────────────────────────────── */
.uw-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(12px, 1.8vh, 20px) clamp(18px, 2.4vw, 36px);
  background: linear-gradient(90deg, var(--uw-red-dark), var(--uw-red));
  border-bottom: 3px solid #ff556c;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
}
.uw-head-lead { display: flex; align-items: center; gap: 18px; min-width: 0; }
.uw-badge { font-size: clamp(30px, 4vh, 40px); line-height: 1; animation: uw-pulse 1.6s infinite; }
@keyframes uw-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.uw-title { margin: 0; font-size: clamp(22px, 3.2vh, 32px); font-weight: 800; letter-spacing: .5px; color: #fff; }
.uw-sub { margin: 2px 0 0; font-size: clamp(12px, 1.5vh, 15px); font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: #ffe1e6; opacity: .9; }
.uw-stand { text-align: right; font-size: clamp(12px, 1.5vh, 15px); color: #ffe1e6; flex: 0 0 auto; }
.uw-stand b { display: block; font-size: clamp(16px, 2.4vh, 22px); color: #fff; }

/* ── Widget-Deck (12-Spalten, per --ffh-span vom home-editor.js gesteuert) ── */
.uw-deck {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(min-content, max-content);
  align-content: start;
  gap: clamp(10px, 1.4vw, 16px);
  padding: clamp(10px, 1.4vh, 16px) clamp(14px, 2vw, 22px);
}
.uw-tile { min-width: 0; grid-column: span 12; display: flex; }
.uw-tile > .uw-card { flex: 1 1 auto; width: 100%; }
@media (min-width: 901px) {
  .uw-tile { grid-column: span var(--ffh-span, 6); }
}

.uw-card {
  background: var(--uw-panel);
  border: 1px solid var(--uw-line);
  border-radius: 16px;
  padding: clamp(12px, 1.6vh, 18px) clamp(14px, 1.4vw, 20px);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.uw-card--grow { flex: 1 1 auto; }
.uw-card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.uw-card-t { font-size: clamp(11px, 1.4vh, 13px); letter-spacing: 2px; text-transform: uppercase; color: var(--uw-muted); font-weight: 700; }
.uw-flag { color: var(--uw-warn-2); }
.uw-note { color: var(--uw-muted); font-size: 15px; }
.uw-note a { color: var(--uw-warn-2); }

/* ── Pegel ───────────────────────────────────────────────────────────────── */
.uw-pegel-top { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.uw-pegel-val { font-size: clamp(44px, 8vh, 72px); font-weight: 800; line-height: 1; }
.uw-pegel-unit { font-size: clamp(16px, 2.4vh, 22px); color: var(--uw-muted); font-weight: 600; }
.uw-trend { font-size: clamp(14px, 1.9vh, 18px); font-weight: 700; }
.uw-trend--rising { color: #ff8a5c; }
.uw-trend--falling { color: #4fb0ff; }
.uw-trend--steady { color: var(--uw-muted); }

.uw-chart { flex: 1 1 auto; min-height: 0; max-height: clamp(120px, 22vh, 240px); margin: 10px 0 0; }
.uw-chart-plot { position: relative; height: 100%; min-height: 120px; }
.uw-chart-plot svg { width: 100%; height: 100%; display: block; }
.uw-chart-area { fill: rgba(79, 176, 255, .28); }
.uw-chart-line { fill: none; stroke: #4fb0ff; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.uw-thr { position: absolute; left: 0; right: 0; border-top: 1.5px dashed currentColor; opacity: .7; }
.uw-thr-lbl { position: absolute; left: 6px; top: -14px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.uw-thr--low { color: var(--uw-yellow); }
.uw-thr--mid { color: var(--uw-warn); }
.uw-thr--high { color: var(--uw-red); }

.uw-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.uw-chip { font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--uw-line); background: var(--uw-panel-2); }
.uw-chip-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.uw-chip--low .uw-chip-dot { background: var(--uw-yellow); }
.uw-chip--mid .uw-chip-dot { background: var(--uw-warn); }
.uw-chip--high .uw-chip-dot { background: var(--uw-red); }

.uw-durch { margin-top: 12px; display: flex; align-items: baseline; gap: 10px; color: var(--uw-muted); font-size: 16px; }
.uw-durch b { color: var(--uw-text); font-size: clamp(16px, 2.4vh, 22px); font-weight: 800; }

/* ── Warnung ─────────────────────────────────────────────────────────────── */
.uw-warn { border-left: 6px solid var(--uw-line); }
.uw-warn--extreme { border-left-color: var(--uw-red); }
.uw-warn--severe { border-left-color: var(--uw-warn); }
.uw-warn--moderate { border-left-color: var(--uw-yellow); }
.uw-warn--minor { border-left-color: #2fa36b; }
.uw-sev { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: 1px; }
.uw-sev-box { width: 14px; height: 14px; border-radius: 3px; }
.uw-sev--extreme { color: #ff5a72; } .uw-sev--extreme .uw-sev-box { background: var(--uw-red); }
.uw-sev--severe { color: var(--uw-warn-2); } .uw-sev--severe .uw-sev-box { background: var(--uw-warn); }
.uw-sev--moderate { color: var(--uw-yellow); } .uw-sev--moderate .uw-sev-box { background: var(--uw-yellow); }
.uw-sev--minor { color: #59c78f; } .uw-sev--minor .uw-sev-box { background: #2fa36b; }
.uw-warn-ev { font-size: clamp(20px, 3vh, 26px); font-weight: 800; margin: 8px 0 4px; }
.uw-warn-meta { color: var(--uw-muted); font-size: 15px; }
.uw-warn-txt { color: #cfd8e4; font-size: 15px; margin: 10px 0 0; line-height: 1.4; }
.uw-warn-more { color: var(--uw-muted); font-size: 14px; margin: 10px 0 0; }
.uw-warn-none { display: flex; align-items: center; gap: 10px; color: #59c78f; font-size: 17px; font-weight: 600; }
.uw-check { font-size: 20px; }

/* ── Wetter ──────────────────────────────────────────────────────────────── */
.uw-wx-main { display: flex; align-items: center; gap: 20px; }
.uw-wx-ico { font-size: clamp(40px, 6vh, 56px); line-height: 1; }
.uw-wx-temp { font-size: clamp(36px, 5.6vh, 52px); font-weight: 800; line-height: 1; }
.uw-wx-desc { color: var(--uw-muted); font-size: 16px; margin-top: 4px; }
.uw-wx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin-top: 14px; font-size: 15px; }
.uw-wx-grid .k { color: var(--uw-muted); }
.uw-wx-grid .v { font-weight: 700; float: right; }

/* ── Notruf (eigenes Widget) ─────────────────────────────────────────────── */
.uw-notruf-card { background: var(--uw-panel-2); border-color: var(--uw-red); justify-content: center; }
.uw-notruf { display: flex; align-items: center; gap: 12px; }
.uw-notruf-ic { font-size: clamp(24px, 3.4vh, 30px); }
.uw-notruf-n { font-size: 13px; color: var(--uw-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.uw-notruf-nn { font-size: clamp(26px, 4vh, 38px); font-weight: 900; color: #fff; }

/* ── Verhaltenshinweise ──────────────────────────────────────────────────── */
.uw-hinweis { font-size: clamp(14px, 2vh, 18px); color: #dbe3ec; line-height: 1.45; }

/* ── Liveticker ──────────────────────────────────────────────────────────── */
.uw-ticker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.uw-ticker-item { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 10px; font-size: clamp(14px, 1.9vh, 17px); padding: 6px 0; border-bottom: 1px solid var(--uw-line); }
.uw-ticker-item:last-child { border-bottom: 0; }
.uw-ticker-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--uw-muted); align-self: center; }
.uw-ticker-item--warnung .uw-ticker-dot { background: var(--uw-warn); }
.uw-ticker-item--kritisch .uw-ticker-dot { background: var(--uw-red); }
.uw-ticker-time { color: var(--uw-muted); font-variant-numeric: tabular-nums; font-size: .85em; white-space: nowrap; }
.uw-ticker-msg { color: var(--uw-text); }
.uw-ticker-item--kritisch .uw-ticker-msg { font-weight: 700; }

/* ── Feuerwehrhaus besetzt (grüner/roter Punkt) ─────────────────────────── */
.uw-besetzt-body { display: flex; align-items: center; gap: 16px; }
.uw-led { width: clamp(22px, 3.2vh, 30px); height: clamp(22px, 3.2vh, 30px); border-radius: 50%; flex: 0 0 auto; }
.uw-led--green { background: #22c55e; box-shadow: 0 0 16px rgba(34, 197, 94, .8); }
.uw-led--red { background: var(--uw-red); box-shadow: 0 0 16px rgba(232, 50, 63, .7); }
.uw-besetzt-state { font-size: clamp(20px, 3vh, 28px); font-weight: 800; }
.uw-besetzt--on .uw-besetzt-state { color: #4ade80; }
.uw-besetzt--off .uw-besetzt-state { color: #ff5a72; }
.uw-besetzt-since { color: var(--uw-muted); font-size: 14px; }

/* ── Wichtige Informationen ──────────────────────────────────────────────── */
.uw-infos-txt { font-size: clamp(14px, 2vh, 18px); color: #dbe3ec; line-height: 1.5; }

/* ── Anpassen-Modus: Auto-Reload aus, Deck nicht mehr fix ────────────────── */
body.unwetter-takeover.ffh-customizing,
body.unwetter-takeover.ffh-customizing .uw { height: auto; overflow: visible; }
.ffh-customizing .uw-deck { overflow: visible; }

/* ── Hochformat / kleine Screens: vertikal stapeln, Scroll erlauben ──────── */
@media (max-width: 900px), (orientation: portrait) {
  .uw { height: auto; }
  .uw-chart-plot { min-height: 200px; }
}
