:root {
    --bd-filter-black: #000000;
    --bd-filter-brand: #D4AB3B;
    --bd-filter-grey:  #EAEAEC;
}

#bd-ajax-filters-container ul, #bd-ajax-filters-container li {
    list-style: none !important; margin: 0 !important; padding: 0 !important;
}
#bd-ajax-filters-container ul::before, #bd-ajax-filters-container li::before {
    display: none !important;
}

/* STICKY TOP BAR */
#custom-filter-topbar {
    position: sticky; top: 0; z-index: 99; background: #ffffff;
    padding: 1rem 0; margin-bottom: 2rem; display: flex; align-items: center; gap: 1rem;
}

/* FIXED LEFT-EDGE FILTER TAB (mobile/tablet trigger; hidden on desktop, see the 992px block below) */
.btn-filter-toggle {
    position: fixed !important; top: 50% !important; left: 0 !important;
    transform: translateY(-50%) !important; z-index: 999;
    display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
    gap: 8px !important; padding: 18px 10px !important; border: none; cursor: pointer;

    border-radius: 0 16px 16px 0 !important;
    background: var(--bd-filter-brand) !important;
    box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.25) !important;

    color: var(--bd-filter-black) !important;
    transition: background 0.25s ease !important;
}
.btn-filter-toggle:hover,
.btn-filter-toggle:active {
    background: #c29a2f !important;
}
.btn-filter-toggle svg {
    flex-shrink: 0;
    stroke: var(--bd-filter-black) !important;
}
.btn-filter-label {
    writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: 0.85rem !important; font-weight: 800 !important;
    letter-spacing: 1px !important; text-transform: uppercase;
}
.top-active-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.top-chip {
    display: inline-flex !important; align-items: center !important; background: transparent !important;
    border: 1px solid var(--bd-filter-grey) !important; border-radius: 20px !important;
    padding: 4px 12px !important; font-size: 0.8rem !important; color: var(--bd-filter-black) !important;
    text-decoration: none !important; transition: all 0.2s ease !important;
}
.top-chip:hover { border-color: var(--bd-filter-black) !important; }
.top-chip .close-x { margin-right: 6px; font-size: 1.1rem; line-height: 1; }
.top-clear-all { font-size: 0.85rem !important; color: #888 !important; text-decoration: underline !important; margin-left: 10px !important; }
.top-clear-all:hover { color: var(--bd-filter-black) !important; }

/* SUBTLE FROSTED LIQUID GLASS BACKDROP */
#filter-drawer-overlay {
    position: fixed; inset: 0; 
    background: rgba(0, 0, 0, 0.18) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 9998; opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease !important;
}
#filter-drawer-overlay.open { opacity: 1 !important; pointer-events: auto !important; }

/* DRAWER PANEL & ANIMATIONS */
#filter-drawer-panel {
    position: fixed; top: 0; left: 0; width: 100%; max-width: 380px; height: 100vh;
    background: #ffffff !important;
    box-shadow: 10px 0 40px rgba(0,0,0,0.12) !important;
    z-index: 9999; display: flex; flex-direction: column;
    transform: translateX(-100%) !important; /* Default off-screen */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Force hardware acceleration for buttery smooth sliding */
#filter-drawer-panel.open {
    transform: translateX(0) !important;
}
#filter-drawer-panel.closing {
    transform: translateX(-100%) !important;
}

.drawer-header {
    padding: 1.5rem; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--bd-filter-grey); background: #ffffff;
}
.drawer-header h2 { margin: 0 !important; font-size: 1.3rem !important; font-weight: 800 !important; }
#close-filter-drawer { background: none; border: none; font-size: 2rem; cursor: pointer; line-height: 1; color: var(--bd-filter-black); }
.drawer-content { flex: 1; overflow-y: auto; padding: 1.5rem; background: #ffffff; }

.drawer-section { border-bottom: 1px solid var(--bd-filter-grey); padding: 1.25rem 0; }
.drawer-section:first-child { padding-top: 0; }
.drawer-section:last-child { border-bottom: none; }

.drawer-heading {
    margin: 0 !important; font-size: 1.05rem !important; font-weight: 800 !important;
    display: flex !important; justify-content: space-between !important; align-items: center !important;
    cursor: pointer; user-select: none; padding-bottom: 0.5rem;
}

.drawer-toggle-icon { 
    font-size: 1.4rem !important; font-weight: 400 !important; line-height: 1 !important; width: 20px; text-align: right; display: inline-block;
}

.drawer-section-inner {
    max-height: 1000px; overflow: hidden; opacity: 1; transition: max-height 0.4s ease, opacity 0.4s ease;
}
.drawer-section-inner.hidden-section {
    max-height: 0 !important; opacity: 0 !important; margin-top: 0 !important;
}

#bd-ajax-filters-container a.ajax-filter-link {
    font-size: 0.95rem !important; color: #333 !important; text-decoration: none !important; 
    padding: 0.5rem 0 !important; display: inline-block; transition: color 0.2s ease; flex: 1;
}
#bd-ajax-filters-container a.ajax-filter-link:hover { color: var(--bd-filter-brand) !important; }
#bd-ajax-filters-container .active-link { font-weight: 700 !important; color: var(--bd-filter-black) !important; }

.cat-parent-row { display: flex !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; }
.accordion-toggle {
    cursor: pointer; width: 32px; height: 32px; display: flex !important; align-items: center !important; justify-content: center !important; 
    background: transparent; border: none; color: #444; flex-shrink: 0; transition: transform 0.3s ease;
}
.accordion-toggle svg { width: 14px !important; height: 14px !important; display: block !important; transition: transform 0.3s ease; }
.accordion-item.open .accordion-toggle svg { transform: rotate(180deg); }

#bd-ajax-filters-container .custom-subcategories {
    max-height: 0; overflow: hidden; padding-left: 0 !important; opacity: 0; transition: all 0.3s ease;
}
#bd-ajax-filters-container .accordion-item.open .custom-subcategories {
    max-height: 800px; opacity: 1; margin-top: 0.2rem !important;
}
#bd-ajax-filters-container .custom-subcategories li { padding-left: 1.2rem !important; }
#bd-ajax-filters-container .custom-subcategories a.ajax-filter-link {
    font-size: 0.9rem !important; color: #666 !important; padding: 0.35rem 0 !important;
}

/* BRAND SMOOTH FADE ANIMATION */
.brand-item { 
    display: flex !important; justify-content: space-between !important; align-items: center !important; 
    max-height: 40px; opacity: 1; transform: translateY(0);
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.25s ease, 
                transform 0.25s ease,
                margin 0.35s ease; 
}
.brand-item.brand-hidden { 
    max-height: 0 !important; 
    opacity: 0 !important; 
    transform: translateY(-6px) !important;
    margin: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}
.brand-item.active-brand a { font-weight: 700 !important; color: var(--bd-filter-black) !important; }

.price-slider-container { position: relative; width: 100%; height: 20px; margin-bottom: 1rem; }
.slider-track { position: absolute; top: 8px; left: 0; width: 100%; height: 2px; background: var(--bd-filter-black); }
.price-range { position: absolute; top: 0; left: 0; width: 100%; -webkit-appearance: none !important; background: transparent !important; pointer-events: none; margin: 0 !important; }
.price-range::-webkit-slider-thumb {
    -webkit-appearance: none !important; width: 18px !important; height: 18px !important; background: #fff !important; 
    border: 2px solid var(--bd-filter-black) !important; border-radius: 50% !important; cursor: pointer; pointer-events: auto; margin-top: 1px;
}
.price-inputs { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.price-inputs span {
    display: flex; align-items: center; gap: 8px;
    background: #ffffff; border: 1px solid var(--bd-filter-grey); padding: 8px 12px; border-radius: 8px; font-size: 0.95rem; color: #444; width: 100%;
}

.modern-checkbox {
    display: flex !important; align-items: center !important; position: relative !important;
    padding-left: 30px !important; margin-bottom: 14px !important; cursor: pointer; font-size: 1rem !important; color: #444 !important;
}
.modern-checkbox input { position: absolute !important; opacity: 0 !important; cursor: pointer !important; height: 0 !important; width: 0 !important; }
.checkmark {
    position: absolute !important; top: 50% !important; transform: translateY(-50%) !important; left: 0 !important;
    height: 18px !important; width: 18px !important; background: #ffffff !important; border: 1px solid var(--bd-filter-grey) !important; border-radius: 4px !important; transition: all 0.2s ease;
}
.modern-checkbox input:checked ~ .checkmark { background: var(--bd-filter-black) !important; border-color: var(--bd-filter-black) !important; }
.checkmark:after {
    content: "" !important; position: absolute !important; display: none; left: 5px !important; top: 2px !important;
    width: 4px !important; height: 8px !important; border: solid white !important; border-width: 0 2px 2px 0 !important; transform: rotate(45deg) !important;
}
.modern-checkbox input:checked ~ .checkmark:after { display: block !important; }

/* DESKTOP-ONLY: "Filters" toggle for Brand/Price/Availability, hidden on mobile where it doesn't exist */
#desktop-filters-toggle { display: none; }

.drawer-footer { padding: 1.5rem; border-top: 1px solid var(--bd-filter-grey); background: #ffffff; }
.drawer-apply-btn {
    width: 100%; background: var(--bd-filter-black) !important; color: #fff !important; border: none !important;
    padding: 16px !important; border-radius: 12px !important; font-size: 1.1rem !important; font-weight: 700 !important; cursor: pointer; transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.drawer-apply-btn:hover { background: var(--bd-filter-brand) !important; }

/* RESPONSIVE: STATIC SIDEBAR ON DESKTOP, OFF-CANVAS DRAWER STAYS MOBILE-ONLY */
@media (min-width: 992px) {
    #open-filter-drawer,
    #filter-drawer-overlay,
    #close-filter-drawer {
        display: none !important;
    }

    #filter-drawer-panel,
    #filter-drawer-panel.open,
    #filter-drawer-panel.closing {
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        transform: none !important;
        box-shadow: none !important;
    }

    /* CATEGORIES: always expanded, no collapse, desktop only */
    .drawer-section-categories .drawer-toggle-icon {
        display: none !important;
    }
    .drawer-section-categories .drawer-heading {
        cursor: default !important;
        pointer-events: none !important;
    }
    .drawer-section-categories .drawer-section-inner {
        max-height: none !important;
        opacity: 1 !important;
    }

    /* "FILTERS" TOGGLE + COLLAPSIBLE BRAND/PRICE/AVAILABILITY GROUP */
    #desktop-filters-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        margin: 0.5rem 0 1rem !important;
        padding: 12px 16px !important;
        background: var(--bd-filter-grey) !important;
        border: none !important;
        border-radius: 10px !important;
        cursor: pointer;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        color: var(--bd-filter-black) !important;
        transition: background 0.2s ease !important;
    }
    #desktop-filters-toggle:hover {
        background: #e0e0e3 !important;
    }
    #desktop-filters-toggle span:first-child {
        flex: 1 !important;
        text-align: left !important;
    }
    .filters-count-badge {
        background: var(--bd-filter-black) !important;
        color: #ffffff !important;
        border-radius: 999px !important;
        padding: 2px 9px !important;
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        margin: 0 8px !important;
    }
    .filters-toggle-chevron {
        display: flex !important;
        transition: transform 0.3s ease !important;
    }
    #desktop-filters-toggle.open .filters-toggle-chevron {
        transform: rotate(180deg);
    }

    .drawer-filters-group {
        max-height: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        transition: max-height 0.4s ease, opacity 0.3s ease !important;
    }
    .drawer-filters-group.open {
        max-height: 2000px !important;
        opacity: 1 !important;
    }

    .drawer-footer {
        display: none !important;
    }
    .drawer-footer.open {
        display: block !important;
    }
}