/* BEIZ Product Filter — frontend styles */

/* Design tokens (scoped to .bpf-form so they don't leak into the theme). */
.bpf-form {
    --bpf-orange:        #fe6012;
    --bpf-orange-hover:  #e5530a;
    --bpf-orange-soft:   #ffe9dc;
    --bpf-ink:           #181818;
    --bpf-ink-2:         #4a4a4a;
    --bpf-ink-3:         #888888;
    --bpf-ink-4:         #c8c5be;
    --bpf-border:        #e6e3db;
    --bpf-border-2:      #d0cdc4;
    --bpf-surface-2:     #fafafa;
    --bpf-surface-3:     #f8f6f0;
    --bpf-font-mono:     "JetBrains Mono", "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;

    display: flex;
    flex-direction: column;
    gap: 18px;
    /* All form text uses weight 500 by default */
    font-weight: 500;
    color: var(--bpf-ink);
}

/* Each field is a self-contained block, no visual separator. */
.bpf-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bpf-field__label {
    font-weight: 600;
    font-size: 14px;
    color: #181818;
}

/* Inside-label mode: hide separate label, collapse spacing -------------- */
.bpf-field--label-inside {
    gap: 0;
    padding-bottom: 0;
    border-bottom: 0;
}
.bpf-field--label-inside .bpf-field__label {
    display: none;
}

/* Dropdown ---------------------------------------------------------------- */
.bpf-dropdown {
    width: 100%;
    padding: 10px 32px 10px 12px;
    border: 1px solid #e6e3db;
    border-radius: 6px;
    background: #fff;
    color: #181818;
    font-size: 14px;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23181818' stroke-width='1.5' d='M1 1.5l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}
.bpf-dropdown:focus {
    outline: none;
    border-color: #181818;
}

/* Checkbox list ----------------------------------------------------------- */
.bpf-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Search input shown above checkbox list when enable_search is on */
.bpf-checkbox-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e6e3db;
    border-radius: 6px;
    background: #fff;
    color: #181818;
    font-size: 14px;
    font-weight: 500;
    box-sizing: border-box;
    margin-bottom: 12px;
}

/* Shown when a field has no options to display (initial render or after AJAX
   filter constraints have hidden everything). */
.bpf-empty-message {
    padding: 14px 4px;
    color: var(--bpf-ink-3);
    font-size: 13px;
    font-style: italic;
    text-align: center;
}
.bpf-checkbox-search:focus {
    outline: none;
    border-color: #fe6012;
}

.bpf-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #181818;
    user-select: none;
}

/* Label expands; count sits to the far right. */
.bpf-checkbox__label {
    line-height: 1.3;
    flex: 1 1 auto;
}
.bpf-checkbox__count {
    flex: 0 0 auto;
    color: #888;
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
}
.bpf-checkbox__count:empty {
    display: none;
}

.bpf-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.bpf-checkbox__box {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid #e6e3db;
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.bpf-checkbox:hover .bpf-checkbox__box {
    border-color: #fe6012;
}

.bpf-checkbox input[type="checkbox"]:checked + .bpf-checkbox__box {
    background: #fe6012;
    border-color: #fe6012;
}
.bpf-checkbox input[type="checkbox"]:checked + .bpf-checkbox__box::after {
    content: "";
    width: 6px;
    height: 3px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}

.bpf-checkbox input[type="checkbox"]:focus-visible + .bpf-checkbox__box {
    outline: 2px solid #181818;
    outline-offset: 2px;
}

/* Range slider ------------------------------------------------------------ */
.bpf-range {
    padding: 6px 0 18px;
}
.bpf-range__values {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #555;
}
.bpf-range__slider {
    margin: 0 6px;
}
.bpf-range .noUi-target {
    height: 6px;
    border: 0;
    background: #f0f0f0;
    box-shadow: none;
}
.bpf-range .noUi-connect {
    background: #181818;
}
.bpf-range .noUi-handle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 0;
    background: #fff;
    top: -7px;
    right: -9px;
    cursor: grab;
}
.bpf-range .noUi-handle:before,
.bpf-range .noUi-handle:after { display: none; }

/* Min/Max numeric inputs -------------------------------------------------- */
.bpf-minmax {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bpf-minmax__input {
    flex: 1;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e6e3db;
    border-radius: 6px;
    background: #fff;
    color: #181818;
    font-size: 14px;
    font-weight: 500;
    -moz-appearance: textfield;
}
.bpf-minmax__input::-webkit-outer-spin-button,
.bpf-minmax__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.bpf-minmax__input:focus {
    outline: none;
    border-color: #181818;
}
.bpf-minmax__sep {
    color: #888;
    font-size: 14px;
    font-weight: 500;
}

/* Actions ----------------------------------------------------------------- */
.bpf-actions {
    display: flex;
    gap: 8px;
    padding-top: 4px;
}
.bpf-submit {
    background: #fe6012;
    color: #fff;
    border: 0;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}
/* When the filter has AJAX availability disabled, the count badge is omitted
   and the apply-text sits centered in the button. */
.bpf-submit--no-count {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.bpf-submit--no-count .bpf-submit__text {
    display: block;
    width: 100%;
    text-align: center;
}
/* Per-set option: hide all product counts in the filter. */
.bpf-form--no-counts .bpf-checkbox__count,
.bpf-form--no-counts .bpf-tile__count,
.bpf-form--no-counts .bpf-submit__count {
    display: none !important;
}
.bpf-submit:hover {
    background: #e5530a;
}
.bpf-reset {
    background: transparent;
    border: 1px solid #e6e3db;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    color: #181818;
    font-size: 14px;
    font-weight: 500;
}
.bpf-reset:hover {
    background: #f5f5f5;
}

/* Horizontal layout — cards in a grid (cols are configurable per filter set). */
.bpf-form--horizontal .bpf-fields {
    display: grid;
    grid-template-columns: repeat(var(--bpf-grid-cols, 6), minmax(0, 1fr));
    gap: 0;
    align-items: stretch;
}

/* Each horizontal field is a "card" (white bg + border). */
.bpf-form--horizontal .bpf-field--card {
    position: relative;
    border: 1px solid var(--bpf-border);
    border-radius: 0;
    background: #fff;
    padding: 10px 14px;
    min-width: 0;
    gap: 4px;
    /* Collapse touching borders. */
    margin-right: -1px;
    margin-bottom: -1px;
}
.bpf-form--horizontal .bpf-field--card[data-has-value="1"] {
    border-color: var(--bpf-orange);
    z-index: 1;
}
/* Exception: checkbox / minmax / range popover cards stay neutral when a value is selected.
   (Their summary may contain a long range like "50 – *" or a list of brand names —
   colouring the border and text orange looks too loud.) */
.bpf-form--horizontal .bpf-field--checkbox[data-has-value="1"],
.bpf-form--horizontal .bpf-field--minmax[data-has-value="1"],
.bpf-form--horizontal .bpf-field--range[data-has-value="1"] {
    border-color: var(--bpf-border);
    z-index: auto;
}
.bpf-form--horizontal .bpf-field--checkbox[data-has-value="1"] .bpf-field__summary,
.bpf-form--horizontal .bpf-field--minmax[data-has-value="1"] .bpf-field__summary,
.bpf-form--horizontal .bpf-field--range[data-has-value="1"] .bpf-field__summary {
    color: var(--bpf-ink);
    font-weight: 600;
}

/* UPPERCASE label at the top of every card. */
.bpf-form--horizontal .bpf-field--card .bpf-field__head-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bpf-ink-3);
    display: block;
    line-height: 1.4;
}

/* === Inline cards (dropdown only — range/minmax now use popover too). === */

/* Dropdown — strip its own border; smaller, lighter chevron. */
.bpf-form--horizontal .bpf-field--card:not(.bpf-field--accordion) .bpf-dropdown {
    border: 0;
    padding: 0 16px 0 0;
    background-color: transparent;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'><path fill='none' stroke='%23888888' stroke-width='1.2' d='M1 1l3 3 3-3'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-size: 8px 5px;
    font-size: 14px;
    font-weight: 600;
    color: var(--bpf-ink);
    height: auto;
}
.bpf-form--horizontal .bpf-field--card[data-has-value="1"] .bpf-dropdown {
    color: var(--bpf-orange);
    font-weight: 700;
}

/* === Popover cards (tiles / checkbox / range / minmax) === */

.bpf-form--horizontal .bpf-field--accordion {
    padding: 0;
}
.bpf-form--horizontal .bpf-field--accordion .bpf-field__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
}
/* head-right is the bottom row in horizontal cards: summary + chevron side-by-side. */
.bpf-form--horizontal .bpf-field--accordion .bpf-field__head-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 6px;
    min-width: 0;
}
.bpf-form--horizontal .bpf-field--accordion .bpf-field__summary {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--bpf-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bpf-form--horizontal .bpf-field--accordion[data-has-value="1"] .bpf-field__summary {
    color: var(--bpf-orange);
    font-weight: 700;
}
/* Small grey chevron next to the value, same look as the dropdown arrow. */
.bpf-form--horizontal .bpf-field--accordion .bpf-field__chevron {
    position: static;
    flex-shrink: 0;
    width: 5px;
    height: 5px;
    border-right: 1.2px solid var(--bpf-ink-3);
    border-bottom: 1.2px solid var(--bpf-ink-3);
    margin: 0 0 2px 0;
    transform: rotate(45deg);
}
.bpf-form--horizontal .bpf-field--accordion.bpf-field--open .bpf-field__chevron {
    transform: rotate(-135deg);
    margin: 2px 0 0 0;
}

/* Body — popover. position:fixed so it can escape overflow:hidden ancestors.
   Coordinates (top, left, min-width) are set inline by JS on open + on scroll/resize. */
.bpf-form--horizontal .bpf-field--accordion .bpf-field__body {
    position: fixed;
    top: 0;
    left: 0;
    max-width: 360px;
    max-height: 340px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--bpf-border);
    border-radius: 0;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(15, 14, 12, 0.1);
    z-index: 9999;
}
.bpf-form--horizontal .bpf-field--accordion.bpf-field--closed .bpf-field__body {
    display: none;
}
.bpf-form--horizontal .bpf-field--checkbox .bpf-field__body,
.bpf-form--horizontal .bpf-field--tiles .bpf-field__body {
    min-width: 240px;
}
.bpf-form--horizontal .bpf-field--accordion .bpf-checkboxes {
    max-height: 280px;
    overflow-y: auto;
}

/* === Actions inside the grid, padding 10px === */
.bpf-form--horizontal .bpf-fields > .bpf-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
    padding: 10px;
    min-width: 0;
}
.bpf-form--horizontal .bpf-fields > .bpf-actions .bpf-reset {
    padding: 10px 14px;
    height: auto;
    width: auto;
    font-size: 12px;
}
.bpf-form--horizontal .bpf-fields > .bpf-actions .bpf-submit {
    padding: 10px 14px;
    height: auto;
    width: auto;
    font-size: 13px;
    flex: 1 1 auto;
    justify-content: center;
    gap: 8px;
}

/* === Active chips section === */
.bpf-form--horizontal .bpf-active-section {
    padding: 10px 0;
    background: transparent;
    border: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.bpf-form--horizontal .bpf-active-section__head {
    margin: 0;
    flex-shrink: 0;
    gap: 8px;
    margin-right: 4px;
}
.bpf-form--horizontal .bpf-active-section__title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--bpf-ink-3);
    text-transform: uppercase;
}
.bpf-form--horizontal .bpf-chips {
    flex: 1 1 auto;
    gap: 6px;
}
.bpf-form--horizontal .bpf-clear-all {
    margin-left: auto;
    flex-shrink: 0;
}

/* Responsive — cap columns by viewport, but never exceed user's setting. */
@media (max-width: 1280px) {
    .bpf-form--horizontal .bpf-fields {
        grid-template-columns: repeat(min(var(--bpf-grid-cols, 6), 4), minmax(0, 1fr));
    }
}
@media (max-width: 900px) {
    .bpf-form--horizontal .bpf-fields {
        grid-template-columns: repeat(min(var(--bpf-grid-cols, 6), 2), minmax(0, 1fr));
    }
}
@media (max-width: 540px) {
    .bpf-form--horizontal .bpf-fields {
        grid-template-columns: 1fr;
    }
    /* On mobile use absolute positioning relative to the card (no fixed),
       so popover stays inside the natural flow of the form. */
    .bpf-form--horizontal .bpf-field--accordion .bpf-field__body {
        position: absolute !important;
        top: calc(100% + 1px) !important;
        left: 0 !important;
        right: 0 !important;
        min-width: 0 !important;
        max-width: none;
        width: auto;
    }
    .bpf-form--horizontal .bpf-fields > .bpf-actions {
        flex-direction: column;
    }
    .bpf-form--horizontal .bpf-fields > .bpf-actions .bpf-submit,
    .bpf-form--horizontal .bpf-fields > .bpf-actions .bpf-reset {
        width: 100%;
    }
}

/* Fullscreen loader: shown when a button (Etsi / Nolla) triggers a full page
   navigation (not in-place AJAX). Stays visible until the new page arrives.
   Especially important on mobile where there's a perceptible delay between
   tap and the browser starting to load the new URL. */
.bpf-fullscreen-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: wait;
    animation: bpf-fade-in 0.12s ease-out;
}
.bpf-fullscreen-loader .bpf-loader-spinner {
    width: 56px;
    height: 56px;
    border-width: 4px;
    border-color: #e0e0e0;
    border-top-color: #181818;
}
@media (max-width: 768px) {
    .bpf-fullscreen-loader .bpf-loader-spinner {
        width: 60px;
        height: 60px;
        border-width: 4px;
    }
}

/* Loader overlay ---------------------------------------------------------- */
.bpf-loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    cursor: wait;
    animation: bpf-fade-in 0.15s ease-out;
}

@keyframes bpf-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.bpf-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #181818;
    border-radius: 50%;
    animation: bpf-spin 0.8s linear infinite;
}

@keyframes bpf-spin {
    to { transform: rotate(360deg); }
}

/* Form-level loader is smaller (default for full update) */
.bpf-form .bpf-loader-overlay .bpf-loader-spinner {
    width: 28px;
    height: 28px;
    border-width: 2px;
}

/* Subtle variant: used during option-availability recalc.
   Less intrusive, but still blocks clicks so user knows to wait.  */
.bpf-loader-overlay--subtle {
    background: rgba(255, 255, 255, 0.55);
}
.bpf-loader-overlay--subtle .bpf-loader-spinner {
    width: 22px;
    height: 22px;
    border-width: 2px;
    border-color: rgba(24, 24, 24, 0.15);
    border-top-color: #181818;
}

/* ===== Per-element loading hints ===== */

/* Submit button: spinner appended, dim count, disable clicks. */
.bpf-submit.is-loading {
    opacity: 0.92;
    pointer-events: none;
    cursor: wait;
}
.bpf-submit.is-loading .bpf-submit__count {
    opacity: 0.45;
}
.bpf-submit.is-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bpf-spin 0.7s linear infinite;
    vertical-align: middle;
}

/* Total count: pulse softly to signal it is being recomputed. */
.bpf-submit__count.is-pulsing {
    animation: bpf-pulse 0.9s ease-in-out infinite;
}
@keyframes bpf-pulse {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 1;    }
}

/* Each field's option counts ("(123)") get replaced with "(…)" during recalc.
   The "(…)" pseudo-class lets us animate too. */
.bpf-checkbox__count.is-recalculating {
    opacity: 0.6;
    animation: bpf-pulse 0.9s ease-in-out infinite;
}

/* While AJAX is in flight, dim non-active fields a touch so user notices
   that we're working. Pointer events stay on (user can still queue clicks). */
.bpf-form.is-loading .bpf-field {
    transition: opacity 0.15s ease;
}
.bpf-form.is-loading .bpf-field:not(.bpf-field--just-changed) {
    opacity: 0.78;
}

/* The field the user just touched: subtle progress bar along the bottom edge.
   Strong enough for mobile finger-poke feedback. */
.bpf-field--just-changed {
    position: relative;
}
.bpf-field--just-changed::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--bpf-orange);
    transform-origin: left;
    animation: bpf-progress 1.2s ease-in-out infinite;
    border-radius: 1px;
    pointer-events: none;
}
@keyframes bpf-progress {
    0%   { transform: scaleX(0);    opacity: 1;   }
    50%  { transform: scaleX(1);    opacity: 0.8; }
    100% { transform: scaleX(0);    opacity: 0;   }
}

/* Mobile: bigger, more noticeable spinners. Touch users need clearer feedback. */
@media (max-width: 768px) {
    .bpf-loader-overlay {
        background: rgba(255, 255, 255, 0.85);
    }
    .bpf-loader-overlay .bpf-loader-spinner {
        width: 44px;
        height: 44px;
        border-width: 3px;
    }
    .bpf-form .bpf-loader-overlay .bpf-loader-spinner,
    .bpf-form .bpf-loader-overlay--subtle .bpf-loader-spinner {
        width: 36px;
        height: 36px;
        border-width: 3px;
    }
    .bpf-submit.is-loading::after {
        width: 18px;
        height: 18px;
        border-width: 2.5px;
        margin-left: 10px;
    }
}

/* Mobile (≤768px) ------------------------------------------------------- */
@media (max-width: 768px) {
    .bpf-form {
        gap: 12px;
    }
    .bpf-field {
        gap: 4px;
    }
    .bpf-submit {
        width: 100%;
    }
    .bpf-actions {
        flex-direction: column;
    }
    .bpf-reset {
        width: 100%;
    }
    /* Count sits right next to the brand name, not pushed to the far right.
       Label no longer fills the row. */
    .bpf-checkbox__label {
        flex: 0 0 auto;
    }
    .bpf-checkbox__count {
        margin-left: 6px;
    }
}

/* ==========================================================================
   v0.9.0 — Modern accordion design (per dribbble/figma reference)
   ========================================================================== */

/* When this is an accordion-layout form, the whole form behaves like a card
   sidebar with sticky footer. */
.bpf-form--accordion {
    background: #fff;
    border: 1px solid var(--bpf-border);
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    gap: 0;
    /* Reset the global form font-weight to default per dribbble (regular). */
}

/* Header (Filters + count badge + ×) ------------------------------------ */
.bpf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--bpf-border);
}
.bpf-header__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.bpf-header__title-text {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.1px;
    color: var(--bpf-ink);
}
.bpf-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--bpf-orange);
    padding: 2px 8px;
    background: var(--bpf-orange-soft);
    border-radius: 999px;
    line-height: 1.4;
}
.bpf-active-badge__num {
    font-weight: 700;
}

/* "Select car" pill button (rendered by [beiz_product_filter_select_car]).
   Sits to the right of the Filters title in the header. */
.bpf-select-car {
    background-color: rgb(246, 245, 241);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    padding-left: 15px;
    padding-right: 15px;
    border-radius: 30px;
    text-decoration: none;
    color: var(--bpf-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    transition: background-color 120ms ease;
    margin-left: auto;
}
.bpf-select-car:hover,
.bpf-select-car:focus {
    background-color: #ece9e1;
    color: var(--bpf-ink);
    text-decoration: none;
}
.bpf-header__close {
    appearance: none;
    width: 28px;
    height: 28px;
    border: 1px solid var(--bpf-border);
    border-radius: 999px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bpf-ink);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0;
}
.bpf-header__close:hover {
    background: var(--bpf-surface-2);
}

/* Active section + chips ------------------------------------------------ */
.bpf-active-section {
    padding: 12px 14px;
    border: 0;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bpf-surface-3);
}
.bpf-active-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.bpf-active-section__title {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--bpf-ink-3);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}
.bpf-clear-all {
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--bpf-orange);
    font-size: 11.5px;
    font-weight: 700;
    padding: 0;
}
.bpf-clear-all:hover {
    text-decoration: underline;
}
.bpf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.bpf-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px 4px 9px;
    background: var(--bpf-ink);
    color: #fff;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
}
.bpf-chip__remove {
    appearance: none;
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.bpf-chip__remove:hover {
    background: rgba(255, 255, 255, 0.32);
}

/* Accordion sections ---------------------------------------------------- */
.bpf-form--accordion .bpf-fields {
    display: flex;
    flex-direction: column;
}
.bpf-form--accordion .bpf-field--accordion {
    border-bottom: 1px solid var(--bpf-border);
    padding: 0;
    gap: 0;
}
.bpf-form--accordion .bpf-field--accordion:last-child {
    border-bottom: 0;
}
/* When multiple fields are combined into one row (.bpf-row), suppress the
   per-field bottom border (the gap between cells would interrupt it) and
   put a single continuous border on the row container instead. */
.bpf-form--accordion .bpf-row {
    border-bottom: 1px solid var(--bpf-border);
}
.bpf-form--accordion .bpf-row:last-child {
    border-bottom: 0;
}
.bpf-form--accordion .bpf-row > .bpf-field--accordion {
    border-bottom: 0;
}
.bpf-field__head {
    appearance: none;
    background: transparent;
    border: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    font-family: inherit;
    text-align: left;
    color: var(--bpf-ink);
}
.bpf-field__head-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--bpf-ink);
}
.bpf-field__head-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
}
.bpf-field__summary {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--bpf-ink-3);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* When summary has an active value, color it orange (set via JS class). */
.bpf-field--accordion[data-has-value="1"] .bpf-field__summary {
    color: var(--bpf-orange);
    font-weight: 700;
}
.bpf-field__chevron {
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--bpf-ink-3);
    border-bottom: 1.5px solid var(--bpf-ink-3);
    transform: rotate(45deg);
    transition: transform 160ms ease;
    flex-shrink: 0;
    margin-top: -3px;
}
.bpf-field--open .bpf-field__chevron {
    transform: rotate(-135deg);
    margin-top: 2px;
}
.bpf-field__body {
    padding: 0 18px 18px;
}
.bpf-form--accordion .bpf-field__label {
    display: none;
}
.bpf-field--accordion.bpf-field--closed .bpf-field__body {
    display: none;
}

/* Tiles (grid of compact buttons) --------------------------------------- */
.bpf-tiles {
    display: grid;
    grid-template-columns: repeat(var(--bpf-tiles-cols, 4), minmax(0, 1fr));
    gap: 6px;
}
.bpf-tile {
    appearance: none;
    padding: 8px 4px;
    min-height: 44px;
    background: #fff;
    border: 1px solid var(--bpf-border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color 120ms, background 120ms, color 120ms;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-family: inherit;
    line-height: 1;
}
.bpf-tile__label {
    font-family: var(--bpf-font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--bpf-ink);
    line-height: 1;
}
.bpf-tile:hover:not(.is-disabled):not(.is-selected):not(:disabled) {
    border-color: var(--bpf-border-2);
}
.bpf-tile.is-selected {
    background: var(--bpf-ink);
    border-color: var(--bpf-ink);
}
.bpf-tile.is-selected .bpf-tile__label {
    color: #fff;
}
.bpf-tile.is-disabled,
.bpf-tile:disabled {
    background: var(--bpf-surface-2);
    cursor: not-allowed;
    border-color: var(--bpf-border);
}
.bpf-tile.is-disabled .bpf-tile__label,
.bpf-tile:disabled .bpf-tile__label {
    color: var(--bpf-ink-4);
}

/* Range slider — refined visuals (used everywhere, not only accordion) -- */
.bpf-form--accordion .bpf-range {
    padding: 4px 0 0;
}
.bpf-form--accordion .bpf-range .noUi-target {
    height: 3px;
    background: var(--bpf-surface-2);
    border: 0;
    box-shadow: none;
}
.bpf-form--accordion .bpf-range .noUi-connect {
    background: var(--bpf-orange);
}
.bpf-form--accordion .bpf-range .noUi-handle {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid var(--bpf-orange);
    box-shadow: 0 2px 5px rgba(15, 14, 12, 0.12);
    top: -7px;
    right: -8px;
}

/* Range with From/To inputs underneath ---------------------------------- */
.bpf-range--with-inputs .bpf-range__values {
    display: none;
}
.bpf-range__inputs {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
}
.bpf-range__input-wrap {
    flex: 1;
    position: relative;
    cursor: text;
}
.bpf-range__input-label {
    position: absolute;
    top: 4px;
    left: 9px;
    font-size: 9px;
    font-weight: 700;
    color: var(--bpf-ink-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
}
.bpf-range__input {
    width: 100%;
    padding: 17px 8px 7px;
    border: 1px solid var(--bpf-border);
    border-radius: 7px;
    font-family: var(--bpf-font-mono);
    font-size: 12px;
    font-weight: 600;
    background: #fff;
    outline: none;
    color: var(--bpf-ink);
    box-sizing: border-box;
    appearance: textfield;
    -moz-appearance: textfield;
}
.bpf-range__input::-webkit-outer-spin-button,
.bpf-range__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.bpf-range__input-wrap:focus-within {
    /* visually lift the input wrap when its child input is focused */
}
.bpf-range__input:focus {
    border-color: var(--bpf-orange);
}
.bpf-range__inputs-sep {
    color: var(--bpf-ink-3);
    font-weight: 700;
    font-size: 12px;
}

/* Brand list (checkbox list inside accordion) --------------------------- */
.bpf-form--accordion .bpf-checkbox-search {
    width: 100%;
    padding: 8px 10px 8px 30px;
    border: 1px solid var(--bpf-border);
    border-radius: 8px;
    font-size: 12px;
    outline: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'><circle cx='6' cy='6' r='4.5' stroke='%23888' stroke-width='1.5'/><path d='M9.5 9.5 12 12' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat;
    background-position: 10px center;
    box-sizing: border-box;
    margin-bottom: 10px;
}
.bpf-form--accordion .bpf-checkboxes {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0;
    gap: 0;
}
.bpf-form--accordion .bpf-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--bpf-border);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--bpf-ink);
}
.bpf-form--accordion .bpf-checkbox:last-child {
    border-bottom: 0;
}
.bpf-form--accordion .bpf-checkbox__box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--bpf-border-2);
    background: #fff;
    flex-shrink: 0;
}
.bpf-form--accordion .bpf-checkbox input[type="checkbox"]:checked + .bpf-checkbox__box {
    background: var(--bpf-orange);
    border-color: var(--bpf-orange);
}
.bpf-form--accordion .bpf-checkbox__label {
    font-size: 12.5px;
    font-weight: 600;
    flex: 1 1 auto;
    color: var(--bpf-ink);
}
.bpf-form--accordion .bpf-checkbox__count {
    font-size: 11px;
    color: var(--bpf-ink-3);
    font-weight: 500;
    margin-left: 0;
}

/* Sticky footer (Reset + Show results · N) ------------------------------ */
.bpf-form--accordion.bpf-form--sticky-footer {
    /* no special padding needed; footer is part of card */
}
.bpf-form--accordion .bpf-actions {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--bpf-border);
    display: flex;
    gap: 8px;
    align-items: center;
    background: #fff;
    margin: 0;
}
.bpf-form--accordion .bpf-actions--sticky {
    position: sticky;
    bottom: 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
    z-index: 10;
}
.bpf-form--accordion .bpf-reset {
    padding: 0 12px;
    height: 40px;
    background: #fff;
    border: 1px solid var(--bpf-border);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    color: var(--bpf-ink);
    cursor: pointer;
}
.bpf-form--accordion .bpf-reset:hover {
    background: var(--bpf-surface-2);
}
.bpf-form--accordion .bpf-submit {
    flex: 1;
    height: 40px;
    padding: 0 14px;
    background: var(--bpf-orange);
    color: #fff;
    border: 0;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}
.bpf-form--accordion .bpf-submit:hover {
    background: var(--bpf-orange-hover);
}
.bpf-submit__count {
    background: rgba(255, 255, 255, 0.22);
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}

/* Accordion mobile bigger (≤768px) — bigger tap targets, bigger fonts -- */
@media (max-width: 768px) {
    .bpf-form--accordion {
        border-radius: 0;
        border: 0;
    }
    /* Hide the header (Filters + active badge + close) on mobile. */
    .bpf-form--accordion .bpf-header {
        display: none;
    }
    .bpf-active-badge {
        font-size: 12px;
        padding: 3px 7px;
    }

    .bpf-active-section {
        padding: 12px 16px;
    }
    .bpf-chip {
        padding: 5px 6px 5px 10px;
        font-size: 12px;
    }
    .bpf-chip__remove {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }

    .bpf-form--accordion .bpf-field__head {
        padding: 16px 0;
    }
    .bpf-form--accordion .bpf-field__body {
        padding: 0 0 18px;
    }
    .bpf-field__head-label {
        font-size: 14px;
        font-weight: 700;
    }
    .bpf-field__summary {
        font-size: 12px;
        max-width: 160px;
    }

    /* Footer: 2-column grid, Submit (Apply) on the left, Reset on the right. */
    .bpf-form--accordion .bpf-actions {
        padding: 12px 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .bpf-form--accordion .bpf-actions .bpf-submit {
        grid-column: 1;
        min-height: 48px;
        width: 100%;
    }
    .bpf-form--accordion .bpf-actions .bpf-reset {
        grid-column: 2;
        width: 100%;
    }

    /* Sticky footer on mobile: use `fixed` rather than `sticky` so it works
       regardless of parent overflow/transform/popup layout. */
    .bpf-form--accordion .bpf-actions--sticky {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 9999;
        background: #fff;
        border-top: 1px solid var(--bpf-border);
        padding: 12px 16px !important;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
        /* Flex row: more robust than grid against aggressive theme CSS. */
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        margin: 0 !important;
        width: auto !important;
    }
    /* Each button takes an equal share of the available width. */
    .bpf-form--accordion .bpf-actions--sticky > .bpf-reset,
    .bpf-form--accordion .bpf-actions--sticky > .bpf-submit {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        margin: 0 !important;
    }
    /* Visual order: Submit (Apply) on the left, Reset on the right. */
    .bpf-form--accordion .bpf-actions--sticky > .bpf-submit { order: 1; }
    .bpf-form--accordion .bpf-actions--sticky > .bpf-reset  { order: 2; }
    /* Reserve space at the bottom of the form so the last field isn't hidden
       behind the fixed footer. */
    .bpf-form--accordion.bpf-form--sticky-footer {
        padding-bottom: 88px;
    }

    .bpf-tiles {
        grid-template-columns: repeat(var(--bpf-tiles-cols, 5), minmax(0, 1fr));
        gap: 8px;
    }
    .bpf-tile {
        padding: 10px 8px;
        border-radius: 10px;
    }
    .bpf-tile__label {
        font-size: 13px;
    }

    .bpf-range__input-label {
        top: 6px;
        left: 12px;
        font-size: 9.5px;
    }
    .bpf-range__input {
        padding: 22px 12px 10px;
        font-size: 14px;
        border-radius: 10px;
    }

    .bpf-form--accordion .bpf-checkbox-search {
        padding: 10px 14px 10px 38px;
        font-size: 13px;
        border-radius: 10px;
        background-position: 12px center;
        margin-bottom: 12px;
    }
    .bpf-form--accordion .bpf-checkbox {
        padding: 11px 0;
        gap: 12px;
    }
    .bpf-form--accordion .bpf-checkbox__box {
        width: 22px;
        height: 22px;
        border-radius: 6px;
    }
    .bpf-form--accordion .bpf-checkbox__label {
        font-size: 14px;
    }
    .bpf-form--accordion .bpf-checkbox__count {
        font-size: 12px;
    }

    .bpf-form--accordion .bpf-reset {
        padding: 0 16px;
        height: 48px;
        border-radius: 12px;
        font-size: 13px;
    }
    .bpf-form--accordion .bpf-submit {
        padding: 0 18px;
        border-radius: 12px;
        font-size: 14.5px;
    }
    .bpf-submit__count {
        padding: 3px 9px;
        font-size: 13px;
    }
}

/* ===== Row groups (combine multiple fields into one horizontal row) ====== */
/* Triggered by per-field "Row group" setting in the admin. Fields with the
   same non-zero row_group are wrapped in a single .bpf-row container. */
.bpf-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: stretch;
}
.bpf-row > .bpf-field {
    flex: 1 1 0;
    min-width: 0; /* allow shrinking below content width */
    width: 0;     /* combined with flex-grow:1 keeps cells equal width */
}
/* Children of grouped fields must also allow shrinking, otherwise dropdown
   min-content widths push items onto a new line. */
.bpf-row > .bpf-field * {
    min-width: 0;
}
.bpf-row > .bpf-field .bpf-dropdown,
.bpf-row > .bpf-field .bpf-field__head {
    width: 100%;
    box-sizing: border-box;
}

/* When a field in a row group is marked "default open": keep the label visible
   on the head but hide the right side (arrow / summary value / "All"), and
   keep the body open at all times (not collapsible). */
.bpf-field--row-open .bpf-field__head-right {
    display: none !important;
}
.bpf-field--row-open .bpf-field__head {
    cursor: default;
    pointer-events: none;
}
.bpf-field--row-open .bpf-field__head .bpf-field__head-label {
    pointer-events: auto;
}
.bpf-field--row-open.bpf-field--closed .bpf-field__body,
.bpf-field--row-open.bpf-field--closed .bpf-field__popover {
    display: block !important;
}
.bpf-field--row-open.bpf-field--closed {
    /* visually treat as open even if class wasn't set so */
}
