/**
 * Erklaerfenster fuer Lieferkosten und Servicegebuehr.
 *
 * Lag bis zum 26.08.2026 inline in checkout-finalize.php und galt damit nur
 * fuer die Bestelluebersicht. Warenkorb und Kasse zeigten denselben Posten
 * ohne diese Auskunft. Jetzt eine Datei fuer alle drei.
 */

.fee-info-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 2147483640;
    display: none;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
             env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

/* Die Breitenangaben in dieser Datei rechnen Polsterung und Rand mit ein.
   Ohne diese Zeile haengt das Fenster davon ab, dass die einbettende Seite
   border-box global setzt - auf dem Telefon schoben die Karten sonst eine
   Bildlaufleiste unter die Liste. */
.fee-info-overlay *,
.fee-info-overlay *::before,
.fee-info-overlay *::after { box-sizing: border-box; }

.fee-info-overlay:not(.hidden) { display: flex; }
.fee-info-overlay.hidden { display: none !important; }

.fee-info-card {
    background: #fff;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

@media (max-width: 640px) {
    .fee-info-card {
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
}

.fee-info-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.fee-info-title { margin: 0; font-size: 1rem; font-weight: 600; color: #111827; }

.fee-info-close {
    appearance: none;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
}

.fee-info-close:hover { background: #f3f4f6; color: #111827; }

.fee-info-body { padding: 1rem 1.25rem; overflow-y: auto; flex: 1; }
.fee-info-body p { color: #374151; line-height: 1.5; margin: 0 0 .75rem 0; font-size: .9rem; }

.fee-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: .75rem;
    font-size: .85rem;
}

.fee-info-table th,
.fee-info-table td {
    padding: .5rem;
    border-bottom: 1px solid #f3f4f6;
    text-align: left;
}

.fee-info-table th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    position: sticky;
    top: 0;
}

.fee-info-table td:nth-child(n+2),
.fee-info-table th:nth-child(n+2) { text-align: right; white-space: nowrap; }

.fee-info-empty,
.fee-info-leer { color: #9ca3af; text-align: center; padding: 1rem; font-size: .85rem; }
.fee-info-leer.hidden { display: none; }

/* ------------------------------------------------------ Suchen und Blaettern */

.fee-info-filter { margin-top: .75rem; }

.fee-info-suchfeld {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: .875rem;
    color: #111827;
    background: #fff;
}

.fee-info-suchfeld:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

.fee-info-blaettern {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: .75rem;
}

.fee-info-blaettern[hidden] { display: none; }

.fee-info-blatt-btn {
    appearance: none;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.fee-info-blatt-btn:hover:not(:disabled) { background: #f3f4f6; }

.fee-info-blatt-btn:disabled {
    opacity: .4;
    cursor: default;
}

.fee-info-seitenstand {
    font-size: .8rem;
    color: #6b7280;
    min-width: 3.5rem;
    text-align: center;
}

/* ------------------------------------------------------------- Sortieren */

/* Der Knopf fuellt die Kopfzelle ganz aus: so trifft auch ein Daumen neben
   dem Wort noch die Spalte, nicht den Rand daneben. */
.fee-info-table th { padding: 0; }

.fee-info-sort {
    appearance: none;
    background: transparent;
    border: 0;
    width: 100%;
    padding: .5rem;
    display: flex;
    align-items: center;
    gap: .3rem;
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
}

.fee-info-table th:nth-child(n+2) .fee-info-sort { justify-content: flex-end; }

.fee-info-sort:hover { background: #f3f4f6; color: #111827; }

.fee-info-sort:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
}

/* Der Pfeil steht immer im Fluss, auch unsichtbar: sonst springt die
   Kopfzeile bei jedem Klick um seine Breite. */
.fee-info-sort-pfeil {
    flex: 0 0 auto;
    font-size: .9em;
    line-height: 1;
    opacity: 0;
    transition: transform .15s ease;
}

.fee-info-sort-pfeil::before { content: "\2191"; }

.fee-info-table th[aria-sort="ascending"],
.fee-info-table th[aria-sort="descending"] { color: #111827; }

.fee-info-table th[aria-sort="ascending"] .fee-info-sort-pfeil { opacity: 1; }

.fee-info-table th[aria-sort="descending"] .fee-info-sort-pfeil {
    opacity: 1;
    transform: rotate(180deg);
}

/* ------------------------------------------- Telefon: Tabelle wird Liste */

@media (max-width: 560px) {
    .fee-info-body { padding: .9rem; }

    /* Vier Spalten nebeneinander passen auf kein Telefon. Bis zum 16.10.2026
       schob die Tabelle die Auskunft stattdessen seitwaerts aus dem Fenster:
       "Kostenlos ab" - die Spalte, wegen der man nachschaut - stand jenseits
       des rechten Randes. Jetzt wird jede Zeile eine Karte. */
    .fee-info-table,
    .fee-info-table tbody,
    .fee-info-table tbody tr,
    .fee-info-table tbody td { display: block; width: 100%; }

    /* Das hidden-Attribut setzt display:none - und verliert gegen die
       Blockregel darueber. Ohne diese Zeile zeigte das Blaettern alle Orte
       auf einmal. */
    .fee-info-table tbody tr[hidden],
    .fee-info-table thead[hidden] { display: none; }

    /* Die Kopfzeile bleibt und wird zur Sortierleiste: dieselben Knoepfe,
       kein zweites Markup, das irgendwann auseinanderlaeuft. */
    .fee-info-table thead { display: block; }

    .fee-info-table thead tr {
        display: flex;
        flex-wrap: wrap;
        gap: .35rem;
    }

    .fee-info-table th {
        flex: 0 1 auto;
        background: transparent;
        border-bottom: 0;
        position: static;
    }

    .fee-info-table th .fee-info-sort,
    .fee-info-table th:nth-child(n+2) .fee-info-sort {
        justify-content: center;
        border: 1px solid #e5e7eb;
        border-radius: 999px;
        background: #f9fafb;
        padding: .3rem .65rem;
        font-size: .68rem;
        white-space: nowrap;
    }

    .fee-info-table th[aria-sort="ascending"] .fee-info-sort,
    .fee-info-table th[aria-sort="descending"] .fee-info-sort {
        border-color: #c7d2fe;
        background: #eef2ff;
        color: #3730a3;
    }

    .fee-info-table tbody tr {
        border: 1px solid #f3f4f6;
        border-radius: 10px;
        padding: .55rem .7rem;
        margin-top: .5rem;
    }

    .fee-info-table tbody td {
        border-bottom: 0;
        padding: .15rem 0;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: .75rem;
        text-align: right;
    }

    /* Der Ort ist die Ueberschrift der Karte, kein Wertepaar. */
    .fee-info-table tbody td:first-child {
        display: block;
        text-align: left;
        font-weight: 600;
        font-size: .95rem;
        color: #111827;
        margin-bottom: .2rem;
    }

    /* Die Beschriftung kommt aus data-label - demselben Text, der am Rechner
       in der Kopfzeile steht. */
    .fee-info-table tbody td:not(:first-child)::before {
        content: attr(data-label);
        flex: 1 1 auto;
        text-align: left;
        color: #6b7280;
        font-weight: 500;
        white-space: normal;
    }
}
