/* ===== DRK-Suche — gemeinsame Stile (Karte + Zentrale) =====
   EINE Wartungsstelle: diese Datei liegt auf der DRK-Domain und wird von der Karte
   (public/index.html) UND der Zentrale (zentrale.../index.html, cross-origin <link>) geladen.
   Aenderungen am Such-Aussehen NUR hier. Das Markup baut such.js zur Laufzeit.

   EIN Logik-/Farbsatz, zwei Darstellungen: Computer = dunkle schwebende Box,
   Handy (offen) = deckender heller Vollbild-Vorhang. Alle Farben laufen ueber Variablen ->
   der Handy-Vorhang dreht unten im @media nur die Variablen auf hell, keine Regel-Dopplung. */
#suche {
  --s-bg: rgba(20,20,42,0.95); --s-bg-solid: rgba(20,20,42,0.98); --s-bg-chip: #23233c;
  --s-border: #3a3a55; --s-border2: #333; --s-line: #262640;
  --s-hover-bg: rgba(40,40,70,0.97); --s-hover-border: #888;
  --s-fg: #f0f0f0; --s-fg-strong: #fff; --s-fg-btn: #ccc;
  --s-muted: #8a8aa0; --s-muted2: #888; --s-pers: #c2c2d4; --s-pers-ansp: #9fb6d6; --s-mark-fg: #bbb;
  --s-acc: #ffd400; --s-acc-tint: rgba(255,212,0,0.16); --s-acc-tint2: rgba(255,212,0,0.18);
  --s-acc-fg: #ffd400; --s-acc-on: #14142a; --s-hl: rgba(255,212,0,0.38);
  --s-shadow: 0 4px 16px rgba(0,0,0,0.45); --s-shadow-panel: 0 8px 26px rgba(0,0,0,0.55); --s-shadow-filter: 0 6px 20px rgba(0,0,0,0.5);
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1500;
  width: clamp(240px, calc(100vw - 480px), 440px); display: flex; flex-direction: column; gap: 6px; font-family: inherit; }
.such-bar { display: flex; align-items: center; gap: 6px; }
.such-spacer { display: none; }   /* Leerraum-Block fuer den einhaendigen Modus — normal aus, nur am Handy bei aktivem Modus eingeblendet */
.such-inwrap { position: relative; flex: 1; min-width: 0; }
#such-input { width: 100%; box-sizing: border-box; background: var(--s-bg); border: 1px solid var(--s-border);
  border-radius: 8px; padding: 10px 30px 10px 32px; font-size: 14px; color: var(--s-fg); font-family: inherit;
  outline: none; box-shadow: var(--s-shadow); }
#such-input::placeholder { color: var(--s-muted); }
#such-input:focus { border-color: var(--s-acc); }
.such-lupe { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--s-muted); pointer-events: none; }
#such-clear { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); background: none; border: none;
  color: var(--s-muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px; display: none; }
#such-clear:hover { color: var(--s-fg-strong); }
#suche.has-text #such-clear { display: block; }
.such-btn { flex: none; background: var(--s-bg); border: 1px solid var(--s-border); border-radius: 8px; height: 40px;
  min-width: 40px; padding: 0 11px; color: var(--s-fg-btn); font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 5px; box-shadow: var(--s-shadow);
  transition: background .15s, border-color .15s, color .15s; }
.such-btn:hover { background: var(--s-hover-bg); border-color: var(--s-hover-border); color: var(--s-fg-strong); }
#such-filter-btn.aktiv { border-color: var(--s-acc); color: var(--s-acc-fg); }
/* Schliessen-Knopf: nur ein "×" — groesser + exakt mittig im 40er-Kaestchen (font-size hebt das schmale Zeichen an, justify-content der .such-btn zentriert horizontal). */
#such-close { width: 40px; padding: 0; font-size: 24px; line-height: 1; }
.such-fz { background: var(--s-acc); color: var(--s-acc-on); border-radius: 9px; font-size: 11px; font-weight: 800; padding: 0 5px; min-width: 16px; text-align: center; }
#such-counter { display: none; align-items: center; gap: 5px; background: var(--s-acc-tint); border: 1px solid var(--s-acc);
  color: var(--s-acc-fg); border-radius: 8px; height: 40px; padding: 0 11px; font-size: 13px; font-weight: 800; flex: none; }
#suche.hat-mark #such-counter { display: flex; }
/* Filterbereich (klappt unter der Leiste auf) */
#such-filter { display: none; background: var(--s-bg-solid); border: 1px solid var(--s-border2); border-radius: 8px;
  padding: 9px 11px; box-shadow: var(--s-shadow-filter); max-height: calc(100vh - 90px); overflow-y: auto; }
#suche.filter-auf #such-filter { display: block; }
.such-fgrp { margin-bottom: 9px; } .such-fgrp:last-child { margin-bottom: 0; }
.such-fgrp-h { font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--s-muted2); margin-bottom: 5px; font-weight: 700; }
.such-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.such-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--s-bg-chip); border: 1px solid var(--s-border);
  border-radius: 14px; padding: 4px 10px; font-size: 12px; color: var(--s-fg-btn); cursor: pointer; user-select: none; font-weight: 600; }
.such-chip:hover { border-color: var(--s-hover-border); }
.such-chip.an { background: var(--s-acc-tint2); border-color: var(--s-acc); color: var(--s-acc-fg); }
/* Sammel-Schalter 'Alle' je Gruppe — vom gestrichelten Rand klar als Gruppen-Steuerung erkennbar */
.such-chip--all { border-style: dashed; font-weight: 700; margin-right: 3px; }
.such-cdot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
/* Wahl-Einstellung (Haekchen) + Zuruecksetzen-Knopf im Filter-Menue */
.such-fopt { border-top: 1px solid var(--s-border2); padding-top: 9px; }
.such-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--s-fg); font-weight: 600; user-select: none; }
.such-check input { width: 16px; height: 16px; flex: none; accent-color: var(--s-acc); cursor: pointer; margin: 0; }
.such-opt-hint { font-size: 10.5px; color: var(--s-muted2); margin-top: 5px; line-height: 1.4; }
.such-reset { display: block; width: 100%; margin-top: 10px; background: var(--s-bg-chip); border: 1px solid var(--s-border); border-radius: 8px;
  padding: 8px 10px; color: var(--s-fg-btn); font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s, color .15s; }
.such-reset:hover { background: var(--s-hover-bg); border-color: var(--s-hover-border); color: var(--s-fg-strong); }
/* Ergebnisliste */
#such-panel { display: none; background: var(--s-bg-solid); border: 1px solid var(--s-border2); border-radius: 8px;
  box-shadow: var(--s-shadow-panel); max-height: min(60vh, calc(100vh - 120px)); overflow-y: auto; }
#suche.offen #such-panel { display: block; }
.such-hint { padding: 14px 13px; font-size: 12px; color: var(--s-muted2); text-align: center; line-height: 1.5; }
.such-row { display: flex; align-items: stretch; gap: 9px; padding: 8px 9px; border-bottom: 1px solid var(--s-line); cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; }
.such-row:last-child { border-bottom: none; }
.such-row:hover { background: var(--s-line); }
.such-badge { flex: none; align-self: center; min-width: 26px; text-align: center; font-size: 10px; font-weight: 800;
  letter-spacing: 0.4px; color: #fff; border-radius: 5px; padding: 3px 5px; background: #5a6b86; }
.such-badge--LV { background: #c1121f; } .such-badge--RV { background: #d35400; }
.such-badge--KV { background: #3a6ea8; } .such-badge--SV { background: #1f8a70; } .such-badge--OV { background: #6b6b85; }
.such-main { flex: 1; min-width: 0; }
.such-name { font-size: 13px; font-weight: 700; color: var(--s-fg); display: flex; align-items: center; gap: 6px; }
.such-sdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.such-nametxt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.such-ort { color: var(--s-muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.such-pers { font-size: 11.5px; color: var(--s-pers); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.such-pers--ansp { color: var(--s-pers-ansp); }
.such-rolle { color: var(--s-muted2); font-weight: 700; }
/* Treffer-Hervorhebung (Textmarker): gelber, leicht transparenter Hintergrund mit runden Enden.
   NUR Hintergrund + Radius; das winzige horizontale padding wird durch negatives margin exakt
   ausgeglichen -> Textfluss bleibt unveraendert (kein Springen). box-decoration-break: saubere Ecken bei Umbruch. */
.such-hl { background: var(--s-hl); border-radius: 0.5em; padding: 0 0.12em; margin: 0 -0.12em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.such-mark { flex: none; align-self: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--s-border);
  background: var(--s-bg-chip); color: var(--s-mark-fg); font-size: 17px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.such-mark:hover { border-color: var(--s-acc); color: var(--s-acc-fg); }
.such-mark.an { background: var(--s-acc); border-color: var(--s-acc); color: var(--s-acc-on); }
/* Such-Treffer-Bestaetigung: angeklickter Verband leuchtet nach dem Sprung 2x sanft auf.
   Animiert nur die Element-opacity (GPU-freundlich, kollidiert nicht mit dem Flaechen-Stil). */
@keyframes such-blink-kf {
  0%, 100% { opacity: 0; }
  18%      { opacity: 1; }
  40%      { opacity: 0; }
  60%      { opacity: 0; }
  78%      { opacity: 1; }
}
.such-blink-glow { animation: such-blink-kf 1.5s ease-in-out both; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .such-blink-glow { animation: none; opacity: 0.85; }   /* ruhig statt pulsierend; wird nach kurzer Zeit entfernt */
}
@media (max-width: 600px) {
  #suche { top: 8px; left: 8px; right: 8px; transform: none; width: auto; display: none; }  /* Handy: Suchleiste/X/Filter standardmaessig versteckt -> nur ueber die Lupe/den Such-Knopf */
  #such-input { font-size: 16px; }   /* verhindert Auto-Zoom auf iOS */
  #such-panel { max-height: 62vh; }

  /* Handy + geoeffnet = deckender heller VOLLBILD-VORHANG: alles dahinter komplett verdeckt.
     Nur die Farb-Variablen werden auf hell gedreht, dazu Vollbild-Layout: Suchleiste oben fest,
     Trefferliste fuellt den Rest und scrollt. Die Such-Logik bleibt unveraendert. */
  #suche.offen {
    display: flex; position: fixed; inset: 0; width: auto; transform: none; z-index: 4000;   /* display:flex hebt das versteckte #suche (oben) wieder auf, sobald geoeffnet */
    background: #eef0f2; padding: 8px; gap: 8px; overflow: hidden;
    --s-bg: #ffffff; --s-bg-solid: #ffffff; --s-bg-chip: #ffffff;
    --s-border: #d3d7de; --s-border2: #dde1e7; --s-line: #e3e6ec;
    --s-hover-bg: #f1f3f6; --s-hover-border: #b7bdc8;
    --s-fg: #16162a; --s-fg-strong: #000; --s-fg-btn: #3a3a50;
    --s-muted: #888fa0; --s-muted2: #9aa0ac; --s-pers: #54596a; --s-pers-ansp: #2f5a8c; --s-mark-fg: #7c8496;
    --s-acc-tint: rgba(255,212,0,0.30); --s-acc-tint2: rgba(255,212,0,0.34); --s-acc-fg: #14142a; --s-hl: rgba(255,212,0,0.55);
    --s-shadow: 0 1px 4px rgba(20,30,50,0.10); --s-shadow-panel: none; --s-shadow-filter: 0 3px 10px rgba(20,30,50,0.12); }
  #suche.offen .such-bar { flex: none; }
  #suche.offen #such-filter { flex: none; max-height: 38vh; }
  #suche.offen #such-panel { flex: 1; min-height: 0; max-height: none; border: none; box-shadow: none;
    background: transparent; border-radius: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  /* Filter-Menue offen am Handy: bekommt den ganzen Platz (Reset-Knopf erreichbar), Trefferliste tritt zurueck */
  #suche.offen.filter-auf #such-filter { flex: 1; max-height: none; }
  #suche.offen.filter-auf #such-panel { display: none; }

  /* ===== Einhaendiger Modus (NUR Handy) — zentral an body.einhaendig-an gekoppelt =====
     Ein flexibler Leerraum oben schiebt die Such-Bedienzeile nach unten (~80% Hoehe, daumenfreundlich);
     Treffer ordnen sich darunter ein. Weitere Anpassungen koennen hier an body.einhaendig-an andocken.
     body.such-einhaendig greift dieselbe Darstellung TEMPORAER fuer den ?suche-Menue-Einstieg auf der Karte
     (unabhaengig vom globalen Schalter; wird beim Verlassen der Suche wieder entfernt). */
  body.einhaendig-an #suche.offen .such-spacer,
  body.such-einhaendig #suche.offen .such-spacer { display: block; flex: 0 0 auto; height: 78vh; }   /* Hoehe = Ziel-Position der Suchleiste (~80%) — eine Zahl, leicht justierbar */
  body.einhaendig-an #suche.offen #such-panel,
  body.such-einhaendig #suche.offen #such-panel { flex: 1 1 auto; min-height: 0; max-height: none; }   /* Treffer fuellen den Rest unter der Bedienzeile */
  body.einhaendig-an #suche.offen.filter-auf .such-spacer,
  body.such-einhaendig #suche.offen.filter-auf .such-spacer { display: none; }   /* Filter offen: voller Platz wie gewohnt (Reset-Knopf erreichbar) */
}
