/**
 * Product selector modal — filter panel (T11).
 *
 * The same panel as the category page (pcbuildmate-catalog
 * assets/css/partials/_categorie-v3-paneel.css): identical spacing, type sizes, counts
 * and controls, with the class structure mirrored under the psf- prefix (cat3-fg →
 * psf-fg, cat3-ck → psf-ck, …). Column ≥ 1025 px, bottom sheet like the category
 * filter drawer (artboard Filterlade-mobiel) at ≤ 1024 px, the breakpoint of
 * _modal-responsive.css. Loaded after the modal partials; tokens only (theme-vars.css).
 */

.psf {
    --psf-knop: var(--brand-primary);
    --psf-knop-tekst: var(--text-on-fill);
    color-scheme: light;
}

html.dark .psf,
html.dark .psf-chipsbalk {
    --psf-knop: var(--brand);
    --psf-knop-tekst: var(--bg-primary);
    color-scheme: dark;
}

.psf-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Column ────────────────────────────────────────────────────────────────── */

.filters-sidebar.psf {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px 20px 24px;
    background: var(--bg-primary);
    font-family: var(--font-display);
}

.psf-inhoud { min-width: 0; }

.psf-kop {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
}

.psf-kop h2 { flex: 1 1 auto; margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary); }

/* The old drawer close button rule (_modal-responsive.css) is absolute; here it sits in the head. */
.psf .psf-sluit { display: none; }
/* Active filters show once, in the bar above the products; the panel's own chip list and "Wis alles"
   only appear in the bottom-sheet drawer (≤ 1024 px). `.psf` raises the specificity above `.psf-chips`. */
.psf .psf-paneel__chips,
.psf .psf-kop__wis,
.psf-voet { display: none; }

.psf-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--brand);
    text-decoration: none;
    cursor: pointer;
}

.psf-link:hover { text-decoration: underline; }

.psf-productzoek { margin-bottom: 12px; }

.psf-vast { border-top: 1px solid var(--border); padding: 4px 0; }
.psf-vast .psf-sw { margin-top: 0; min-height: 44px; font-weight: 600; color: var(--text-primary); }

/* ── Groups ────────────────────────────────────────────────────────────────── */

.psf-fg,
.psf-meer { border-top: 1px solid var(--border); }

.psf-meer { border-bottom: 1px solid var(--border); }
.psf-meer .psf-fg:first-of-type { border-top: 0; }

.psf-fg__kop {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 0;
    list-style: none;
    cursor: pointer;
}

.psf-fg__kop::-webkit-details-marker { display: none; }
.psf-fg__kop h3 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.psf-fg__hint { display: none; flex-shrink: 0; font-size: 13px; font-weight: 400; color: var(--text-zwak); }
.psf-fg__pijl { flex-shrink: 0; width: 16px; height: 16px; color: var(--text-zwak); transition: transform 0.15s ease; }
details[open] > .psf-fg__kop .psf-fg__pijl { transform: rotate(180deg); }
.psf-fg__body { padding: 0 0 14px; }

.psf-meer__namen {
    display: block;
    flex: 0 1 auto;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psf-meer[open] > .psf-fg__kop .psf-meer__namen { display: none; }
.psf-meer__body { padding-left: 12px; border-left: 2px solid var(--bg-tertiary); margin-bottom: 8px; }

.psf-fg__kop:focus-visible,
.psf-alle > summary:focus-visible,
.psf-link:focus-visible,
.psf-chip:focus-visible,
.psf-preset:focus-visible,
.psf-knop:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Options ───────────────────────────────────────────────────────────────── */

.psf-opties { margin: 0; padding: 0; list-style: none; }

.psf-ck {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.psf-ck input { flex-shrink: 0; width: 18px; height: 18px; margin: 0; accent-color: var(--psf-knop); cursor: pointer; }
.psf-ck__label { flex: 1 1 auto; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.psf-ck:hover .psf-ck__label { color: var(--text-primary); }
.psf-ck input:checked + .psf-ck__label { font-weight: 600; color: var(--text-primary); }

.psf-ck small,
.psf-sw small {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-zwak);
}

.psf-alle > summary {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 2px 0;
    list-style: none;
    font-size: 13px;
    color: var(--brand);
    cursor: pointer;
}

.psf-alle > summary::-webkit-details-marker { display: none; }
.psf-alle > summary:hover { text-decoration: underline; }
.psf-alle__open, .psf-alle[open] .psf-alle__dicht { display: none; }
.psf-alle[open] .psf-alle__open { display: inline; }

.psf-zoek {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    margin-bottom: 6px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-zwak);
}

.psf-zoek:focus-within { border-color: var(--accent); }
.psf-zoek svg { flex-shrink: 0; width: 14px; height: 14px; }

.psf-zoek input {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--text-primary);
}

.psf-zoek input::placeholder { color: var(--text-zwak); opacity: 1; }

/* ── Range ─────────────────────────────────────────────────────────────────── */

.psf-bereik { display: flex; align-items: center; gap: 8px; }
.psf-bereik__tot { flex-shrink: 0; color: var(--text-zwak); }

.psf-veld {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: 4px;
    min-width: 0;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    font-size: 14px;
    color: var(--text-zwak);
}

.psf-veld:focus-within { border-color: var(--accent); }

.psf-veld input {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: none;
    font: inherit;
    color: var(--text-primary);
    -moz-appearance: textfield;
    appearance: textfield;
}

.psf-veld input::-webkit-outer-spin-button,
.psf-veld input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.psf-veld input::placeholder { color: var(--text-zwak); opacity: 1; }
.psf-veld__voor, .psf-veld__na { flex-shrink: 0; }

/* ── Presets ───────────────────────────────────────────────────────────────── */

.psf-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }

.psf-preset {
    height: 36px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    font: inherit;
    font-size: 13px;
    white-space: nowrap;
    color: var(--text-primary);
    cursor: pointer;
}

.psf-preset:hover { border-color: var(--text-zwak); }
.psf-preset[aria-pressed="true"] { border-color: var(--psf-knop); background: var(--psf-knop); font-weight: 600; color: var(--psf-knop-tekst); }

/* ── Switch (compatibility, stock, yes/no) ─────────────────────────────────── */

.psf-sw {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.psf-fg--janee .psf-sw { margin-top: 0; }
.psf-sw__label { flex: 1 1 auto; min-width: 0; }
.psf-sw small { margin-left: 0; }

.psf-sw input[role="switch"] {
    position: relative;
    flex-shrink: 0;
    width: 38px;
    height: 22px;
    margin: 0;
    border: 1px solid var(--text-zwak);
    border-radius: 11px;
    background: var(--bg-tertiary);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 0.15s ease;
}

.psf-sw input[role="switch"]::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-zwak);
    transition: transform 0.15s ease;
}

.psf-sw input[role="switch"]:checked { border-color: var(--psf-knop); background: var(--psf-knop); }
.psf-sw input[role="switch"]:checked::before { background: var(--psf-knop-tekst); transform: translateX(16px); }
.psf-sw input[role="switch"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Chips (bar above the results and the drawer) ──────────────────────────── */

.psf-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }

.psf-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px 0 12px;
    border: 0;
    border-radius: 16px;
    background: var(--bg-tertiary);
    font: inherit;
    font-size: 13px;
    white-space: nowrap;
    color: var(--text-primary);
    cursor: pointer;
}

.psf-chip:hover { background: var(--bg-hover); }
.psf-chip__x { flex-shrink: 0; width: 14px; height: 14px; color: var(--text-zwak); }

.active-filters-bar.psf-chipsbalk { gap: 12px; padding: 10px 24px; background: var(--bg-primary); }
.psf-chipsbalk .psf-chips { flex-wrap: nowrap; }
.psf-chipsbalk .clear-all-filters.psf-link { padding: 0; border: 0; border-radius: 0; font-size: 13px; color: var(--brand); }

/* ── Buttons (drawer footer) ───────────────────────────────────────────────── */

.psf-knop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    font: inherit;
    font-size: 15px;
    white-space: nowrap;
    color: var(--text-primary);
    cursor: pointer;
}

.psf-knop--primair { flex: 1 1 auto; min-width: 0; border-color: var(--psf-knop); background: var(--psf-knop); font-size: 16px; font-weight: 700; color: var(--psf-knop-tekst); }

/* ── Drawer: bottom sheet ≤ 1024 px (artboard Filterlade-mobiel) ───────────── */

@media (max-width: 1024px) {
    .filters-sidebar.psf {
        top: 24px;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-width: 100%;
        height: calc(100vh - 24px);
        height: calc(100dvh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 0;
        border-right: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -12px 40px rgba(var(--shadow-rgb), 0.25);
        overflow: hidden;
        transform: translateY(100%);
        visibility: hidden;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.25s;
    }

    .filters-sidebar.psf.is-open { transform: translateY(0); visibility: visible; transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); }

    .psf .psf-kop { flex-shrink: 0; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
    .psf .psf-kop h2 { font-size: 20px; }
    .psf .psf-kop__wis { display: none !important; }

    .filters-sidebar.psf .psf-sluit,
    .filters-sidebar.psf.is-open .psf-sluit {
        position: static;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 0;
        border-radius: 50%;
        background: var(--bg-secondary);
        color: var(--text-primary);
        cursor: pointer;
    }

    .filters-sidebar.psf .psf-sluit:hover { background: var(--bg-tertiary); }
    .psf .psf-sluit svg { width: 20px; height: 20px; }

    .psf .psf-paneel__chips {
        display: flex;
        flex-shrink: 0;
        flex-wrap: nowrap;
        padding: 12px 16px;
        overflow-x: auto;
        border-bottom: 1px solid var(--border);
        scrollbar-width: none;
    }

    .psf .psf-paneel__chips .psf-chip { flex-shrink: 0; min-height: 36px; border-radius: 22px; }

    .psf .psf-inhoud { flex: 1 1 auto; min-height: 0; padding: 0 16px 16px; overflow-y: auto; overscroll-behavior: contain; }
    .psf .psf-productzoek { display: none; }
    .psf .psf-vast { border-top: 0; }
    .psf .psf-fg__kop { min-height: 52px; }
    .psf .psf-fg__kop h3 { font-size: 16px; }
    .psf .psf-fg__hint { display: block; }
    .psf .psf-meer__namen { display: none; }
    .psf .psf-meer__body { padding-left: 0; border-left: 0; }
    .psf .psf-ck { min-height: 44px; font-size: 15px; }
    .psf .psf-ck input { width: 20px; height: 20px; }
    .psf .psf-ck small { font-size: 13px; }
    .psf .psf-sw { min-height: 44px; font-size: 15px; }
    .psf .psf-alle > summary { min-height: 44px; font-size: 14px; }
    .psf .psf-zoek, .psf .psf-veld, .psf .psf-preset { height: 44px; }
    .psf .psf-zoek input, .psf .psf-veld input { font-size: 16px; }

    .psf .psf-voet {
        display: flex;
        flex-shrink: 0;
        gap: 12px;
        padding: 12px 16px 24px;
        border-top: 1px solid var(--border);
        background: var(--bg-primary);
    }

    .active-filters-bar.psf-chipsbalk { padding: 8px 16px; }

    /* 360 px: both footer buttons stay on one line. */
    @media (max-width: 380px) {
        .psf .psf-knop { padding: 0 14px; }
        .psf .psf-knop--primair { font-size: 15px; }
    }

    /* The closed sort sheet (_modal-responsive.css) sits just below the viewport in a higher
       stacking layer; its upward shadow darkened the bottom 30 px of this drawer. */
    .mobile-sort-panel:not(.is-active) { box-shadow: none; }
}

/* Touch: targets at least 44 px in the column as well. */
@media (pointer: coarse) {
    .psf-ck, .psf-sw, .psf-alle > summary, .psf-chip, .psf .psf-paneel__chips .psf-chip { min-height: 44px; }
    .psf-preset, .psf-veld, .psf-zoek { height: 44px; }
    .psf-link { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .psf-fg__pijl,
    .psf-sw input[role="switch"],
    .psf-sw input[role="switch"]::before,
    .filters-sidebar.psf,
    .filters-sidebar.psf.is-open { transition: none; }
}
