/* ══════════════════════════════════════════════
   Shooglis Filter Sidebar — filter.css
   Desktop: sticky right sidebar | Mobile: Flatsome off-canvas
   ══════════════════════════════════════════════ */

/* ─── Box-sizing reset ──────────────────────── */
#sfb-sidebar, #sfb-sidebar *,
.sfb-layout-wrap, .sfb-layout-wrap *,
.sfb-shop-sidebar-content, .sfb-shop-sidebar-content *,
.sfb-mobile-sort-row, .sfb-mobile-sort-row * {
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════
   LAYOUT: 2-col wrapper (desktop)
   ══════════════════════════════════════════════ */

.tax-product_cat .sfb-layout-wrap {
    display: flex;
    direction: rtl;
    align-items: flex-start;
    gap: 28px;
}

/* Products column */
#sfb-products-wrap {
    flex: 1;
    min-width: 0;
}

/* ══════════════════════════════════════════════
   DESKTOP SIDEBAR
   ══════════════════════════════════════════════ */

#sfb-sidebar {
    width: 248px;
    flex-shrink: 0;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d6ccc7 transparent;
    background: #fff;
    border: 1px solid #e8e2dd;
    border-radius: 10px;
    padding: 16px;
    direction: rtl;
}
#sfb-sidebar::-webkit-scrollbar { width: 4px; }
#sfb-sidebar::-webkit-scrollbar-thumb { background: #d6ccc7; border-radius: 2px; }

/* Sidebar header row */
.sfb-sb-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.sfb-sb-heading {
    font-size: 15px;
    font-weight: 700;
    color: #3d3238;
}

/* Sort */
.sfb-sb-sort {
    padding-bottom: 12px;
    border-bottom: 1px solid #f0ebe7;
    margin-bottom: 4px;
}
.sfb-sb-sort-label {
    display: block;
    font-size: 12px;
    color: #9e8880;
    margin-bottom: 4px;
    font-weight: 500;
}
.sfb-sort-select {
    width: 100%;
    border: 1px solid #e0d8d3;
    border-radius: 7px;
    background: #faf6f3;
    font-size: 13px;
    color: #3d3238;
    cursor: pointer;
    font-family: inherit;
    padding: 7px 10px;
    outline: none;
    direction: rtl;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%233d3238' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 10px center;
}
.sfb-sort-select:focus { border-color: #9e8880; }

/* ─── Filter sections (accordion) ───────────── */
.sfb-sb-section {
    border-bottom: 1px solid #f0ebe7;
}
.sfb-sb-section:last-of-type { border-bottom: none; }

.sfb-sb-section-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #3d3238;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    gap: 6px;
}
.sfb-sb-section-title:hover { color: #000; }
.sfb-sb-section-title.has-value { color: #3d3238; }
.sfb-sb-section-title.has-value::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c07b5a;
    flex-shrink: 0;
}

.sfb-chevron {
    width: 11px;
    height: 7px;
    stroke: currentColor;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sfb-sb-section.is-open .sfb-chevron { transform: rotate(180deg); }

.sfb-sb-section-body {
    display: none;
    padding-bottom: 12px;
}
.sfb-sb-section.is-open .sfb-sb-section-body { display: block; }

/* ─── Toggle (sale) ─────────────────────────── */
.sfb-sb-section--toggle { border-bottom: 1px solid #f0ebe7; }

.sfb-sb-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    cursor: pointer;
}
.sfb-sb-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: #3d3238;
}

.sfb-switch-wrap { position: relative; flex-shrink: 0; }
.sfb-toggle-cb { position: absolute; opacity: 0; width: 0; height: 0; }

.sfb-switch {
    display: block;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: #d6ccc7;
    position: relative;
    transition: background 0.2s;
}
.sfb-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.sfb-toggle-cb:checked + .sfb-switch { background: #3d3238; }
.sfb-toggle-cb:checked + .sfb-switch::after { transform: translateX(-18px); }

/* ─── Options (checkboxes / radios) ─────────── */
.sfb-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    color: #3d3238;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}
.sfb-option input[type="checkbox"],
.sfb-option input[type="radio"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #3d3238;
    flex-shrink: 0;
    cursor: pointer;
}
.sfb-option:hover { color: #000; }
.sfb-option--sub { padding-right: 16px; font-size: 12px; color: #7a6b73; }
.sfb-option--disabled {
    opacity: 0.38;
    pointer-events: none;
    cursor: default;
}
.sfb-opt-count { font-size: 11px; color: #9e8880; margin-right: 1px; }
.sfb-sb-section--disabled .sfb-sb-toggle-label,
.sfb-toggle-row--disabled .sfb-sb-toggle-label { color: #9e8880; }
.sfb-toggle-row--disabled .sfb-switch { pointer-events: none; }

.sfb-alcohol-sub { margin-top: 4px; padding-top: 6px; border-top: 1px solid #f0ebe7; }

/* ─── Price presets ─────────────────────────── */
.sfb-price-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}
.sfb-preset-btn {
    padding: 4px 9px;
    border: 1px solid #d6ccc7;
    border-radius: 14px;
    background: #fff;
    font-size: 12px;
    color: #3d3238;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.sfb-preset-btn:hover { border-color: #9e8880; background: #faf6f3; }
.sfb-preset-btn.active { background: #3d3238; color: #fff; border-color: #3d3238; }

/* ─── Dual-range price slider ───────────────── */
.sfb-slider-wrap { padding-top: 2px; }
.sfb-slider {
    position: relative;
    height: 26px;
    display: flex;
    align-items: center;
}
.sfb-track {
    position: absolute;
    right: 0; left: 0;
    height: 4px;
    background: #e0d8d3;
    border-radius: 2px;
    pointer-events: none;
}
.sfb-fill {
    position: absolute;
    height: 100%;
    background: #3d3238;
    border-radius: 2px;
}
.sfb-range {
    position: absolute;
    right: 0; left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    pointer-events: none;
    margin: 0;
}
.sfb-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #3d3238;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    cursor: pointer;
    pointer-events: all;
    transition: box-shadow 0.15s;
}
.sfb-range::-webkit-slider-thumb:hover { box-shadow: 0 1px 8px rgba(60,40,30,0.25); }
.sfb-range::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #3d3238;
    cursor: pointer;
    pointer-events: all;
}
.sfb-range-hi { z-index: 2; }
.sfb-range-lo { z-index: 3; }

.sfb-price-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #3d3238;
    font-weight: 500;
}

/* ─── Above-products active chips ──────────── */
#sfb-active-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    direction: rtl;
    padding: 6px 0 14px;
    border-bottom: 1px solid #f0ebe7;
    margin-bottom: 16px;
}
.sfb-active-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    flex: 1;
}
.sfb-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px 5px 6px;
    background: #edf5ee;
    border: 1px solid #7ab87f;
    border-radius: 16px;
    font-size: 13px;
    color: #2a6630;
    white-space: nowrap;
}
.sfb-active-chip .sfb-chip-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4caf50;
    flex-shrink: 0;
}
.sfb-active-chip .sfb-chip-label { line-height: 1; }
.sfb-active-chip .sfb-chip-x {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: rgba(42,102,48,0.12);
    border: none;
    cursor: pointer;
    color: #2a6630;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}
.sfb-active-chip .sfb-chip-x:hover { background: rgba(42,102,48,0.25); }
#sfb-active-chips > .sfb-clear-all {
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Mobile sidebar top actions ────────────── */
.sfb-mobile-top-actions {
    display: flex;
    gap: 10px;
    padding: 0 0 14px;
    border-bottom: 1px solid #f0ebe7;
    margin-bottom: 4px;
}
.sfb-mobile-top-actions .sfb-mobile-apply {
    flex: 1;
    padding: 11px;
    font-size: 14px;
}
.sfb-mobile-top-actions .sfb-clear-all {
    flex: 0 0 auto;
    padding: 11px 16px;
    border: 1px solid #d6ccc7;
    border-radius: 22px;
    background: #fff;
    font-size: 14px;
    color: #3d3238;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

/* ─── Active chips (sidebar — desktop) ─────── */
.sfb-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 0 2px;
    direction: rtl;
}
.sfb-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.sfb-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #f0ebe7;
    border-radius: 12px;
    font-size: 12px;
    color: #3d3238;
    white-space: nowrap;
}
.sfb-chip .sfb-chip-dot { display: none; } /* dot only on active-chip variant */
.sfb-chip-x {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #7a6b73;
    font-size: 13px;
    line-height: 1;
    padding: 0;
}
.sfb-chip-x:hover { color: #3d3238; }

.sfb-clear-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #9e8880;
    text-decoration: underline;
    padding: 0;
    font-family: inherit;
}
.sfb-clear-all:hover { color: #3d3238; }

/* ─── Hide WooCommerce default sort (replaced by sidebar sort) ─ */
.tax-product_cat .woocommerce-ordering { display: none !important; }

/* ─── Loading state ─────────────────────────── */
#sfb-products-wrap.sfb-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s;
    min-height: 200px;
}

/* ─── No results ────────────────────────────── */
.sfb-no-results {
    padding: 48px 24px;
    text-align: center;
    direction: rtl;
    width: 100%;
}
.sfb-no-results-title {
    font-size: 17px;
    font-weight: 600;
    color: #3d3238;
    margin-bottom: 8px;
}
.sfb-no-results-sub {
    font-size: 14px;
    color: #7a6b73;
    line-height: 1.6;
}

/* ══════════════════════════════════════════════
   MOBILE in Flatsome's #shop-sidebar
   ══════════════════════════════════════════════ */

/* Hide existing WooCommerce price widget inside shop-sidebar */
#shop-sidebar .widget_price_filter,
#shop-sidebar .widget.my_price_range_widget,
#shop-sidebar .widget.my_acf_tag_widget { display: none; }

.sfb-shop-sidebar-content {
    direction: rtl;
    padding: 4px 0 8px;
}
.sfb-shop-sidebar-content .sfb-sb-top {
    padding-bottom: 12px;
    border-bottom: 1px solid #f0ebe7;
    margin-bottom: 4px;
}
.sfb-shop-sidebar-content .sfb-sb-heading {
    font-size: 15px;
    font-weight: 700;
    color: #3d3238;
}
.sfb-shop-sidebar-content .sfb-sb-sort {
    padding: 8px 0 12px;
    border-bottom: 1px solid #f0ebe7;
}
.sfb-shop-sidebar-content .sfb-sort-select {
    width: 100%;
}
.sfb-shop-sidebar-content .sfb-sb-section {
    border-bottom: 1px solid #f0ebe7;
}
.sfb-shop-sidebar-content .sfb-sb-section-title { padding: 14px 0; font-size: 15px; }
.sfb-shop-sidebar-content .sfb-sb-section-body { padding-bottom: 14px; }
.sfb-shop-sidebar-content .sfb-option { font-size: 15px; padding: 7px 0; }
.sfb-shop-sidebar-content .sfb-preset-btn { font-size: 13px; padding: 6px 12px; }
.sfb-shop-sidebar-content .sfb-sb-toggle-row { padding: 14px 0; }
.sfb-shop-sidebar-content .sfb-sb-toggle-label { font-size: 15px; }

/* Mobile actions (apply + clear) */
.sfb-mobile-actions {
    display: flex;
    gap: 10px;
    padding: 16px 0 8px;
}
.sfb-mobile-actions .sfb-clear-all {
    flex: 0 0 auto;
    padding: 11px 18px;
    border: 1px solid #d6ccc7;
    border-radius: 22px;
    background: #fff;
    font-size: 14px;
    color: #3d3238;
    text-decoration: none;
}
.sfb-mobile-apply {
    flex: 1;
    padding: 12px;
    background: #3d3238;
    color: #fff;
    border: none;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.sfb-mobile-apply:hover { background: #2a2126; }

/* ═══ Filter-button badge ═══ */
.sfb-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #c07b5a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* ═══ Mobile sort bar (hidden by default, shown via @media below) ═══ */
.sfb-mobile-sort-row { display: none; }

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */

@media (max-width: 767px) {
    /* Collapse 2-col layout to single column */
    .tax-product_cat .sfb-layout-wrap { display: block; }

    /* Hide desktop sidebar */
    #sfb-sidebar { display: none !important; }

    /* ── Mobile toolbar: filter button + sort select side-by-side ── */

    /* Fix old customizer rule that removed the toolbar from flow */
    .tax-product_cat .category-filtering.category-filter-row {
        position: static !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        direction: rtl;
        padding: 6px 0 10px !important;
    }

    /* Prominent filter pill button */
    .tax-product_cat .filter-button {
        display: inline-flex !important;
        align-items: center;
        gap: 8px;
        background: #3d3238 !important;
        color: #fff !important;
        border-radius: 24px !important;
        padding: 10px 20px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        border: none !important;
        box-shadow: 0 2px 8px rgba(61,50,56,0.15) !important;
        text-decoration: none !important;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .tax-product_cat .filter-button i { color: #fff !important; }
    .tax-product_cat .filter-button.has-active { background: #c07b5a !important; }

    /* Mobile sort row: hidden — sort is accessible via the filter sidebar */
    .sfb-mobile-sort-row { display: none !important; }
}

@media (min-width: 768px) {
    /* Desktop: hide mobile elements */
    .sfb-mobile-sort-row { display: none !important; }

    /* Hide Flatsome's filter button (desktop sidebar is always visible) */
    .tax-product_cat .filter-button { display: none !important; }

    /* Hide Flatsome's off-canvas sidebar (desktop uses inline sidebar) */
    .tax-product_cat #shop-sidebar { display: none !important; }
}
