/* Hersteller-Filter (Shortcode [wcbr_hersteller_filter])
 * Nutzt die Astra/Elementor Global-Tokens, mit Fallbacks auf die Shop-Farben.
 */
.wcbr-hf-bar {
    --hf-bdx:   var(--ast-global-color-0, #8e153c);
    --hf-cream: var(--ast-global-color-2, #f9f3ed);
    --hf-green: var(--ast-global-color-4, #4da209);
    --hf-ink:   var(--ast-global-color-8, #33302d);
    --hf-taupe: var(--ast-global-color-7, #ccb09a);

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin: 18px 0;
    font-family: inherit;
}

/* Seiten-Navigation (Astra) muss über dem Filter-Dropdown bleiben.
 * Wichtig: der maßgebliche Stacking-Context am Root ist `.site-header`
 * (Astra: position:relative; z-index:99). `.main-header-bar` (z-index:4) liegt
 * DARIN, ein Bump dort wirkt nur innerhalb des Headers, nicht am Root.
 * Darum den `.site-header`-Context deutlich über das Dropdown heben. */
.site-header {
    z-index: 9999 !important;
}

/* Dropdown (native <details>) */
.wcbr-hf { position: relative; }

.wcbr-hf > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 15px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(142, 21, 60, .30);
    color: var(--hf-bdx);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}
.wcbr-hf > summary::-webkit-details-marker { display: none; }
.wcbr-hf > summary:focus-visible { outline: 2px solid var(--hf-bdx); outline-offset: 2px; }

.wcbr-hf-trigger__icon { display: inline-flex; line-height: 0; }
.wcbr-hf-trigger__icon svg { width: 15px; height: 15px; }

.wcbr-hf-count {
    background: var(--hf-bdx);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    padding: 3px 7px;
}

.wcbr-hf-caret {
    width: 0; height: 0;
    margin-left: auto; /* Pfeil ans rechte Ende (greift nur bei voller Breite = mobil) */
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform .2s ease;
}
.wcbr-hf[open] .wcbr-hf-caret { transform: rotate(180deg); }

/* Panel */
.wcbr-hf-panel {
    position: absolute;
    z-index: 40; /* über Produkten/Badges (z-index 3), aber unter der Seiten-Navigation */
    top: calc(100% + 8px);
    left: 0;
    width: 280px;
    max-width: 86vw;
    background: #fff;
    border: 1px solid rgba(142, 21, 60, .18);
    border-radius: 14px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .12);
    padding: 8px;
}

.wcbr-hf-search { padding: 4px 4px 8px; }
.wcbr-hf-search__input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 10px;
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
    color: var(--hf-ink);
}
.wcbr-hf-search__input:focus-visible { outline: none; border-color: var(--hf-bdx); }

.wcbr-hf-options { max-height: 260px; overflow: auto; }

.wcbr-hf-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--hf-ink);
    cursor: pointer;
    margin: 0;
}
.wcbr-hf-opt:hover { background: var(--hf-cream); }

/* echte Checkbox unsichtbar, aber fokussierbar */
.wcbr-hf-opt__cb {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    margin: 0;
}

.wcbr-hf-opt__box {
    position: relative;
    flex: none;
    width: 18px; height: 18px;
    border-radius: 5px;
    border: 2px solid rgba(142, 21, 60, .45);
    box-sizing: border-box;
}
.wcbr-hf-opt:has(.wcbr-hf-opt__cb:checked) { color: var(--hf-bdx); }
.wcbr-hf-opt__cb:checked ~ .wcbr-hf-opt__box {
    background: var(--hf-bdx);
    border-color: var(--hf-bdx);
}
.wcbr-hf-opt__cb:checked ~ .wcbr-hf-opt__box::after {
    content: "";
    position: absolute;
    left: 5px; top: 1px;
    width: 4px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.wcbr-hf-opt__cb:focus-visible ~ .wcbr-hf-opt__box {
    outline: 2px solid var(--hf-bdx);
    outline-offset: 2px;
}

.wcbr-hf-opt__count {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--hf-taupe);
}

.wcbr-hf-empty {
    padding: 10px;
    text-align: center;
    color: var(--hf-taupe);
    font-size: 12.5px;
}

/* Footer mit immer sichtbarem „Anwenden“ */
.wcbr-hf-footer {
    padding: 8px 4px 4px;
    margin-top: 4px;
    border-top: 1px solid rgba(0, 0, 0, .07);
}
.wcbr-hf-apply {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    padding: 10px 12px;
    cursor: pointer;
}
/* Hover/Focus/Active dürfen nichts verändern (Theme färbt button:hover sonst grün) */
.wcbr-hf-apply,
.wcbr-hf-apply:hover,
.wcbr-hf-apply:focus,
.wcbr-hf-apply:active {
    background: var(--hf-bdx) !important;
    color: #fff !important;
    filter: none !important;
}
.wcbr-hf-apply:focus-visible { outline: 2px solid var(--hf-bdx); outline-offset: 2px; }

/* Ausgewählte Chips + Reset */
.wcbr-hf-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.wcbr-hf-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px 7px 13px;
    border-radius: 999px;
    font-size: 13px;
    background: rgba(142, 21, 60, .10);
    color: var(--hf-bdx);
    text-decoration: none;
}
.wcbr-hf-chip:hover { background: rgba(142, 21, 60, .16); }
.wcbr-hf-chip__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: rgba(142, 21, 60, .18);
    font-size: 15px;
    line-height: 1;
}

.wcbr-hf-reset {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--hf-bdx);
    opacity: .85;
    text-decoration: none;
}
.wcbr-hf-reset:hover { opacity: 1; }
.wcbr-hf-reset__icon { font-size: 15px; line-height: 1; }

/* Reset als Icon-Button neben dem Trigger (nur mobil sichtbar) */
.wcbr-hf-reset-icon { display: none; }

/* Reset im Dropdown-Footer unter „Anwenden“ (immer sichtbar) */
.wcbr-hf-reset-footer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--hf-bdx);
    text-decoration: none;
    opacity: .9;
}
.wcbr-hf-reset-footer:hover { opacity: 1; }
.wcbr-hf-reset-footer svg { width: 15px; height: 15px; }

/* Mobil: Trigger volle Breite */
@media (max-width: 600px) {
    .wcbr-hf { flex: 1 1 auto; min-width: 0; }
    .wcbr-hf > summary { width: 100%; box-sizing: border-box; }
    .wcbr-hf-panel { width: 100%; }

    .wcbr-hf-chips { flex-basis: 100%; }   /* Chips in eigene Zeile unter dem Trigger */
    .wcbr-hf-reset { display: none; }       /* Text-Reset der Chip-Zeile aus (Icon-Button übernimmt) */

    .wcbr-hf-reset-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: none;
        width: 44px;
        height: 44px;
        border-radius: 14px;
        background: #fff;
        border: 1px solid rgba(142, 21, 60, .30);
        color: var(--hf-bdx);
        text-decoration: none;
    }
    .wcbr-hf-reset-icon svg { width: 20px; height: 20px; }
}
