/* =====================================================================
 * TABELLENFILTER — Suchen und Filtern in der Kopfzeile
 * ---------------------------------------------------------------------
 * Gehoert zu www/tabellenfilter.js. Das Skript baut in jede <th>, die
 * data-tf traegt, einen Knopf und dazu ein Panel. Hier stehen nur die
 * Stile; welche Spalte was kann, entscheidet die jeweilige Seite.
 *
 * Zwei Eigenheiten, die den Aufbau erklaeren:
 *
 *   1. Die Panels haengen am <body> und liegen fest (position: fixed).
 *      Sonst schneidet sie der waagerechte Rollbereich der Tabelle ab
 *      (.ad-table-scroll hat overflow-x: auto) — genau daran scheiterte
 *      die naheliegende Loesung mit position: absolute im <th>.
 *   2. Unter 1024px blendet 01-login-register-content.css alle <th> aus
 *      und stellt die Zeilen als Karten dar. Dann uebernehmen die Knoepfe
 *      in der Leiste ueber der Tabelle (.tf-leiste); es ist dasselbe
 *      Panel, nur an einem anderen Anker.
 * ===================================================================== */

/* --- Knopf in der Kopfzeile ---------------------------------------- */
.tf-knopf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: left;
    cursor: pointer;
}
.tf-knopf:hover .tf-ic { color: var(--tigers-yellow); }
.tf-ic {
    font-size: 0.62rem;
    color: rgba(var(--ink) / 0.4);
    transition: color 0.15s ease;
}
th.tf-an .tf-ic { color: var(--tigers-yellow); }
th.tf-an .tf-knopf { color: var(--tigers-yellow); }

/* --- Leiste ueber der Tabelle -------------------------------------- */
.tf-leiste {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.tf-mknopf {
    display: none;                      /* nur in der Kartenansicht, s. u. */
    align-items: center;
    gap: 6px;
    background: rgba(var(--ink) / 0.08);
    border: 1px solid rgba(var(--ink) / 0.2);
    color: rgba(var(--ink) / 0.85);
    border-radius: 10px;
    padding: 7px 11px;
    font-size: 0.78rem;
    cursor: pointer;
}
.tf-mknopf.tf-an {
    background: var(--tigers-yellow);
    border-color: var(--tigers-yellow);
    color: var(--tigers-black);
    font-weight: 700;
}
.tf-stand {
    font-size: 0.75rem;
    color: rgba(var(--ink) / 0.6);
}
.tf-reset {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--tigers-yellow);
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
}
.tf-leiste[hidden] { display: none; }

/* --- Panel ---------------------------------------------------------- */
.tf-panel {
    position: fixed;
    /* ueber der Navigationsleiste (die hat z-index 1000, position: sticky) */
    z-index: 1100;
    display: none;
    min-width: 210px;
    max-width: 280px;
    /* Flaeche und Schrift beide aus dem Theme: --tigers-black ist im
       hellen Modus schwarz, waehrend rgb(var(--ink)) dort ebenfalls
       dunkel wird - das ergab schwarze Schrift auf schwarzem Grund. */
    background: var(--bg-flaeche);
    border: 1px solid rgba(var(--ink) / 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 8px 24px var(--glass-black-30);
    color: rgb(var(--ink));
}
.tf-panel.tf-offen { display: block; }
.tf-panel-titel {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: rgba(var(--ink) / 0.6);
    margin-bottom: 8px;
}
.tf-panel input[type="text"] {
    width: 100%;
    background: var(--bg-flaeche);
    color: var(--text-input);
    border: 1px solid rgba(var(--ink) / 0.35);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.8rem;
}
.tf-liste {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 8px;
}
.tf-wahl {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    margin-bottom: 6px;
    cursor: pointer;
}
.tf-wahl input { margin: 0; }
.tf-panel-fuss {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(var(--ink) / 0.14);
}
.tf-panel-fuss button {
    background: transparent;
    border: none;
    padding: 0;
    color: rgba(var(--ink) / 0.75);
    font-size: 0.74rem;
    text-decoration: underline;
    cursor: pointer;
}
.tf-panel-fuss button:hover { color: var(--tigers-yellow); }

/* --- Sortieren (opt-in per data-tf-sortieren, 2026-10-24) ------------------ */
.tf-sort { display: flex; gap: 6px; margin-bottom: 8px; }
.tf-sortknopf,
.tf-sortknopf:hover,
.tf-sortknopf:focus-visible {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(var(--ink) / 0.08);
    border: 1px solid rgba(var(--ink) / 0.25);
    color: rgb(var(--ink));
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 0.74rem;
    cursor: pointer;
    transform: none;
}
.tf-sortknopf:hover { background: rgba(var(--ink) / 0.16); }
.tf-sortknopf[aria-pressed="true"],
.tf-sortknopf[aria-pressed="true"]:hover {
    background: var(--tigers-yellow);
    border-color: var(--tigers-yellow);
    color: var(--tigers-black);
    font-weight: 700;
}
.tf-sortic { font-size: 0.62rem; color: var(--tigers-yellow); }
.tf-sortic[hidden] { display: none; }   /* .fa-solid setzt display und schluege sonst das hidden-Attribut */

/* --- Leermeldung ----------------------------------------------------- */
.tf-leer td {
    text-align: center;
    color: rgba(var(--ink) / 0.6);
    font-style: italic;
    padding: 18px 10px;
}

/* --- Kartenansicht --------------------------------------------------- */
/* Gleicher Umbruch wie die Karten-Darstellung der Tabellen (1024px):
   dort gibt es keine sichtbare Kopfzeile mehr, die Knoepfe wandern in
   die Leiste. */
@media (max-width: 1024px) {
    .tf-mknopf { display: inline-flex; }
    .tf-leiste { display: flex; }
    .tf-leer td { display: block; width: 100%; }
    tr.tf-kopf { display: none; }

    /* Handy/Tablet: Panel als festes Blatt unten, volle Breite. Es muss nicht
       neben dem Ausloeser positioniert werden und bleibt beim Einblenden der
       Tastatur und beim Scrollen stehen. */
    .tf-panel {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        max-width: none;
        border-radius: 14px 14px 0 0;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    }
    .tf-panel input[type="text"] { font-size: 16px; padding: 10px 12px; } /* 16px: kein iOS-Zoom */
    .tf-liste { max-height: 40vh; }
    .tf-wahl { font-size: 0.95rem; min-height: 44px; margin-bottom: 0; }
    .tf-wahl input { width: 20px; height: 20px; }
    .tf-panel-fuss button { font-size: 0.9rem; min-height: 44px; padding: 0 8px; }
    .tf-mknopf { min-height: 44px; font-size: 0.88rem; padding: 8px 14px; }
    .tf-sortknopf, .tf-sortknopf:hover, .tf-sortknopf:focus-visible { min-height: 44px; font-size: 0.9rem; }
}

/* --- Rueckname des globalen Knopf-Hovers ------------------------------ */
/* 00-basis-nav.css setzt button:hover auf --bg-table-row-dark (#f1f3f5 -
   auch im Dunkelmodus) und hebt den Knopf um 1px an. In der Kopfzeile
   ergibt das einen hellen Balken unter heller Schrift. Hier deshalb
   ausdruecklich zurueckgenommen; die Ruecknahme gewinnt ueber die
   Spezifitaet (Klasse + :hover schlaegt Element + :hover). */
.tf-knopf:hover,
.tf-panel-fuss button:hover,
.tf-reset:hover {
    background: transparent;
    transform: none;
}
.tf-mknopf:hover {
    background: rgba(var(--ink) / 0.16);
    transform: none;
}
.tf-mknopf.tf-an:hover {
    background: var(--tigers-yellow);
    color: var(--tigers-black);
}
