/* ═══════════════════════════════════════════════════════════════════════════
   FILTRY, KARTY PRODUKTÓW I KATEGORII — "Quiet Luxury"
   Wspólny arkusz dla sklep.php i oferta.php (oba mają ten sam panel #filter-bar).
   Ładowany PO wbudowanych <style> stron, więc przy równej specyficzności wygrywa.

   Zasady języka wizualnego (jak w nowym menu górnym, _nav.php):
     • przyciski i etykiety = pigułki (border-radius: 9999px), panele i karty = 18–26 px
     • złoto #db821b / #f0c27a, szampan rgba(197,168,128,x) tylko w liniach i ramkach
     • listy rozwijane w ciemnym "bazalcie" (#1d1b19 → #131211), tekst ciepła biel
   Świadomie tylko CSS — logika filtrowania (zastosujFiltry, custom-dropdown,
   .flt-active, renderujAktywneFiltry) zostaje nietknięta.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Panel filtrów ───────────────────────────────────────────────────────── */
#filter-bar {
    background: linear-gradient(180deg, #ffffff 0%, #fcfaf6 100%);
    border: 1px solid rgba(197, 168, 128, .32);
    border-radius: 26px;
    padding: 22px 20px 20px;
    box-shadow: 0 28px 70px -36px rgba(58, 53, 47, .35);
}
@media (min-width: 768px) {
    #filter-bar { padding: 26px 30px 24px; }
}
#filter-bar::before {                    /* złota mikrolinia na górnej krawędzi */
    top: -1px; left: 9%; right: 9%; height: 1px; border-radius: 0;
    background: linear-gradient(90deg, transparent, #e8b866, transparent);
}
#filter-bar > div:first-child span:nth-child(2) { color: #3a352f; }   /* "Filtruj kolekcję" */
#filter-bar .border-t { border-color: rgba(197, 168, 128, .25); }

/* Etykiety kolumn (tylko bezpośrednie — nie dotykają opcji na listach) */
#filter-bar :is(.custom-dropdown, .col-span-2, .flex-col) > label:first-child {
    display: block; margin: 0 0 9px; padding-left: 8px;
    font: 600 9.5px/1 'Inter', sans-serif; letter-spacing: .2em; text-transform: uppercase; color: #8a7f70;
}

/* ── Pola: pigułki ───────────────────────────────────────────────────────── */
#filter-bar .custom-dropdown button[id^="btn-"],
#filter-bar #search-input,
#filter-bar select {
    background-color: #fff;
    border: 1px solid rgba(58, 53, 47, .14);
    border-radius: 9999px;
    padding: 12px 18px;
    font: 500 13px/1.2 'Inter', sans-serif; color: #3a352f;
    box-shadow: 0 2px 8px -5px rgba(58, 53, 47, .2);
    transition: border-color .3s ease, box-shadow .3s ease, background-color .3s ease;
}
#filter-bar #search-input { padding-right: 44px; }
#filter-bar #search-input::placeholder { color: #a39a8c; }
#filter-bar select { padding-right: 36px; background-position: right 16px center; }
#filter-bar .custom-dropdown button[id^="btn-"]:hover,
#filter-bar #search-input:hover,
#filter-bar select:hover {
    border-color: rgba(219, 130, 27, .6);
    box-shadow: 0 10px 24px -14px rgba(219, 130, 27, .55);
}
#filter-bar #search-input:focus,
#filter-bar select:focus,
#filter-bar .custom-dropdown button[id^="btn-"]:focus-visible {
    outline: none; border-color: #db821b;
    box-shadow: 0 0 0 4px rgba(219, 130, 27, .14);
}
#filter-bar .custom-dropdown button i { color: rgba(154, 132, 96, .8); }
#filter-bar .relative > i.ph-magnifying-glass { right: 18px; color: rgba(154, 132, 96, .8); }
#filter-bar #sort-select + i { display: none; }        /* strzałka jest już w tle selecta */

/* Aktywna kategoria — złota pigułka (JS dodaje .flt-active) */
#filter-bar button.flt-active,
#filter-bar #search-input:not(:placeholder-shown) {
    border-color: #db821b;
    background: linear-gradient(180deg, #fffdf8, #fff4de);
    color: #7a4a08;
}
#filter-bar button.flt-active::after { top: -2px; right: 14px; box-shadow: 0 0 0 2px #fff; }

/* ── Listy rozwijane: ciemny bazalt, zaokrąglone, złote znaczniki ─────────── */
#filter-bar .dropdown-content {
    min-width: 230px; max-height: min(60vh, 320px);
    margin-top: 8px; padding: 10px;
    background: linear-gradient(180deg, #1f1d1b, #131211);
    border: 1px solid rgba(197, 168, 128, .24); border-radius: 18px;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6), 0 2px 10px rgba(0, 0, 0, .25);
    scrollbar-width: thin; scrollbar-color: #db821b transparent;
}
#filter-bar .dropdown-content label {
    padding: 10px 12px; border-radius: 11px; color: #d8d0c2;
    transition: color .25s ease, background .3s ease;
}
#filter-bar .dropdown-content label:hover {
    color: #f6dca8;
    background: linear-gradient(90deg, rgba(219, 130, 27, .2), rgba(219, 130, 27, .07));
}
#filter-bar .dropdown-content label span {
    margin-left: 12px; font: 400 13px/1.25 'Inter', sans-serif; letter-spacing: .02em; color: inherit;
}
#filter-bar .dropdown-content > div { color: #9a9184; }         /* komunikaty "Brak wyników…" */
#filter-bar .dropdown-content input[type="checkbox"] {
    -webkit-appearance: none; appearance: none; flex: none;
    width: 18px; height: 18px; margin: 0; border-radius: 6px;
    border: 1.5px solid rgba(197, 168, 128, .55); background: transparent;
    display: inline-grid; place-content: center; cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}
#filter-bar .dropdown-content input[type="checkbox"]::after {
    content: ''; width: 9px; height: 5px; margin-top: -2px;
    border-left: 2px solid #fff; border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0); transition: transform .2s ease;
}
#filter-bar .dropdown-content input[type="checkbox"]:checked { background: #db821b; border-color: #db821b; }
#filter-bar .dropdown-content input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
#filter-bar .dropdown-content input[type="checkbox"]:focus-visible { outline: 2px solid #f0c27a; outline-offset: 2px; }

/* ── "Więcej filtrów", chipsy aktywnych filtrów, pasek narzędzi ───────────── */
#btn-wiecej-filtrow {
    margin-top: 14px; padding: 8px 4px;
    font: 600 10.5px/1 'Inter', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: #8a7f70;
}
#btn-wiecej-filtrow:hover { color: #db821b; }
#wiecej-filtrow-count { background: #db821b; color: #fff; padding: 3px 8px; letter-spacing: .05em; }
#aktywne-filtry-chips > span {
    padding: 7px 8px 7px 14px; gap: 8px;
    background: #fff8ec; color: #7a4a08; border: 1px solid rgba(219, 130, 27, .35);
    font: 600 11.5px/1 'Inter', sans-serif; letter-spacing: .03em;
}
#aktywne-filtry-chips > span > button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 9999px; background: rgba(219, 130, 27, .14);
    transition: background .25s ease, color .25s ease;
}
#aktywne-filtry-chips > span > button:hover { background: rgba(190, 60, 45, .14); }
#licznik-produktow, #licznik-produktow-2 {              /* licznik wyników w kursywie Playfair */
    padding: 0; background: none; border: 0; border-radius: 0;
    font: italic 500 17px/1.2 'Playfair Display', serif; letter-spacing: 0; text-transform: none; color: #6b645a;
}
#licznik-produktow span { font-style: normal; font-weight: 700; color: #db821b; }
#filter-bar button[onclick="resetujFiltry()"] {
    padding: 11px 20px; border-radius: 9999px; background: #fff; border: 1px solid rgba(58, 53, 47, .14);
    font: 600 10.5px/1 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #6b645a;
    transition: border-color .3s ease, color .3s ease, background .3s ease;
}
#filter-bar button[onclick="resetujFiltry()"]:hover { color: #b4453a; border-color: rgba(190, 60, 45, .45); background: #fff6f4; }
#filter-bar button[onclick="otworzModalArchitekta()"] { border-radius: 9999px; padding-left: 20px; padding-right: 20px; }

/* Telefon: ciaśniejsze pola, żeby panel zabierał mniej ekranu (etap 3 = dolny panel "Filtry") */
@media (max-width: 767px) {
    #filter-bar { border-radius: 22px; }
    #filter-bar :is(.custom-dropdown, .col-span-2, .flex-col) > label:first-child { margin-bottom: 7px; }
    #filter-bar .custom-dropdown button[id^="btn-"],
    #filter-bar #search-input,
    #filter-bar select { padding: 10px 14px; font-size: 12.5px; }
    #filter-bar .dropdown-content { min-width: 200px; }
    #filter-bar #sort-select { min-width: 190px; }
}

/* ── Karty produktów (sklep.php) ─────────────────────────────────────────── */
[data-card="1"] {
    border-radius: 22px; border-color: rgba(197, 168, 128, .28);
    box-shadow: 0 18px 40px -32px rgba(58, 53, 47, .4);
    transition: box-shadow .5s ease, border-color .4s ease;
}
[data-card="1"]:hover { border-color: rgba(219, 130, 27, .42); box-shadow: 0 34px 60px -34px rgba(58, 53, 47, .55); }
[data-card="1"] > div.absolute.z-10 {                   /* plakietki "marka" / "Polecany" jako pigułki */
    top: 14px; border-radius: 9999px; padding: 6px 12px;
    letter-spacing: .18em; border-color: rgba(197, 168, 128, .3);
}
[data-card="1"] > div.absolute.z-10.left-3 { left: 14px; }
[data-card="1"] > div.absolute.z-10.right-3 { right: 14px; }
[data-card="1"] p.uppercase.tracking-widest { color: #a3927a; letter-spacing: .22em; }
[data-card="1"] h3.font-serif { font-weight: 600; letter-spacing: .005em; }
[data-card="1"] select,
[data-card="1"] input[type="number"] {
    border-radius: 9999px; border-color: rgba(58, 53, 47, .12); background-color: #fbfaf7; padding-left: 14px;
}
[data-card="1"] input[type="number"] { padding-left: 4px; }
[data-card="1"] button[name="add_to_cart"] {
    border-radius: 9999px; letter-spacing: .16em;
}

/* ── Karty kategorii "Jak wybrać materiał?" (oferta.php) ─────────────────── */
.mat-card {
    border-radius: 22px; border-color: rgba(197, 168, 128, .28);
    box-shadow: 0 18px 40px -32px rgba(58, 53, 47, .4);
}
.mat-card:hover { border-color: rgba(219, 130, 27, .42); box-shadow: 0 34px 60px -34px rgba(58, 53, 47, .55); }
.mat-card .js-sheen { height: 168px; }
.mat-card .js-sheen > .absolute.inset-0 {
    background: linear-gradient(to top, rgba(12, 11, 10, .78) 0%, rgba(12, 11, 10, .18) 55%, rgba(12, 11, 10, 0) 100%);
}
.mat-card .js-sheen > span.font-serif {                 /* podpis na zdjęciu */
    left: 20px; bottom: 16px; font-size: 19px; font-weight: 600; letter-spacing: .01em;
}
.mat-card > div:last-child { padding: 14px 20px 16px; }
.mat-card > div:last-child > span:last-child {          /* "Zobacz ofertę →" jako cienka linia z napisem */
    display: flex; justify-content: space-between; width: 100%; margin-top: 0; padding-top: 12px;
    border-top: 1px solid rgba(197, 168, 128, .25);
    font-size: 10.5px; letter-spacing: .2em; color: #b8690f;
}
.mat-card .mat-guide-details + span { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
    #filter-bar *, [data-card="1"], .mat-card { transition: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ETAP 3 — pasek próbek koloru + dolny panel "Filtry" na telefonie
   (znaczniki tworzy filtry-luxe.js; działa na tych samych checkboxach co dotąd)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Lista "Kolor wiodący" zastąpiona paskiem próbek — kolumna znika, więc siatka ma 6 kolumn */
.flt-hidden-col { display: none; }
@media (min-width: 1024px) {
    #filter-bar > .grid:not(#wiecej-filtrow-wrap) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ── Pasek próbek koloru ─────────────────────────────────────────────────── */
.flt-kolory {
    display: flex; align-items: flex-start; gap: 22px;
    margin: -2px 0 20px; padding: 0 0 18px; border-bottom: 1px solid rgba(197, 168, 128, .25);
}
.flt-kolory[hidden] { display: none; }
.flt-kolory-label {
    flex: none; width: 46px; padding: 14px 0 0 8px;
    font: 600 9.5px/1 'Inter', sans-serif; letter-spacing: .2em; text-transform: uppercase; color: #8a7f70;
}
.flt-kolory-list { display: flex; flex-wrap: wrap; gap: 6px 4px; flex: 1; }
.flt-sw {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    width: 68px; padding: 6px 0 4px; background: none; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.flt-sw-dot {
    position: relative; width: 32px; height: 32px; border-radius: 9999px;
    box-shadow: inset 0 0 0 1px rgba(58, 53, 47, .16), inset 0 -7px 10px -7px rgba(0, 0, 0, .28), 0 8px 14px -9px rgba(58, 53, 47, .55);
    transition: transform .35s cubic-bezier(.25, 1, .5, 1), box-shadow .3s ease;
}
.flt-sw:hover .flt-sw-dot { transform: translateY(-2px) scale(1.08); }
.flt-sw-name {
    font: 500 9.5px/1.1 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase;
    color: #6b645a; white-space: nowrap; transition: color .25s ease;
}
.flt-sw.is-on .flt-sw-dot {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #db821b, 0 12px 20px -10px rgba(219, 130, 27, .75);
}
.flt-sw.is-on .flt-sw-name { color: #7a4a08; font-weight: 700; }
.flt-sw.is-on .flt-sw-dot::after {          /* ptaszek — zaznaczenie nie polega tylko na kolorze */
    content: ''; position: absolute; left: 50%; top: 50%; width: 11px; height: 6px; margin: -5px 0 0 -5.5px;
    border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}
.flt-sw[data-light="1"].is-on .flt-sw-dot::after { border-color: #3a352f; }
.flt-sw:disabled { opacity: .32; cursor: not-allowed; }
.flt-sw:disabled:hover .flt-sw-dot { transform: none; }
.flt-sw:focus-visible { outline: 2px solid #f0c27a; outline-offset: 2px; border-radius: 12px; }

/* ── Telefon: wyzwalacz + dolny panel + pływający przycisk ───────────────── */
.flt-trigger, .flt-sheet-head, .flt-sheet-foot, .flt-backdrop, .flt-float { display: none; }

@media (max-width: 767px) {
    .flt-kolory { flex-direction: column; gap: 8px; margin-bottom: 16px; padding-bottom: 12px; }
    .flt-kolory-label { width: auto; padding: 0 0 0 8px; }
    .flt-sw { flex: 0 0 calc(100% / 6 - 4px); width: auto; }

    /* wiersz nad produktami: szukanie + pigułka "Filtry (n)" */
    .flt-trigger { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
    .flt-t-search { position: relative; display: block; flex: 1; min-width: 0; }
    .flt-t-search i {
        position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
        font-size: 16px; color: rgba(154, 132, 96, .9); pointer-events: none;
    }
    .flt-t-search input {
        width: 100%; padding: 13px 16px 13px 42px; border-radius: 9999px;
        border: 1px solid rgba(58, 53, 47, .14); background: #fff; outline: none;
        font: 500 13px/1.2 'Inter', sans-serif; color: #3a352f;
        box-shadow: 0 2px 8px -5px rgba(58, 53, 47, .2);
        transition: border-color .3s ease, box-shadow .3s ease;
    }
    .flt-t-search input:focus { border-color: #db821b; box-shadow: 0 0 0 4px rgba(219, 130, 27, .14); }
    .flt-t-btn {
        flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 13px 18px;
        border-radius: 9999px; border: 1px solid #db821b; background: linear-gradient(180deg, #fffdf8, #fff4de);
        color: #7a4a08; cursor: pointer; -webkit-tap-highlight-color: transparent;
        font: 600 11px/1 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase;
    }
    .flt-t-btn i { font-size: 16px; }
    .flt-t-btn b {
        min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px; background: #db821b; color: #fff;
        font: 700 10px/18px 'Inter', sans-serif; letter-spacing: 0; text-align: center;
    }
    .flt-t-btn b[hidden] { display: none; }
    #flt-trigger + #aktywne-filtry-chips { margin: 0 0 14px; padding-top: 0; border-top: 0; }

    /* panel: ten sam #filter-bar, wysuwany z dołu */
    #filter-bar {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1200; margin: 0;
        max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
        padding: 0 18px; border-radius: 26px 26px 0 0;
        box-shadow: 0 -30px 80px -20px rgba(0, 0, 0, .5);
        transform: translateY(105%); visibility: hidden; pointer-events: none;
        transition: transform .42s cubic-bezier(.25, 1, .5, 1), visibility 0s linear .42s;
    }
    body.flt-sheet-open #filter-bar {
        transform: none; visibility: visible; pointer-events: auto;
        transition: transform .42s cubic-bezier(.25, 1, .5, 1), visibility 0s;
    }
    .flt-sheet-head {
        display: block; position: sticky; top: 0; z-index: 5; margin: 0 -18px 6px; padding: 10px 18px 8px;
        background: #fefcf9; border-radius: 26px 26px 0 0;
    }
    .flt-grab { display: block; width: 44px; height: 4px; margin: 0 auto 10px; border-radius: 9999px; background: rgba(58, 53, 47, .18); }
    .flt-sheet-title { display: flex; align-items: center; justify-content: space-between; }
    .flt-sheet-title span { font: italic 600 22px/1 'Playfair Display', serif; color: #3a352f; }
    .flt-sheet-close {
        display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
        border-radius: 9999px; border: 1px solid rgba(58, 53, 47, .14); background: #fff; color: #3a352f; cursor: pointer;
    }
    .flt-sheet-close i { font-size: 18px; }
    .flt-sheet-head + div { display: none; }             /* stary nagłówek "Filtruj kolekcję" — zastępuje go nagłówek panelu */
    #filter-bar .col-span-2 { display: none; }           /* szukanie jest w wierszu-wyzwalaczu */
    #filter-bar button[onclick="resetujFiltry()"] { display: none; }   /* "Wyczyść" jest w stopce panelu */

    /* listy rozwijane w panelu = akordeony w miejscu (pływające byłyby przycinane przez przewijanie) */
    #filter-bar .dropdown-content {
        position: static; width: 100%; min-width: 0; max-height: 260px; margin-top: 10px;
        box-shadow: none;
    }

    .flt-sheet-foot {
        display: flex; gap: 10px; position: sticky; bottom: 0; z-index: 5;
        margin: 14px -18px 0; padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
        background: #fefcf9; border-top: 1px solid rgba(197, 168, 128, .25);
    }
    .flt-foot-clear {
        flex: none; padding: 15px 20px; border-radius: 9999px; border: 1px solid rgba(58, 53, 47, .14); background: #fff;
        font: 600 10.5px/1 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #6b645a; cursor: pointer;
    }
    .flt-foot-show {
        flex: 1; padding: 15px 20px; border: 0; border-radius: 9999px; cursor: pointer;
        background: linear-gradient(135deg, #f5d089, #db821b); color: #1a1815;
        font: 700 11.5px/1 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase;
        box-shadow: 0 14px 30px -14px rgba(219, 130, 27, .75);
    }
    .flt-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1199; background: rgba(10, 9, 8, .55);
        -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
        opacity: 0; pointer-events: none; transition: opacity .35s ease;
    }
    body.flt-sheet-open .flt-backdrop { opacity: 1; pointer-events: auto; }
    body.flt-sheet-open { overflow: hidden; }
    body.flt-sheet-open #ai-fab { display: none; }       /* pływający przycisk czatu AI nie może zasłaniać panelu */

    /* Pływający przycisk "Filtry" na dole ekranu (nad dolnym paskiem nawigacji) po przewinięciu katalogu */
    .flt-float {
        display: inline-flex; align-items: center; gap: 8px;
        position: fixed; left: 50%; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); z-index: 95;
        padding: 11px 20px; border-radius: 9999px;
        background: rgba(23, 21, 19, 0.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
        border: 1px solid rgba(240, 194, 122, 0.45); color: #f7f4ef;
        font: 700 11px/1 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase;
        box-shadow: 0 14px 32px -8px rgba(0, 0, 0, .55); cursor: pointer;
        transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
        transition: transform .32s cubic-bezier(.25, 1, .5, 1), opacity .28s ease;
    }
    .flt-float i { color: #f0c27a; font-size: 15px; }
    .flt-float b {
        min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px;
        background: #db821b; color: #fff; font: 700 10px/18px 'Inter', sans-serif;
        letter-spacing: 0; text-align: center;
    }
    .flt-float b[hidden] { display: none; }
    .flt-float.is-visible { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
    body.flt-sheet-open .flt-float { opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
    #filter-bar, .flt-backdrop, .flt-sw-dot { transition: none !important; }
}

@media (max-width: 767px) {
    /* rozwinięta lista (akordeon) zajmuje całą szerokość panelu, nie połowę kolumny */
    #filter-bar .custom-dropdown:has(> .relative > .dropdown-content:not(.hidden)) { grid-column: 1 / -1; }
    .flt-sheet-close:focus-visible, .flt-t-btn:focus-visible, .flt-foot-show:focus-visible, .flt-foot-clear:focus-visible {
        outline: 2px solid #f0c27a; outline-offset: 2px;
    }
}
