/* DachStack: Seite Suchen. Suchzeile, Filter-Knöpfe mit Fenster, aktive Filter als Marken, darunter die Treffer als Tabelle.
   Farbe zeigt den Zustand: ein Filter ohne Auswahl ist grau (vertiefte Fläche), mit Auswahl hellblau mit blauer Schrift und dem Wert dahinter.
   Rechteckig mit der Rundung der Seite, keine Pillen. Felder, Knöpfe und Kästchen nach den gemeinsamen Regeln aus core.css. */

.suche-seite { padding-top: var(--space-6); padding-bottom: var(--space-3); }

.suche-anmelden { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-4); padding: var(--space-6); background: var(--color-surface); border-radius: var(--radius); }
.suche-anmelden[hidden], .suche-ergebnis[hidden] { display: none; }

.suche-leiste { padding: var(--space-5); }
.suche-form--gesperrt { opacity: 0.55; }

/* Suchzeile */
.suche-q { position: relative; }
.suche-q .icon { position: absolute; left: var(--space-4); top: 50%; transform: translateY(-50%); color: var(--color-text-3); pointer-events: none; }
.suche-q .input { width: 100%; padding-left: calc(var(--space-4) * 2 + 20px); font-size: var(--text-lg); }

/* Filter-Knöpfe */
.filterleiste { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }
.filter { position: relative; }
.filter-knopf { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-4); background: var(--color-sunken); color: var(--color-text); border: 0; border-radius: var(--radius); font-family: var(--font-sans); font-size: var(--text-base); font-weight: var(--weight-regular); cursor: pointer; white-space: nowrap; }
.filter-knopf:hover { background: var(--color-line); }
.filter-knopf:disabled { opacity: 0.55; cursor: default; }
.filter-knopf:disabled:hover { background: var(--color-sunken); }
.filter-wert { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; font-weight: var(--weight-semibold); }
.filter-wert:empty { display: none; }
.filter.aktiv .filter-knopf { background: var(--color-brand-soft); color: var(--color-brand-text); }
.filter.aktiv .filter-name { font-weight: var(--weight-semibold); }
.filter-knopf[aria-expanded="true"] .icon { transform: rotate(180deg); }
.filter-knopf .icon { width: 16px; height: 16px; flex: none; }

/* Fenster unter dem Knopf */
.filter-fenster { position: absolute; z-index: 40; left: 0; top: calc(100% + var(--space-1)); width: 22rem; max-width: calc(100vw - 2 * var(--space-4)); display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-line-strong); border-radius: var(--radius); }
.filter-fenster[hidden] { display: none; }
.filter-fenster.rechts { left: auto; right: 0; }
.filter-kopf { display: flex; flex-direction: column; gap: var(--space-3); }
.filter-art { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.filter-art label { font-size: var(--text-base); color: var(--color-text); }
.filter-suche { width: 100%; }
.filter-liste { list-style: none; max-height: 16rem; overflow-y: auto; overscroll-behavior: contain; }
.filter-gruppe { padding: var(--space-3) 0 var(--space-1); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-3); }
.filter-option label { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min); padding: 0 var(--space-2); font-size: var(--text-base); color: var(--color-text); cursor: pointer; }
.filter-option label:hover { background: var(--color-brand-soft); }
.filter-leer { color: var(--color-text-2); font-size: var(--text-sm); }
.filter-fuss { display: flex; justify-content: flex-end; }
.filter-text { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-text label { font-size: var(--text-sm); color: var(--color-text-3); }

.filter-fertig { display: none; }

/* Aktive Filter als Marken, einzeln entfernbar */
.filter-aktiv { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-top: var(--space-4); }
.filter-aktiv[hidden] { display: none; }
.marke { display: inline-flex; align-items: center; min-height: var(--tap-min); padding-left: var(--space-3); background: var(--color-brand-soft); border-radius: var(--radius); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-brand-text); }
.marke-weg { display: inline-flex; align-items: center; justify-content: center; width: var(--tap-min); height: var(--tap-min); background: none; border: 0; color: var(--color-brand-text); cursor: pointer; border-radius: var(--radius); }
.marke-weg:hover { background: var(--color-line); }
.marke-weg .icon { width: 16px; height: 16px; }

/* Zurücksetzen rechts */
.suche-knoepfe { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-4); }

/* Treffer als Tabelle: Kopfzeile, darunter eine Zeile je Firma */
.suche-ergebnis { margin-top: var(--space-6); }
.suche-ergebnis h2 { min-height: 1.2em; }
.suche-kopf { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-4); }
.suche-laden { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.suche-aktion { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.suche-bericht { margin-top: var(--space-4); }
.suche-tabelle { background: var(--color-surface); border-radius: var(--radius); padding: 0 var(--space-5); }
.suche-kopfzeile, .suche-zeile { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 2fr) minmax(0, 1.5fr); gap: var(--space-4); align-items: center; }
.suche-kopfzeile { padding: var(--space-4) 0; font-size: var(--text-sm); color: var(--color-text-3); }
.suche-treffer { list-style: none; }
.suche-zeile { padding: var(--space-4) 0; border-top: 1px solid var(--color-line); }
.suche-name { font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.suche-fein { font-size: var(--text-sm); color: var(--color-text-3); overflow-wrap: anywhere; }
.suche-ort, .suche-form-art, .suche-technik { font-size: var(--text-sm); color: var(--color-text-2); overflow-wrap: anywhere; }
.suche-zeile--laedt { animation: suche-puls 1.4s ease-in-out infinite; }
.suche-platzhalter { display: block; height: 20px; background: var(--color-track); border-radius: var(--radius); }
@keyframes suche-puls { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .suche-zeile--laedt { animation: none; } }
.suche-meldung { margin: var(--space-4) 0; font-size: var(--text-sm); color: var(--color-text-2); min-height: 24px; }

/* Meldung zur Dateigrenze: nimmt keinen Platz, solange sie leer ist */
.suche-datei-meldung { margin-bottom: var(--space-3); font-size: var(--text-sm); color: var(--color-text-2); }
.suche-datei-meldung:empty { display: none; }

/* Ansicht Liste oder Karte */
.suche-ansicht { display: flex; gap: var(--space-3); margin-bottom: var(--space-4); }
.suche-ansicht .btn[aria-pressed="true"] { background: var(--color-brand-soft); color: var(--color-brand-text); }
.suche-karte { margin-bottom: var(--space-5); }
.suche-karte[hidden] { display: none; }
.karte-flaeche { height: 30rem; background: var(--color-sunken); border-radius: var(--radius); }
.karte-meldung { min-height: 1.5em; margin-top: var(--space-3); font-size: var(--text-sm); color: var(--color-text-2); }
.karte-hinweis { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-text-3); }
.leaflet-container { font-family: var(--font-sans); background: var(--color-sunken); }
.leaflet-tooltip { border: 1px solid var(--color-line-strong); border-radius: var(--radius); font-size: var(--text-sm); color: var(--color-text); }

.suche-verfeinern { margin-top: var(--space-5); }
.suche-verfeinern[hidden] { display: none; }
.suche-tipp { color: var(--color-text-2); font-size: var(--text-sm); }

@media (max-width: 980px) {
    .karte-flaeche { height: 22rem; }
    .suche-kopfzeile { display: none; }
    .suche-tabelle { padding: 0 var(--space-4); }
    .suche-zeile { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
    .suche-wer { grid-column: 1 / -1; }
    .suche-technik { grid-column: 1 / -1; }
    .suche-aktion { grid-column: 1 / -1; }
    .suche-knoepfe .btn { flex: 1; }
    /* Am Handy: Knöpfe zu zweit, das Fenster steht unten am Bildschirmrand mit „Fertig“ */
    .filterleiste { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter { position: static; }
    .filter-knopf { width: 100%; min-width: 0; justify-content: space-between; gap: var(--space-1); padding: 0 var(--space-2); }
    .filter-knopf .icon { width: 12px; height: 12px; }
    .filter-wert:empty { display: none; }
    .filter-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .filter-wert { max-width: 8ch; }
    .filter-fenster, .filter-fenster.rechts { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 80vh; overflow-y: auto; z-index: 60; border-radius: var(--radius); border-width: 1px; }
    .filter-liste { max-height: 40vh; }
    .filter-fertig { display: inline-flex; }
}
