/**
 * VOVO Smart Filters — frontend styles.
 * All classes prefixed vovosf-. Light, theme-friendly defaults.
 */

.vovosf-wrapper { position: relative; }

/* ===== SIDEBAR ===== */
.vovosf-sidebar {
    background: #fff;
    border: 1px solid #e6e8eb;
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.45;
    color: #1f2328;
    max-width: 320px;
    box-sizing: border-box;
}
.vovosf-sidebar.is-sticky {
    position: sticky;
    top: 24px;
    /* No max-height / overflow on the sidebar itself — sticky used to clip
     * to its container's height once products column shrank, producing a
     * surprise scrollbar. Per-section scroll (below) handles long lists. */
}
.vovosf-sidebar.vovosf-position-right {
    margin-left: auto;
}

.vovosf-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef0f2;
}
.vovosf-sidebar-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.vovosf-reset-all {
    background: none;
    border: 0;
    color: #1d6fdb;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
}
.vovosf-reset-all:hover { text-decoration: underline; }

/* ===== SECTION (collapsible) ===== */
.vovosf-section {
    border-bottom: 1px solid #eef0f2;
    padding: 12px 0;
}
.vovosf-section:last-of-type { border-bottom: 0; }
.vovosf-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: 0;
    padding: 4px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1f2328;
    text-align: left;
}
.vovosf-section-caret {
    width: 10px; height: 10px;
    border-right: 2px solid #6b7280;
    border-bottom: 2px solid #6b7280;
    transform: rotate(-45deg);
    transition: transform .15s ease;
}
.vovosf-section.is-open .vovosf-section-caret { transform: rotate(45deg); }
.vovosf-section-body { padding-top: 10px; }

/* ===== LISTS ===== */
.vovosf-list {
    list-style: none; margin: 0; padding: 0;
    /* No cap by default — short lists render at natural height (no empty gap).
     * When the list overflows the configured max-height, JS adds .is-overflowing
     * which applies the cap + scroll. Override the cap via --vovosf-section-max-h
     * on .vovosf-sidebar (set from settings). */
    max-height: none;
    overflow-y: visible;
    /* Reserve a hair of right padding so labels don't bump into the scrollbar. */
    padding-right: 4px;
}
.vovosf-list.is-overflowing {
    max-height: var( --vovosf-section-max-h, 280px );
    overflow-y: auto;
}
/* Cleaner scrollbar for the list (Firefox + WebKit). */
.vovosf-list { scrollbar-width: thin; scrollbar-color: #c6c8cb transparent; }
.vovosf-list::-webkit-scrollbar { width: 6px; }
.vovosf-list::-webkit-scrollbar-thumb {
    background: #c6c8cb; border-radius: 3px;
}
.vovosf-list::-webkit-scrollbar-thumb:hover { background: #9aa0a6; }
.vovosf-list::-webkit-scrollbar-track { background: transparent; }
.vovosf-item {
    display: flex; align-items: center;
    margin: 0; padding: 4px 0;
}
.vovosf-item.is-disabled { opacity: .45; }
.vovosf-label {
    display: flex; align-items: center;
    width: 100%; cursor: pointer;
    gap: 8px;
}
.vovosf-input { margin: 0; }
.vovosf-text { flex: 1; }
.vovosf-count { color: #6b7280; font-size: 12px; }

/* Filter search input */
.vovosf-filter-search {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 8px;
    border: 1px solid #d8dbe0;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}

/* ===== COLOR / IMAGE SWATCHES (row layout) =====
 * Each swatch renders as a row: small colored/image dot + plain text label
 * + optional count. Behaves visually like a checkbox row, NOT a giant tile.
 * (Pre-v1.0.17 rendered each swatch as a stacked tile; that looked like a
 *  button grid, hard to read with long color names.)
 */
.vovosf-list-color_swatch, .vovosf-list-image_swatch {
    display: flex; flex-direction: column; gap: 2px;
}
.vovosf-list-color_swatch .vovosf-item,
.vovosf-list-image_swatch .vovosf-item {
    padding: 0;
    width: 100%;
    display: block;
}
.vovosf-swatch-row {
    width: 100%;
    background: none; border: 0; padding: 5px 4px;
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    font: inherit; color: inherit;
    line-height: 1.2;
    text-align: left;
    border-radius: 4px;
    transition: background .12s;
}
.vovosf-swatch-row:hover { background: #f3f4f6; }
.vovosf-swatch-row.is-selected { background: #eff6ff; }
.vovosf-swatch-dot {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1px solid #d8dbe0;
    background-size: cover; background-position: center;
    color: #444; font-size: 11px; font-weight: 600;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.vovosf-swatch-row.is-selected .vovosf-swatch-dot {
    border-color: #1d6fdb;
    box-shadow: 0 0 0 2px rgba(29,111,219,.3);
}
.vovosf-swatch-text {
    flex: 1;
    font-size: 13px;
    color: #1f2328;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vovosf-swatch-row[disabled] { opacity: .4; cursor: not-allowed; }
.vovosf-swatch-row[disabled]:hover { background: transparent; }

/* Back-compat: legacy .vovosf-swatch-fill / .vovosf-swatch-label rules below
 * are kept for any cached AJAX response from pre-1.0.17. Can be deleted in v1.1. */
.vovosf-swatch-fill, .vovosf-swatch-label { display: none; }

/* ===== PILLS / SIZE BUTTONS ===== */
.vovosf-list-button { display: flex; flex-wrap: wrap; gap: 6px; }
.vovosf-list-button .vovosf-item { padding: 0; }
.vovosf-pill {
    background: #fff; border: 1px solid #d8dbe0; border-radius: 6px;
    padding: 6px 12px; cursor: pointer; font-size: 13px; line-height: 1;
}
.vovosf-pill.is-selected { background: #1d6fdb; color: #fff; border-color: #1d6fdb; }
.vovosf-pill[disabled] { opacity: .4; cursor: not-allowed; }

/* ===== STARS ===== */
.vovosf-stars { color: #f5b50a; letter-spacing: 1px; }
.vovosf-screen-reader { position:absolute; left:-9999px; }

/* ===== TOGGLE ===== */
.vovosf-toggle {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.vovosf-toggle .vovosf-input { position: absolute; opacity: 0; pointer-events: none; }
.vovosf-toggle-track {
    width: 36px; height: 20px;
    background: #d8dbe0;
    border-radius: 999px;
    position: relative;
    transition: background .15s ease;
    flex-shrink: 0;
}
.vovosf-toggle-thumb {
    position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .15s ease;
}
.vovosf-toggle .vovosf-input:checked + .vovosf-toggle-track { background: #1d6fdb; }
.vovosf-toggle .vovosf-input:checked + .vovosf-toggle-track .vovosf-toggle-thumb { transform: translateX(16px); }

/* ===== PRICE FILTER ===== */
.vovosf-price { padding: 4px 2px 0; }

.vovosf-price-inputs {
    display: flex; align-items: flex-end; gap: 8px;
    margin-bottom: 14px;
}
.vovosf-price-input-group {
    flex: 1; display: flex; flex-direction: column; gap: 4px;
    min-width: 0;
}
.vovosf-price-input-label {
    font-size: 11px; font-weight: 600; color: #6b7280;
    text-transform: uppercase; letter-spacing: .04em;
}
.vovosf-price-input-wrap {
    position: relative;
    display: flex; align-items: center;
    background: #fff;
    border: 1px solid #d1d5db; border-radius: 6px;
    transition: border-color .15s, box-shadow .15s;
}
.vovosf-price-input-wrap:focus-within {
    border-color: #1d6fdb;
    box-shadow: 0 0 0 3px rgba(29,111,219,.15);
}
.vovosf-price-currency {
    padding: 0 4px 0 10px;
    color: #6b7280; font-size: 14px; font-weight: 500;
    pointer-events: none; user-select: none;
}
.vovosf-price-num {
    flex: 1; min-width: 0;
    border: 0; outline: 0; background: transparent;
    padding: 8px 10px 8px 2px;
    font-size: 14px; color: #1f2328;
    -moz-appearance: textfield;
}
.vovosf-price-num::-webkit-outer-spin-button,
.vovosf-price-num::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}
.vovosf-price-sep {
    color: #9ca3af; padding-bottom: 9px; flex: 0 0 auto;
}

.vovosf-price-slider {
    position: relative;
    height: 28px;
    margin: 0 6px 4px;
}
.vovosf-price-rail {
    position: absolute; top: 12px; left: 0; right: 0;
    height: 4px; background: #e6e8eb; border-radius: 2px;
}
.vovosf-price-fill {
    position: absolute; top: 12px;
    height: 4px; background: #1d6fdb; border-radius: 2px;
}
.vovosf-price-handle {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 28px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none; appearance: none;
    margin: 0; padding: 0;
}
.vovosf-price-handle::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #1d6fdb;
    border: 3px solid #fff;
    pointer-events: auto; cursor: grab;
    box-shadow: 0 0 0 1px #1d6fdb, 0 2px 6px rgba(29,111,219,.35);
    transition: transform .12s, box-shadow .12s;
}
.vovosf-price-handle::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 1px #1d6fdb, 0 2px 10px rgba(29,111,219,.55);
}
.vovosf-price-handle::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.vovosf-price-handle::-moz-range-thumb {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #1d6fdb;
    border: 3px solid #fff;
    pointer-events: auto; cursor: grab;
    box-shadow: 0 0 0 1px #1d6fdb, 0 2px 6px rgba(29,111,219,.35);
    transition: transform .12s, box-shadow .12s;
}
.vovosf-price-handle::-moz-range-thumb:hover {
    box-shadow: 0 0 0 1px #1d6fdb, 0 2px 10px rgba(29,111,219,.55);
}
.vovosf-price-handle::-moz-range-thumb:active { cursor: grabbing; transform: scale(1.12); }
.vovosf-price-handle::-webkit-slider-runnable-track,
.vovosf-price-handle::-moz-range-track { background: transparent; border: 0; height: 28px; }

.vovosf-price-bounds {
    display: flex; justify-content: space-between;
    margin: 8px 0 12px;
    font-size: 11px; color: #9ca3af;
}

.vovosf-price-actions {
    display: flex; gap: 8px;
}
.vovosf-price-apply {
    flex: 1;
    padding: 8px 14px;
    background: #1d6fdb; color: #fff;
    border: 0; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.vovosf-price-apply:hover { background: #155ab8; }
.vovosf-price-clear {
    padding: 8px 14px;
    background: transparent; color: #6b7280;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.vovosf-price-clear:hover { background: #f3f4f6; color: #1f2328; border-color: #9ca3af; }
.vovosf-price-clear[hidden] { display: none; }

/* ===== SELECT (dropdown / multiselect) ===== */
.vovosf-select {
    width: 100%;
    padding: 8px 28px 8px 10px;
    border: 1px solid #d1d5db; border-radius: 6px;
    background: #fff
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
        no-repeat right 10px center / 12px;
    font-size: 14px; color: #1f2328;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    cursor: pointer;
}
.vovosf-select:focus { outline: 0; border-color: #1d6fdb; box-shadow: 0 0 0 3px rgba(29,111,219,.15); }
.vovosf-select-multiselect {
    padding: 6px 8px;
    background-image: none;
    cursor: default;
}
.vovosf-select-multiselect option { padding: 4px 6px; }
.vovosf-select option:disabled { color: #c0c4cb; }

/* ===== CUSTOM SEARCHABLE DROPDOWN =====
 * Used when a dropdown-style filter has more options than the configured
 * dropdown_search_threshold. The native <select> is replaced by a button
 * that opens a popup containing a search input and a filtered listbox. */
.vovosf-dropdown {
    position: relative;
    width: 100%;
}
.vovosf-dropdown-trigger {
    width: 100%;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; color: #1f2328;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, box-shadow .15s;
}
.vovosf-dropdown-trigger:hover { border-color: #9ca3af; }
.vovosf-dropdown.is-open .vovosf-dropdown-trigger,
.vovosf-dropdown-trigger:focus {
    outline: 0;
    border-color: #1d6fdb;
    box-shadow: 0 0 0 3px rgba(29,111,219,.15);
}
.vovosf-dropdown-value {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vovosf-dropdown-caret {
    flex: 0 0 auto;
    width: 12px; height: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat center / contain;
    transition: transform .15s;
}
.vovosf-dropdown.is-open .vovosf-dropdown-caret { transform: rotate(180deg); }

.vovosf-dropdown-popup {
    position: absolute;
    top: calc(100% + 4px); left: 0; right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,23,42,.12), 0 2px 6px rgba(15,23,42,.06);
    padding: 8px;
    display: flex; flex-direction: column;
    max-height: 320px;
    overflow: hidden;
}
.vovosf-dropdown-popup[hidden] { display: none; }
.vovosf-dropdown-search {
    width: 100%;
    padding: 7px 10px;
    margin: 0 0 6px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}
.vovosf-dropdown-search:focus {
    outline: 0;
    border-color: #1d6fdb;
    box-shadow: 0 0 0 3px rgba(29,111,219,.15);
}
.vovosf-dropdown-list {
    list-style: none; margin: 0; padding: 0;
    overflow-y: auto;
    max-height: 260px;
    scrollbar-width: thin; scrollbar-color: #c6c8cb transparent;
}
.vovosf-dropdown-list::-webkit-scrollbar { width: 6px; }
.vovosf-dropdown-list::-webkit-scrollbar-thumb { background: #c6c8cb; border-radius: 3px; }
.vovosf-dropdown-option {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px; color: #1f2328;
    transition: background .1s;
}
.vovosf-dropdown-option:hover { background: #f3f4f6; }
.vovosf-dropdown-option.is-selected {
    background: #eff6ff; color: #1d4ed8; font-weight: 500;
}
.vovosf-dropdown-option.is-disabled {
    opacity: .45; cursor: not-allowed;
}
.vovosf-dropdown-option.is-disabled:hover { background: transparent; }
.vovosf-dropdown-option-label {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vovosf-dropdown-option .vovosf-count { flex: 0 0 auto; }

/* ===== ACTIONS ===== */
.vovosf-sidebar-actions { margin-top: 14px; }
.vovosf-apply {
    width: 100%; padding: 9px 14px;
    background: #1d6fdb; color: #fff;
    border: 0; border-radius: 6px;
    font-size: 14px; font-weight: 600; cursor: pointer;
}
.vovosf-apply:hover { background: #155cb8; }

/* ===== LOADING ===== */
.vovosf-loading {
    margin-top: 12px; display: flex; justify-content: center;
    transition: opacity .15s ease;
}
.vovosf-loading[aria-hidden="true"] { opacity: 0; pointer-events: none; }
.vovosf-spinner {
    width: 22px; height: 22px;
    border: 3px solid #e6e8eb; border-top-color: #1d6fdb;
    border-radius: 50%;
    animation: vovosf-spin .7s linear infinite;
}
@keyframes vovosf-spin { to { transform: rotate(360deg); } }

.vovosf-wrapper.is-loading .vovosf-sidebar { opacity: .7; }

/* ===== CHIPS ===== */
.vovosf-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 0 0 14px;
}
.vovosf-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eef4fc; color: #1d4ed8;
    border: 1px solid #cfe0fa;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.vovosf-chip:hover { background: #dde8fa; }
.vovosf-chip-x { font-size: 14px; line-height: 1; }

/* ===== MOBILE DRAWER ===== */
.vovosf-mobile-toggle {
    display: none !important;
    align-items: center; gap: 6px;
    background: #1f2328; color: #fff;
    border: 0; border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px; cursor: pointer;
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
}

.vovosf-no-scroll { overflow: hidden; }

.vovosf-no-results {
    padding: 20px;
    background: #fafbfc;
    border: 1px dashed #d8dbe0;
    border-radius: 8px;
    text-align: center;
    color: #6b7280;
}

/* ===== STANDALONE CHIPS BAR (placed via [vovo_smart_filters_chips]) ===== */
.vovosf-chips.vovosf-chips-external {
    margin: 0 0 16px;
    padding: 0;
    min-height: 0;
}
.vovosf-chips.vovosf-chips-external:empty {
    display: none;
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    .vovosf-mobile-toggle { display: inline-flex !important; }
    .vovosf-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 88vw; max-width: 360px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform .25s ease;
        max-height: 100vh;
        border-radius: 0;
        overflow-y: auto;
    }
    .vovosf-wrapper.is-drawer-open .vovosf-sidebar {
        transform: translateX(0);
    }
    .vovosf-wrapper.is-drawer-open::before {
        content: "";
        position: fixed; inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 999;
    }
}
