/* ============================================
   Sidebar — desktop styling (≥ 1025px)
   ============================================ */
.wc_sidebar .widget_custom_html,
.wc_sidebar .to-filter-drawer__header,
.wc_sidebar .to-filter-drawer__footer {display: none;}

.wc_sidebar .widget{margin-bottom: 1.5rem!important;}

.wc_sidebar > .wpb_wrapper > * > h3{border-bottom: 1px solid #d0d0d0; padding-bottom: 1rem;}

.wc_sidebar h3{font-size: 16px;margin-bottom: 25px;cursor: pointer}
.wc_sidebar h3::after{content: '\f106'; font-family: 'FontAwesome';float:right;}
.wc_sidebar .widget.collapsed h3{margin-bottom:0px;}
.wc_sidebar .widget.collapsed h3::after{content: '\f107';}
.wc_sidebar .widget.collapsed > ul,
.wc_sidebar .widget.collapsed > form,
.wc_sidebar .widget.collapsed > .toggle_more{display: none;}

.wc_sidebar .widget:not(.expanded) .product-categories,
.wc_sidebar .widget:not(.expanded) .woocommerce-widget-layered-nav-list{overflow: hidden; margin-bottom: 0; font-size: 14px;}
.wc_sidebar .widget.expanded .product-categories,
.wc_sidebar .widget.expanded .woocommerce-widget-layered-nav-list{height: auto!important; margin-bottom: 0; font-size: 14px;}

.wc_sidebar .widget .toggle_more{color: var(--sc-primary); cursor: pointer; font-size: 14px;}
.wc_sidebar .widget .toggle_more::after{content: '\f107'!important; font-family: 'FontAwesome'; margin-left: 10px; font-size: 24px; position: absolute; font-weight: 100;}
.wc_sidebar .widget.expanded .toggle_more::after{content: '\f106'!important;}

.wc_sidebar li.wc-layered-nav-term{
    display: flex;
    align-items: center;
    line-height: 20px;
    padding-left: 0;
    font-size: 14px;
    gap: 8px;
}
.wc_sidebar li.wc-layered-nav-term a:before{border: 1px solid #4A4A4A; width: 12px; height: 12px; display: inline-block; opacity: 1; content: ''; margin-right: 20px; margin-top: 3px; pointer-events: none;background-color: #fff; border-radius: 0; box-shadow: none;}
.wc_sidebar li.wc-layered-nav-term.chosen a:before{ content: '\f00c'; background-color: #4A4A4A; color: #fff; line-height: 14px; text-align: center; }
.wc_sidebar li.wc-layered-nav-term a{
    color: #4A4A4A;
    text-decoration: none;
    padding-left: 25px;
    flex: 1 1 auto;
    min-width: 0;
}
.wc_sidebar li.wc-layered-nav-term .count{
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--to-ink-muted, #7a6e5d);
    font-variant-numeric: tabular-nums;
}

/* The sticky FAB is mobile-only */
.to-filter-trigger { display: none; }

/* ============================================
   Mobile / tablet — drawer + sticky FAB
   ============================================ */
@media (max-width: 1024px) {
    /* --- Sticky FAB trigger ----------------------------------------- */
    .to-filter-trigger {
        position: fixed;
        bottom: max(20px, env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        z-index: 9998;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 14px 22px 14px 18px;
        border: 0;
        border-radius: 999px;
        background: var(--to-ink, #3A2F22);
        color: #fff;
        font-family: var(--to-font-body, inherit);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.02em;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 12px 28px -8px rgba(58, 47, 34, 0.45), 0 4px 10px -2px rgba(58, 47, 34, 0.25);
        transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
    }
    .to-filter-trigger:hover,
    .to-filter-trigger:focus-visible {
        transform: translateX(-50%) translateY(-2px);
        box-shadow: 0 16px 32px -8px rgba(58, 47, 34, 0.55), 0 6px 12px -2px rgba(58, 47, 34, 0.3);
        outline: none;
    }
    .to-filter-trigger__icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #fff;
    }
    .to-filter-trigger__label { white-space: nowrap; }
    .to-filter-trigger__badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 7px;
        margin-left: 4px;
        border-radius: 999px;
        background: var(--to-accent, #B56E3C);
        color: #fff;
        font-size: 12px;
        font-weight: 700;
        line-height: 1;
    }
    .to-filter-trigger__badge[hidden] { display: none; }

    body.to-filter-open .to-filter-trigger {
        opacity: 0;
        pointer-events: none;
    }

    /* Lock body scroll while the drawer is open */
    body.to-filter-open { overflow: hidden; }

    /* --- Backdrop overlay ------------------------------------------- */
    .to-filter-overlay {
        position: fixed;
        inset: 0;
        z-index: 99998;
        background: rgba(34, 28, 20, 0.45);
        opacity: 0;
        transition: opacity .25s ease;
    }
    .to-filter-overlay.is-visible { opacity: 1; }
    .to-filter-overlay[hidden] { display: none; }

    /* --- Drawer ----------------------------------------------------- */
    .wc_sidebar {
        display: none;
    }
    .wc_sidebar.active {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(420px, 92vw);
        height: 100vh;
        height: 100dvh;
        max-width: 100%;
        background: var(--to-bg, #F8F2E6);
        z-index: 99999;
        padding: 0;
        overflow: hidden;
        box-shadow: -20px 0 40px -10px rgba(34, 28, 20, 0.25);
        /* Animate the standalone `translate` property — Impreza's sticky JS
           writes to `transform` on .wpb_widgetised_column ancestors, which
           was overriding our slide-in. Forcing transform: none guards
           against that, while `translate` does the actual sliding. */
        transform: none !important;
        translate: 100% 0;
        transition: translate .28s cubic-bezier(.2, .7, .2, 1);
    }
    .wc_sidebar.active.is-open { translate: 0 0; }

    .wc_sidebar.active > .wpb_wrapper {
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 0;
        overflow: hidden;
    }

    .wc_sidebar.active .to-filter-drawer__body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1.25rem 22px 0.5rem;
    }
    .wc_sidebar.active .to-filter-drawer__body > .widget {
        margin-bottom: 1.5rem !important;
    }
    .wc_sidebar.active .to-filter-drawer__body > .widget:last-child {
        margin-bottom: 0 !important;
    }

    .wc_sidebar .to-filter-drawer__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: 0 0 auto;
        padding: 20px 22px;
        border-bottom: 1px solid var(--to-line, #D9CDB8);
        background: #fff;
    }
    .wc_sidebar .to-filter-drawer__title {
        font-family: var(--to-font-display, Georgia, serif);
        font-size: 22px;
        font-weight: 500;
        color: var(--to-ink, #3A2F22);
        letter-spacing: -0.01em;
    }
    .wc_sidebar .to-filter-drawer__close {
        appearance: none;
        background: transparent;
        border: 0;
        padding: 8px;
        margin: -8px;
        color: var(--to-ink, #3A2F22);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        transition: background .15s;
    }
    .wc_sidebar .to-filter-drawer__close:hover,
    .wc_sidebar .to-filter-drawer__close:focus-visible {
        background: rgba(58, 47, 34, 0.08);
        outline: none;
    }

    /* Widget headings — slightly cleaner inside the drawer */
    .wc_sidebar.active h3.widgettitle {
        font-family: var(--to-font-body, inherit);
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--to-ink-muted, #7a6e5d);
        margin: 0 0 14px;
        padding: 0 0 10px;
        border-bottom: 1px solid var(--to-line, #D9CDB8) !important;
    }
    .wc_sidebar.active h3.widgettitle::after {
        content: '\f107' !important;
        font-family: 'FontAwesome';
        float: right;
        font-size: 16px;
        color: var(--to-ink, #3A2F22);
        transition: transform .2s;
    }
    .wc_sidebar.active .widget.collapsed h3.widgettitle::after {
        transform: rotate(-90deg);
    }

    .wc_sidebar.active li.wc-layered-nav-term a {
        padding: 8px 0 8px 28px;
        display: block;
        font-size: 15px;
        color: var(--to-ink, #3A2F22);
    }
    .wc_sidebar.active li.wc-layered-nav-term a:before {
        margin-top: 5px;
        border-color: var(--to-ink-soft, #5a4d3c);
    }

    .wc_sidebar.active .product-categories a {
        padding: 8px 0;
        display: inline-block;
        font-size: 15px;
    }

    /* Show-more becomes a clean text link */
    .wc_sidebar.active .toggle_more {
        font-size: 13px;
        font-weight: 500;
        padding-top: 6px;
    }

    /* --- Footer ----------------------------------------------------- */
    .wc_sidebar .to-filter-drawer__footer {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid var(--to-line, #D9CDB8);
        flex: 0 0 auto;
    }
    .wc_sidebar .to-filter-drawer__clear {
        flex: 0 0 auto;
        font-size: 13px;
        font-weight: 500;
        color: var(--to-ink-soft, #5a4d3c);
        text-decoration: underline;
        text-decoration-color: var(--to-line, #D9CDB8);
        text-underline-offset: 4px;
        white-space: nowrap;
    }
    .wc_sidebar .to-filter-drawer__clear[hidden] { display: none; }
    .wc_sidebar .to-filter-drawer__clear:hover {
        color: var(--to-ink, #3A2F22);
        text-decoration-color: currentColor;
    }
    .wc_sidebar .to-filter-drawer__apply {
        flex: 1 1 auto;
        appearance: none;
        border: 0;
        border-radius: 999px;
        background: var(--to-ink, #3A2F22);
        color: #fff;
        padding: 14px 20px;
        font-family: var(--to-font-body, inherit);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.02em;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        transition: background .15s, transform .1s;
    }
    .wc_sidebar .to-filter-drawer__apply:hover { background: #2b2218; }
    .wc_sidebar .to-filter-drawer__apply:active { transform: scale(0.98); }
    .wc_sidebar .to-filter-drawer__apply-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 24px;
        height: 22px;
        padding: 0 8px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.18);
        font-size: 12px;
        font-weight: 700;
    }
}

@media (max-width: 1024px) {
    /* Show the FAB only when a sidebar exists on the page */
    .to-filter-trigger { display: inline-flex; }
}
