/* meteo365 v4 — Model-Select (Dropdown + Info-Popover)
   Position: unten rechts in der Map-Stage, neben dem Timeslider.
   Optik: Petrol-Gradient wie die Map-Buttons + Timeslider.
*/

.map-model-select-wrap {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 23;
  display: flex;
  flex-direction: column;   /* Select-Reihe oben, Legende darunter — bottom-rechts verankert */
  align-items: flex-end;
  gap: 10px;
  /* Die TRANSPARENTE Fläche des Wraps (Gap/Margin über der Layer-Rail) darf keine
     Klicks abfangen — sonst sind Layer-Icons darunter „unsichtbar" blockiert.
     Nur die echten Bedien-Elemente reaktivieren pointer-events. */
  pointer-events: none;
}
/* WICHTIG: Die Legenden (#map-legend + .warn-legend-Varianten für Warnungen/
   Polarlicht/Tornado) liegen als direkte Kinder IN diesem Wrap. Ohne diese Zeile
   erben sie das pointer-events:none von oben → sie sind komplett klick-tot, das
   Auf-/Zuklappen reagiert nicht und Tipps fallen auf darunterliegende Controls
   durch. Sie MÜSSEN hier wieder freigeschaltet werden. */
.copernicus-badge,
.model-select-row,
.model-pill-mobile,
#map-legend,
.warn-legend { pointer-events: auto; }
/* Select + Info-Button nebeneinander (frühere Wrap-Layout) */
.model-select-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== Select (kompakter) ===== */
.wettermodell {
  min-width: 0;
  width: 92px;
  height: 30px;
  padding: 0 22px 0 10px;
  text-overflow: ellipsis;
  appearance: none;
  border: 0;
  border-radius: 10px;
  background:
    var(--map-control-bg),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 9px center;
  background-size: auto, 12px 12px;
  backdrop-filter: var(--map-control-blur);
  -webkit-backdrop-filter: var(--map-control-blur);
  color: #fff;
  font: 600 12.5px/1 var(--font-display, system-ui);
  cursor: pointer;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .16),
    0 6px 14px rgba(4, 39, 58, .22);
}
.wettermodell:hover,
.wettermodell:focus {
  background:
    var(--map-control-bg-hover),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  background-size: auto, 14px 14px;
}
.wettermodell option { color: #0d1b2a; background: #fff; font-weight: 600; font-style: normal; }
/* optgroup-Header dezent (statt browser-default fett+kursiv).
   Modell-Namen (option) sollen optisch dominieren. */
.wettermodell optgroup {
  font-weight: 400;
  font-style: normal;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7280;
  background: #f3f4f6;
}

/* ===== Info-Button ===== */
.model-meta-card { position: relative; }

.model-meta-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  background: var(--map-control-bg);
  backdrop-filter: var(--map-control-blur);
  -webkit-backdrop-filter: var(--map-control-blur);
  color: var(--map-control-ink);
  font: 700 14px/1 var(--font-display, system-ui);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .16),
    0 6px 14px rgba(4, 39, 58, .22);
  transition: background .18s ease;
}
.model-meta-card.is-open .model-meta-toggle,
.model-meta-toggle:hover {
  background: linear-gradient(180deg, var(--brand-sun, #f4a932), var(--brand-sun-2, #f29400));
}

/* ===== Popover ===== */
.model-meta-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(280px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  background: rgba(20, 55, 82, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, .35),
    inset 0 1px 0 rgba(255, 255, 255, .10);
  color: #fff;
}
.model-meta-popover[hidden] { display: none; }

.model-meta-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.model-meta-title {
  color: #fff;
  font: 800 12px/1 var(--font-display, system-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.model-meta-close {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .68);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.model-meta-close:hover { color: #fff; }

.model-meta-body {
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, .92);
  font: 500 13px/1.45 var(--font-sans, system-ui);
}
.model-meta-body p { margin: 0; }
.model-meta-body b {
  display: inline-block;
  margin-bottom: 2px;
  color: var(--brand-sun, #f4a932);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.model-meta-body small { color: rgba(255, 255, 255, .58); font-size: 11.5px; }

/* ===== Mobile (<=720px) =====
   Slider nimmt unten die volle Breite ein -> Select/Info muessen hochrutschen.
   Tape ist ca. 75-85px hoch; wir setzen bottom = 100px damit's klar drueber sitzt. */
@media (max-width: 1024px) {
  .map-model-select-wrap {
    right: 10px;
    bottom: 160px;   /* ueber der Layer-Rail (bottom:96 + 56 hoch + Abstand) */
    gap: 5px;
  }
  .wettermodell    { min-width: 0; width: 86px; height: 28px; padding: 0 20px 0 9px; font-size: 11.5px; border-radius: 9px; text-overflow: ellipsis; }
  .model-meta-toggle { width: 28px; height: 28px; border-radius: 9px; font-size: 13px; }
}

/* ── Copernicus-Attribution (über dem Modell-Select, Lizenzpflicht) ── */
.copernicus-badge {
  display: block;
  width: fit-content;
  margin: 0 0 8px auto;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  line-height: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.copernicus-badge img { width: 110px; height: auto; display: block; }
.copernicus-badge[hidden] { display: none; }

/* EUMETSAT-Attribution (Pflicht bei MTG-RGB / NWCSAF) — schlichtes Text-Badge. */
.eumetsat-badge {
  display: block; width: fit-content; margin: 0 0 8px auto;
  padding: 4px 9px; border-radius: 8px;
  background: rgba(8, 38, 54, 0.9); color: #fff;
  font: 600 10px/1 var(--font-sans, system-ui); letter-spacing: .03em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.eumetsat-badge[hidden] { display: none; }

/* ===== Mobil: Boden-Legende praesent -> Modell-Select mit hochziehen =====
   Pille sitzt UEBER der Layer-Rail (Rail = --bottom-legend-h + 84), daher
   +148 (= Rail-Offset 84 + Rail-Hoehe 56 + 8 Abstand). */
@media (max-width: 1024px) {
  /* Modell-Pille + „i" RECHTS neben die zentrierte Datums-Bubble des Timesliders
     (statt ueber der Rail). Bubble sitzt ~oberhalb des Tapes; diese Hoehe bringt die
     Zeile auf gleiche Linie. Horizontal ist sie via right:10px schon rechts der Bubble. */
  /* Modell-Select-Wrap wieder wie zuvor (bottom +42). Das Copernicus-Logo wird
     NUR über seinen eigenen margin-bottom höher gezogen — so bleibt der Select
     tief und nur das Logo steigt. */
  .start-stage.has-legend .map-model-select-wrap { bottom: calc(var(--bottom-legend-h, 50px) + 42px); }
  /* Copernicus-Logo mobil kleiner UND höher (eigener Abstand nach unten). */
  .copernicus-badge { padding: 2px 6px; margin-bottom: 72px; }
  .copernicus-badge img { width: 68px; }
}

/* Storms-Modus (kein Timeslider): Modell-Pille sitzt sonst mittig in der Luft →
   über die eingeklappte Sturm-Skala nach unten rücken. Und die Layer-Card rutscht
   ohne Slider ebenfalls tiefer (nutzt den frei gewordenen Platz) + etwas mehr
   Höhe für die Sturm-Liste. */
@media (max-width: 720px) {
  .start-stage.is-storms .map-model-select-wrap {
    bottom: calc(46px + env(safe-area-inset-bottom, 0px));
  }
  .start-stage.is-storms .layer-card {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    max-height: 56vh;
  }
}

/* Layer OHNE Timeslider UND ohne Legende (Active Fires, SIGMET, Aurora …): der
   96px-Slider-Platz unter der Rail ist frei → Layer-Card + Modell-Pille nach
   unten rücken. Storms hat eine eigene Regel (mit Skala unten) und ist
   ausgenommen. */
@media (max-width: 1024px) {
  .start-stage.is-noslider:not(.has-legend):not(.is-storms) .layer-card {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    max-height: 62vh;
  }
  .start-stage.is-noslider:not(.has-legend):not(.is-storms) .map-model-select-wrap {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));   /* 20 + 56 Rail + 8 */
  }
}

/* ===== Mobiler Modell-Trigger (Pille) + Bottom-Sheet ===== */
.model-pill-mobile { display: none; }
@media (max-width: 1024px) {
  .wettermodell { display: none; }
  .model-pill-mobile {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 10px;
    border: 0; border-radius: 10px;
    background: var(--map-control-bg);
    color: #fff; font: 600 12px/1 var(--font-display, system-ui);
    cursor: pointer; max-width: 46vw;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 4px 10px rgba(4,39,58,.28);
  }
  .model-pill-mobile .mpm-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .model-pill-mobile svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
}

.model-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 12, 20, .5);
  opacity: 0; transition: opacity .22s ease;
  z-index: 1400;
}
.model-sheet-backdrop.is-open { opacity: 1; }
.model-sheet-backdrop[hidden] { display: none; }

.model-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 1401;
  max-height: 76vh;
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  transform: translateY(100%);
  transition: transform .24s ease;
}
.model-sheet.is-open { transform: translateY(0); }
.model-sheet[hidden] { display: none; }

.model-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  font: 600 15px/1 var(--font-sans);
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.model-sheet-close {
  border: 0; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.model-sheet-body { overflow-y: auto; padding: 8px 10px 22px; -webkit-overflow-scrolling: touch; }
.model-sheet-group {
  font: 700 11px/1 var(--font-display, system-ui);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
  padding: 14px 8px 6px;
}
.model-sheet-item {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px; margin: 2px 0;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--text);
  font: 500 15px/1.1 var(--font-sans); cursor: pointer;
}
.model-sheet-item:hover { background: var(--menu-hover); }
.model-sheet-item.is-active { background: var(--focus, rgba(248,130,0,.14)); color: var(--accent); font-weight: 600; }
.model-sheet-item.is-disabled { opacity: .4; cursor: default; }
