/* ================================================
   Location Filter – Neo-Brutalism
   Nutzt die Tokens aus variables.css
   ================================================ */

/* Wrapper: Zentriert die Filter-Leiste */
.location-filter-wrapper {
    margin: var(--spacing-sm) 0;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 10;
}

/* Tab-Leiste: Pillenform, kein overflow:hidden (Dropdown braucht Platz) */
.location-filter-tabs {
    display: inline-flex;
    background: var(--color-white);
    border: var(--brutal-border);
    border-radius: var(--brutal-radius);
    overflow: visible;
    box-shadow: var(--brutal-shadow-lg);
}

/* Einzelner Tab-Button */
.filter-tab {
    background: transparent;
    border: none;
    border-right: var(--brutal-border);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-snappy);
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

/* Verhindern, dass Icons gestaucht werden */
.filter-tab i {
    flex-shrink: 0;
}

/* Lange Label-Texte vernünftig kürzen (ellipsis) */
.filter-tab span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Erster Tab: Linke Ecke */
.location-filter-tabs> :first-child {
    border-radius: var(--brutal-radius) 0 0 var(--brutal-radius);
}

/* Letzter Tab: Rechte Ecke, kein rechter Border */
.location-filter-tabs> :last-child,
.location-filter-tabs> :last-child .filter-tab {
    border-right: none;
    border-radius: 0 var(--brutal-radius) var(--brutal-radius) 0;
}

/* Bezirk-Dropdown Wrapper */
.filter-tab-dropdown {
    position: relative;
}

/* Hover-Effekt */
.filter-tab:hover:not(.disabled) {
    background: var(--color-yellow);
    color: var(--text-on-bright);
}

/* Aktiver Tab – Gelb wie im Header-Menü */
.filter-tab.active {
    background: var(--color-yellow);
    color: var(--text-on-bright);
    font-weight: 800;
}

/* Deaktivierter Tab (keine PLZ vorhanden) */
.filter-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-muted);
    color: var(--text-disabled);
}

/* ------------------------------------------------
   Bezirk-Dropdown (Desktop)
   ------------------------------------------------ */
.bezirk-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg-canvas);
    border: var(--brutal-border);
    border-radius: var(--brutal-radius);
    box-shadow: var(--brutal-shadow-lg);
    min-width: 280px;
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.bezirk-menu.show {
    display: block;
}

/* Einzelner Bezirk-Eintrag */
.bezirk-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    padding: var(--spacing-xs);
    border: none;
    background: transparent;
    border-bottom: var(--brutal-border);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-ink);
    cursor: pointer;
    transition: var(--transition-fast);
}

.bezirk-item:last-child {
    border-bottom: none;
}

.bezirk-item:hover {
    background: var(--color-yellow);
    color: var(--text-on-bright);
}

.bezirk-item.active {
    background: var(--color-ink);
    color: var(--color-bg-canvas);
    font-weight: 800;
}

/* Häkchen-Icon: Nur bei .active sichtbar */
.bezirk-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
    border: 2px solid var(--color-ink);
    border-radius: 3px;
    background: transparent;
    transition: var(--transition-fast);
}

.bezirk-check i {
    font-size: 0.8rem;
    opacity: 0;
    transition: var(--transition-fast);
}

.bezirk-item.active .bezirk-check {
    background: var(--color-yellow);
    border-color: var(--color-yellow);
}

.bezirk-item.active .bezirk-check i {
    opacity: 1;
    color: var(--text-on-bright);
}


/* Header im Menu (nur Mobile sichtbar) */
.bezirk-menu-header {
    display: none;
}

/* ------------------------------------------------
   Mobile: Bottom-Sheet statt Dropdown
   ------------------------------------------------ */
@media (max-width: 768px) {
    .location-filter-wrapper {
        margin: var(--spacing-xs) 0;
    }

    .location-filter-tabs {
        width: 100%;
        max-width: 100%;
    }

    .filter-tab {
        flex: 0 1 auto;
        min-width: 0;
        /* Elementar für Flexbox Text-Truncation */
        justify-content: center;
        padding: var(--spacing-xs);
        font-size: 0.85rem;
        gap: 0.25rem;
    }

    /* Meine Gegend und Berlin & Welt sollen sich dynamisch anpassen */
    .filter-tab[data-filter="local"],
    .filter-tab[data-filter-trigger="berlin-welt"] {
        flex: 1 1 auto;
    }

    /* Wrapper für das Bezirks-Dropdown darf flexibel wachsen und schrumpfen */
    .filter-tab-dropdown {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
    }

    /* Der Button im Wrapper nimmt den gesamten Platz ein */
    .filter-tab-dropdown .filter-tab {
        width: 100%;
        flex: 1;
    }

    /* Zentriertes Modal statt Bottom Sheet (Bottom-Nav Verdeckung) */
    .bezirk-menu {
        position: fixed;
        left: 50%;
        top: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: 90%;
        min-width: unset;
        max-width: 400px;
        max-height: 75vh;
        border-radius: var(--brutal-radius);
        border: var(--brutal-border);
        box-shadow: var(--brutal-shadow-lg);
        transition: none;
        z-index: 1000;
    }

    .bezirk-menu.show {
        transform: translate(-50%, -50%);
    }

    /* Mobile Header im Bottom-Sheet */
    .bezirk-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem var(--spacing-sm);
        border-bottom: var(--brutal-border);
        background: var(--color-ink);
        color: var(--color-bg-canvas);
    }

    .bezirk-menu-header h3 {
        margin: 0;
        font-size: 1.05rem;
        font-weight: 800;
    }

    .close-bezirk-menu {
        background: transparent;
        border: none;
        color: var(--color-bg-canvas);
        font-size: 1.5rem;
        cursor: pointer;
    }

    .bezirk-item {
        padding: 0.5rem var(--spacing-sm);
        font-size: 0.9rem;
    }

}