/* BEIZ Product Filter — frontend styles */

.bpf-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    /* All form text uses weight 500 by default */
    font-weight: 500;
}

/* 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: 4px;
}
.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;
}
.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 ------------------------------------------------------- */
.bpf-form--horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}
.bpf-form--horizontal .bpf-field {
    flex: 1 1 180px;
    min-width: 160px;
    border-bottom: 0;
    padding-bottom: 0;
}
.bpf-form--horizontal .bpf-field--range,
.bpf-form--horizontal .bpf-field--minmax {
    flex: 1 1 220px;
}
.bpf-form--horizontal .bpf-field--checkbox {
    /* Checkbox lists in horizontal layout: still vertical inside, but capped width */
    flex: 1 1 200px;
}
.bpf-form--horizontal .bpf-field--checkbox .bpf-checkboxes {
    max-height: 180px;
}
.bpf-form--horizontal .bpf-actions {
    padding-top: 0;
    align-self: flex-end;
    /* Sit on the same baseline as inputs */
    margin-bottom: 0;
}
.bpf-form--horizontal .bpf-actions .bpf-submit,
.bpf-form--horizontal .bpf-actions .bpf-reset {
    /* Match input height: padding 10px+10px + 14px line ≈ 40px; 12px+12px+14px = 42px is close */
    padding: 11px 18px;
}

/* 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;
}

/* 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;
    }
}
