/* FNI: filtry sklepu po atrybutach (natywne widżety Woo). Przycisk „Filtry” nad listą; komputer: szuflada z lewej, telefon: okno od dołu. */

.fni-filters {
    margin: 0;
}

.fni-filters__group {
    margin: 0 0 18px;
    padding: 0 0 14px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.fni-filters__title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.fni-filters ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.fni-filters .woocommerce-widget-layered-nav-list__item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 0;
    font-size: 15px;
    line-height: 1.3;
}

.fni-filters .woocommerce-widget-layered-nav-list__item a {
    display: inline-flex;
    -webkit-user-select: none;
    user-select: none;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

/* pole wyboru jak przy punkcie odbioru */
.fni-filters .woocommerce-widget-layered-nav-list__item a::before {
    content: "";
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    box-sizing: border-box;
    border: 2px solid #6b7488;
    border-radius: 4px;
    background: #fff;
}

.fni-filters .woocommerce-widget-layered-nav-list__item--chosen a::before {
    border-color: var(--global-palette1, #1f5fd1);
    background: var(--global-palette1, #1f5fd1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12l5 5 9-10' fill='none' stroke='white' stroke-width='3'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.fni-filters .woocommerce-widget-layered-nav-list__item .count {
    color: #6b7488;
    font-size: 13px;
}

/* przycisk w wierszu Kadence „Wyświetlanie…/sortowanie” */
.fni-filters-top {
    display: flex;
    align-items: center;
    margin: 0 16px 0 0;
}

.fni-filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 9px 16px;
    border: 1px solid #6b7488;
    border-radius: 999px;
    background: #fff;
    color: #1a202c;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
}

.fni-filters-top .fni-filters-toggle {
    margin: 0;
}

/* po dotknięciu (:focus/:active) jak po najechaniu; button.… silniejszy niż button:focus/:active Kadence (niebieskie tło i cień) */
.fni-filters-toggle:hover,
.fni-filters-toggle:focus-visible,
button.fni-filters-toggle:focus,
button.fni-filters-toggle:active {
    border-color: var(--global-palette1, #1f5fd1);
    background: #fff;
    color: #1a202c;
    box-shadow: none;
}

.fni-filters-toggle__count {
    min-width: 20px;
    padding: 2px 6px;
    box-sizing: border-box;
    border-radius: 999px;
    background: var(--global-palette1, #1f5fd1);
    color: #fff;
    font-size: 12px;
    text-align: center;
}

.fni-filters-sheet[hidden] {
    display: none;
}

.fni-filters-sheet {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100000;
}

.fni-filters-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
}

.fni-filters-sheet__panel {
    position: absolute;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: #fff;
}

.fni-filters-sheet__close {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #1a202c;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.fni-filters-sheet__close:hover,
.fni-filters-sheet__close:focus-visible {
    background: transparent;
    color: var(--global-palette1, #1f5fd1);
}

.fni-filters-sheet__title {
    margin: 0 36px 12px 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: #1a202c;
}

.fni-filters-sheet__content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

/* licznik wybranych (także niezatwierdzonych) i „Wyczyść” nad „Pokaż produkty” */
.fni-filters-sheet__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,.08);
    color: #1a202c;
    font-size: 15px;
}

.fni-filters-sheet__clear {
    padding: 4px 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--global-palette1, #1f5fd1);
    font-size: 15px;
    text-decoration: underline;
    cursor: pointer;
}

.fni-filters-sheet__clear:hover,
.fni-filters-sheet__clear:focus-visible {
    background: transparent;
    color: var(--global-palette1, #1f5fd1);
    text-decoration: none;
}

.fni-filters-sheet__clear:disabled {
    visibility: hidden;
}

.fni-filters-sheet__done {
    margin-top: 10px;
    padding: 14px;
    border: 0;
    border-radius: 10px;
    background: var(--global-palette1, #1f5fd1);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

html.fni-filters-open {
    overflow: hidden;
}

/* komputer: szuflada z lewej, wysuwana jak mini-koszyk Kadence */
@media (min-width: 1025px) {
    .fni-filters-sheet__backdrop {
        opacity: 0;
        transition: opacity .25s ease-in-out;
    }

    .fni-filters-sheet__panel {
        top: 0;
        bottom: 0;
        left: 0;
        width: 400px;
        max-width: 90%;
        padding: 22px 24px 24px;
        box-shadow: 0 0 2rem 0 rgba(0,0,0,.15);
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.77,.2,.05,1);
    }

    .fni-filters-sheet.is-open .fni-filters-sheet__backdrop {
        opacity: 1;
    }

    .fni-filters-sheet.is-open .fni-filters-sheet__panel {
        transform: none;
    }

    .admin-bar .fni-filters-sheet__panel {
        top: 32px;
    }
}

@media (min-width: 1025px) and (prefers-reduced-motion: reduce) {
    .fni-filters-sheet__backdrop,
    .fni-filters-sheet__panel {
        transition: none;
    }
}

/* telefon i tablet: okno od dołu */
@media (max-width: 1024px) {
    .fni-filters-sheet__panel {
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 88vh;
        padding: 22px 16px calc(16px + env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
    }

    .fni-filters-sheet .woocommerce-widget-layered-nav-list__item {
        padding: 8px 0;
        font-size: 16px;
    }
}

/* tekst „Wyświetlanie…” na wysokości środka przycisku */
.fni-filters-top + .kadence-woo-results-count {
    align-self: center;
}

/* telefon: przycisk w osobnej linii nad „Wyświetlanie…” (wiersz Kadence zawija się) */
@media (max-width: 767px) {
    .fni-filters-top {
        flex: 0 0 100%;
        margin: 0 0 14px;
    }
}

/* Przycisk „Ukrywanie niedostępnych produktów” (HideUnavailable, P3): stały napis, stan kolorem w stylu „Filtry”.
 * Wyłączony (wszystko widać) = białe tło; włączony (niedostępne ukryte) = błękitne tło i akcent motywu, aria-pressed="true".
 * Id w selektorze: silniejszy niż .woocommerce button.button Kadence. */
.filtr-brakow-wrapper {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-bottom: 30px;
}

.filtr-brakow-wrapper[hidden] {
    display: none;
}

.filtr-brakow-wrapper #przycisk-ukryj-braki.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 40px;
    max-width: 100%;
    margin: 0;
    padding: 9px 16px;
    border: 1px solid #6b7488;
    border-radius: 999px;
    background: #fff;
    color: #1a202c;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    text-align: center;
    white-space: normal;
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.filtr-brakow-wrapper #przycisk-ukryj-braki.button:hover,
.filtr-brakow-wrapper #przycisk-ukryj-braki.button:focus-visible,
.filtr-brakow-wrapper #przycisk-ukryj-braki.button:focus,
.filtr-brakow-wrapper #przycisk-ukryj-braki.button:active {
    border-color: var(--global-palette1, #1f5fd1);
    background: #fff;
    color: #1a202c;
    box-shadow: none;
}

.filtr-brakow-wrapper #przycisk-ukryj-braki.button.is-on,
.filtr-brakow-wrapper #przycisk-ukryj-braki.button.is-on:hover,
.filtr-brakow-wrapper #przycisk-ukryj-braki.button.is-on:focus-visible,
.filtr-brakow-wrapper #przycisk-ukryj-braki.button.is-on:focus,
.filtr-brakow-wrapper #przycisk-ukryj-braki.button.is-on:active {
    border-color: var(--global-palette1, #1f5fd1);
    background: rgba(31,95,209,.12);
    color: var(--global-palette1, #1f5fd1);
}

/* telefon i tablet: do lewej, tuż nad „Filtry”, odstęp jak „Filtry” → „Wyświetlanie…” */
@media (max-width: 1024px) {
    .filtr-brakow-wrapper {
        justify-content: flex-start;
        margin-bottom: 14px;
    }
}

/* P4: podgląd wyników w trakcie wyboru (panel pobiera listy po nowych filtrach) */
.fni-filters-sheet.is-loading .fni-filters-sheet__content {
    opacity: .6;
    transition: opacity .15s;
}

.fni-filters-sheet__done[disabled] {
    opacity: .55;
    cursor: not-allowed;
}
