/* ============================================================================= 
   STAGGERED MENU - MOBILE ONLY
   Original design: Menu/Close text scroll + hamburger/X icon + glass button
   Light mode: white bg, plum text (var(--color-brown)), pink accent (#fec5e5)
   Dark mode: dark bg (#1a1a1a), white text, purple accent (#5227ff)
   ============================================================================= */

/* Only show on mobile */
.staggered-menu-wrapper {
    display: none;
}

@media (max-width: 1279px) {
    :root {
        --jei-header-action-size: 48px;
        --jei-mobile-header-action-gap: 10px;
        --jei-mobile-header-action-right: calc(max(18px, var(--jei-safe-area-right)) + 16px);
        --jei-mobile-header-action-top: calc(var(--jei-header-top-offset) + ((var(--jei-header-height-current) - var(--jei-header-action-size)) / 2));
    }

    .staggered-menu-wrapper {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10005;
        overflow: hidden;
        pointer-events: none;
    }

    .staggered-menu-wrapper.menu-active {
        pointer-events: auto;
    }

    /* Hide desktop nav on mobile */
    .site-navigation,
    .header-links,
    #dark-mode-toggle {
        display: none !important;
    }

    /* iOS Safe Area - adjust header for Dynamic Island and notch */
    .site-header {
        padding-top: 0 !important;
    }

    /* Mobile menu toggle button - icon-only glass trigger */
    .sm-toggle {
        position: fixed;
        top: var(--jei-mobile-header-action-top);
        right: var(--jei-mobile-header-action-right);
        width: var(--jei-header-action-size);
        height: var(--jei-header-action-size);
        z-index: 10006;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        cursor: pointer;
        line-height: 1;
        pointer-events: auto;
        font-family: var(--font-main, inherit);
        padding: 0;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
        transition: background 0.3s ease, box-shadow 0.3s ease;
        color: var(--color-brown) !important;
        text-decoration: none !important;
        isolation: isolate;
        will-change: auto;
    }

    /* Override any WordPress colors - high specificity with element#id */
    /* No hover states needed - this button is mobile-only */
    button#sm-toggle,
    button#sm-toggle:link,
    button#sm-toggle:visited,
    button#sm-toggle:active,
    button#sm-toggle:focus,
    button.sm-toggle,
    button.sm-toggle:active,
    button.sm-toggle:focus {
        color: var(--color-brown) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        background-color: rgba(255, 255, 255, 0.08) !important;
        background: rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
    }

    /* When menu is active - keep same styling */
    .menu-active button#sm-toggle,
    .menu-active button.sm-toggle {
        background-color: rgba(255, 255, 255, 0.08) !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Dark mode: white text - ALL states */
    /* Dark mode: white text - ALL states */
    html.dark-mode button#sm-toggle,
    html.dark-mode button#sm-toggle:link,
    html.dark-mode button#sm-toggle:visited,
    html.dark-mode button#sm-toggle:active,
    html.dark-mode button#sm-toggle:focus,
    html.dark-mode .menu-active button#sm-toggle {
        color: #ffffff !important;
        background-color: rgba(255, 255, 255, 0.05) !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
    }

    /* Active Menu Button - Lighter to match Filter Button */
    html.dark-mode .menu-active button#sm-toggle {
        background-color: rgba(255, 255, 255, 0.1) !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
    }


    /* Text wrapper with scroll animation */
    .sm-toggle-textWrap {
        position: relative;
        display: inline-block;
        height: 1em;
        overflow: hidden;
        white-space: nowrap;
        min-width: 42px;
    }

    .sm-toggle-textInner {
        display: flex;
        flex-direction: column;
        line-height: 1;
        transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        /* Ensure text color is inherited and stays consistent */
        color: inherit !important;
    }

    .sm-toggle-line {
        display: block;
        height: 1em;
        line-height: 1;
        color: inherit !important;
    }

    /* Scroll text to "Close" when menu is active */
    .menu-active .sm-toggle-textInner {
        transform: translateY(-50%);
    }

    /* Icon container with rotation */
    .sm-icon {
        position: relative;
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
        color: inherit !important;
    }

    .sm-icon-hamburger,
    .sm-icon-close {
        position: absolute;
        width: 100%;
        height: 100%;
        transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        color: inherit !important;
    }

    /* Default: show hamburger, hide X */
    .sm-icon-hamburger {
        opacity: 1;
        transform: rotate(0deg);
    }

    .sm-icon-close {
        opacity: 0;
        transform: rotate(-45deg);
    }

    /* Active: hide hamburger, show X with rotation */
    .menu-active .sm-icon {
        transform: rotate(180deg);
    }

    .menu-active .sm-icon-hamburger {
        opacity: 0;
        transform: rotate(45deg);
    }

    .menu-active .sm-icon-close {
        opacity: 1;
        transform: rotate(0deg);
    }

    /* Pre-layers (animated backgrounds) */
    .sm-prelayers {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        pointer-events: none;
        /* Must be > 10002 (Filter) */
    }

    .sm-prelayer {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: 100%;
        transform: translateX(100%);
        transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Light mode prelayers */
    .sm-prelayer:nth-child(1) {
        background: #fec5e5;
        transition-delay: 0s;
    }

    .sm-prelayer:nth-child(2) {
        background: #ffdce9;
        transition-delay: 0.05s;
    }

    /* Dark mode prelayers */
    html.dark-mode .sm-prelayer:nth-child(1) {
        background: #5227ff;
    }

    html.dark-mode .sm-prelayer:nth-child(2) {
        background: #3a1ab3;
    }

    .menu-active .sm-prelayer {
        transform: translateX(0);
    }

    .menu-active .sm-prelayer:nth-child(1) {
        transition-delay: 0s;
    }

    .menu-active .sm-prelayer:nth-child(2) {
        transition-delay: 0.07s;
    }

    /* Main panel */
    .staggered-menu-panel {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        padding: 6em 2em 2em 2em;
        overflow-y: auto;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        /* Remove explicit Z-Index to inherit Wrapper's 10005 context */
        /* z-index: 9999; */
        transform: translateX(100%);
        transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0s linear 0.65s;
        transition-delay: 0.08s;
    }

    html.dark-mode .staggered-menu-panel {
        background: #1a1a1a;
    }

    .menu-active .staggered-menu-panel {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transition-delay: 0.08s, 0s, 0s;
    }

    /* Panel inner */
    .sm-panel-inner {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }

    /* Menu list */
    .sm-panel-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .sm-panel-itemWrap {
        position: relative;
        overflow: hidden;
        line-height: 1;
    }

    /* Menu items - LARGE text like original React (3.5rem) */
    .sm-panel-item {
        position: relative;
        color: var(--color-brown);
        font-weight: 600;
        font-size: 3.5rem;
        cursor: pointer;
        line-height: 1;
        letter-spacing: -2px;
        text-transform: uppercase;
        transition: color 0.25s ease;
        display: inline-block;
        text-decoration: none;
        padding-right: 1.4em;
        font-family: var(--font-main, inherit);
    }

    html.dark-mode .sm-panel-item {
        color: #ffffff;
    }

    .sm-panel-item:hover {
        color: #fec5e5;
    }

    html.dark-mode .sm-panel-item:hover {
        color: #5227ff;
    }

    .sm-panel-itemLabel {
        display: inline-block;
        transform: translateY(140%) rotate(10deg);
        transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
        transform-origin: 50% 100%;
    }

    .menu-active .sm-panel-itemLabel {
        transform: translateY(0) rotate(0deg);
    }

    .sm-panel-itemWrap:nth-child(1) .sm-panel-itemLabel {
        transition-delay: 0.15s;
    }

    .sm-panel-itemWrap:nth-child(2) .sm-panel-itemLabel {
        transition-delay: 0.25s;
    }

    .sm-panel-itemWrap:nth-child(3) .sm-panel-itemLabel {
        transition-delay: 0.35s;
    }

    .sm-panel-itemWrap:nth-child(4) .sm-panel-itemLabel {
        transition-delay: 0.45s;
    }

    /* Item numbering - positioned close to text like original React */
    .sm-panel-list[data-numbering] {
        counter-reset: smItem;
    }

    .sm-panel-list[data-numbering] .sm-panel-item::after {
        counter-increment: smItem;
        content: counter(smItem, decimal-leading-zero);
        position: absolute;
        top: 0.1em;
        right: 2.8em;
        font-size: 18px;
        font-weight: 400;
        color: #fec5e5;
        letter-spacing: 0;
        pointer-events: none;
        user-select: none;
        opacity: 0;
        transition: opacity 0.6s ease;
        transition-delay: 0.1s;
    }

    html.dark-mode .sm-panel-list[data-numbering] .sm-panel-item::after {
        color: #5227ff;
    }

    .menu-active .sm-panel-list[data-numbering] .sm-panel-item::after {
        /*opacity: 1;*/
    }

    .menu-active .sm-panel-itemWrap:nth-child(1) .sm-panel-item::after {
        transition-delay: 0.25s;
    }

    .menu-active .sm-panel-itemWrap:nth-child(2) .sm-panel-item::after {
        transition-delay: 0.33s;
    }

    .menu-active .sm-panel-itemWrap:nth-child(3) .sm-panel-item::after {
        transition-delay: 0.41s;
    }

    /* Socials section - no transform animation, just fade in */
    .sm-socials {
        margin-top: auto;
        padding-top: 2rem;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        opacity: 0;
        transition: opacity 0.5s ease;
        transition-delay: 0.4s;
    }

    .menu-active .sm-socials {
        opacity: 1;
    }

    .sm-socials-title {
        margin: 0;
        font-size: 1rem;
        font-weight: 500;
        color: #fec5e5;
    }

    html.dark-mode .sm-socials-title {
        color: #5227ff;
    }

    .sm-socials-icons {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .sm-social-icon {
        width: 44px;
        height: 44px;
        background: white;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        position: relative;
    }

    .sm-social-icon:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    }

    .sm-social-icon svg {
        width: 24px;
        height: 24px;
        fill: var(--color-brown);
    }

    .sm-social-icon img[src*="kakobuy-logo.svg"] {
        width: 24px;
        height: 24px;
        opacity: 0;
        filter: none;
    }

    .sm-social-icon[aria-label="KakoBuy"]::after {
        content: '';
        position: absolute;
        width: 24px;
        height: 24px;
        background: var(--color-brown);
        -webkit-mask: url('/wp-content/themes/hello-elementor-child/assets/images/kakobuy-logo.svg') center / contain no-repeat;
        mask: url('/wp-content/themes/hello-elementor-child/assets/images/kakobuy-logo.svg') center / contain no-repeat;
        pointer-events: none;
    }

    /* Refraction border effect */
    .sm-social-icon::before {
        content: '';
        position: absolute;
        inset: -1px;
        border-radius: 12px;
        padding: 1px;
        background: linear-gradient(135deg,
                rgba(255, 255, 255, 0.4) 0%,
                rgba(255, 255, 255, 0.1) 50%,
                rgba(255, 255, 255, 0.4) 100%);
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        pointer-events: none;
        opacity: 0.6;
        transition: opacity 0.3s ease;
    }

    .sm-social-icon:hover::before {
        opacity: 1;
    }

    /* Dark mode */
    html.dark-mode .sm-social-icon {
        background: rgba(255, 255, 255, 0.1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }

    html.dark-mode .sm-social-icon:hover {
        background: rgba(255, 255, 255, 0.15);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    }

    html.dark-mode .sm-social-icon svg {
        fill: #ffffff;
    }

    html.dark-mode .sm-social-icon img[src*="kakobuy-logo.svg"] {
        filter: none;
    }

    html.dark-mode .sm-social-icon[aria-label="KakoBuy"]::after {
        background: #ffffff;
    }

    html.dark-mode .sm-social-icon::before {
        background: linear-gradient(135deg,
                rgba(255, 255, 255, 0.3) 0%,
                rgba(255, 255, 255, 0.05) 50%,
                rgba(255, 255, 255, 0.3) 100%);
    }

    /* Fade effect on hover */
    .sm-socials-icons:hover .sm-social-icon:not(:hover) {
        opacity: 0.5;
    }

    /* Dark mode toggle - Large with morph animation */
    .sm-dark-mode-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px 0;
        border-top: 1px solid rgba(67, 53, 67, 0.2);
        margin-top: 12px;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.5s ease, transform 0.5s ease;
        transition-delay: 0.5s;
    }

    .menu-active .sm-dark-mode-toggle {
        opacity: 1;
        transform: translateY(0);
    }

    html.dark-mode .sm-dark-mode-toggle {
        border-top-color: rgba(255, 255, 255, 0.2);
    }

    #sm-dark-mode-btn {
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        overflow: hidden;
        transition: transform 0.3s ease;
        outline: none;
    }

    #sm-dark-mode-btn:focus,
    #sm-dark-mode-btn:focus-visible {
        outline: none;
    }

    #sm-dark-mode-btn:hover {
        transform: scale(1.15);
    }

    /* Sun and Moon icons with morph animation */
    .sm-icon-sun,
    .sm-icon-moon {
        position: absolute;
        width: 36px;
        height: 36px;
        transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.5s ease;
    }

    /* Light mode: show moon, hide sun */
    html.light-mode .sm-icon-moon {
        opacity: 1;
        transform: rotate(0deg) scale(1);
        color: var(--color-brown);
    }

    html.light-mode .sm-icon-sun {
        opacity: 0;
        transform: rotate(90deg) scale(0.5);
    }

    /* Dark mode: show sun, hide moon */
    html.dark-mode .sm-icon-sun {
        opacity: 1;
        transform: rotate(0deg) scale(1);
        color: #ffffff;
    }

    html.dark-mode .sm-icon-moon {
        opacity: 0;
        transform: rotate(-90deg) scale(0.5);
    }
}


/* Ensure desktop shows normal elements */
@media (min-width: 1280px) {

    .sm-toggle,
    .staggered-menu-panel,
    .sm-prelayers {
        display: none !important;
    }
}

/* ============================================================================= 
   FILTER TOGGLE BUTTON - Finds page only
   Positioned left of menu button, same styling as sm-toggle
   ============================================================================= */

/* Filter toggle button - EXACT same styling as menu toggle */
.filter-toggle {
    position: fixed !important;
    top: var(--jei-mobile-header-action-top) !important;
    right: calc(var(--jei-mobile-header-action-right) + var(--jei-header-action-size) + var(--jei-mobile-header-action-gap)) !important;
    min-height: var(--jei-header-action-size) !important;
    height: var(--jei-header-action-size) !important;
    z-index: 10002 !important;
    display: none;
    /* Hidden by default, shown via media query */
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    /* Same font size as menu button */
    font-size: 16px !important;
    line-height: 1;
    pointer-events: auto;
    font-family: var(--font-main, inherit);
    /* Same padding as menu button */
    padding: 0 16px !important;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    color: var(--text-color) !important;
    text-decoration: none !important;
    isolation: isolate;
    will-change: auto;
}

/* Show filter toggle only when the overlay sidebar mode is active */
@media (max-width: 949px) {

    body.post-type-archive-product .filter-toggle,
    body.tax-product_cat .filter-toggle {
        display: inline-flex;
    }
}

/* Smaller screens - keep same gap, just adjust padding/font */
@media (max-width: 480px) {
    :root {
        --jei-header-action-size: 46px;
        --jei-mobile-header-action-gap: 8px;
        --jei-mobile-header-action-right: calc(max(10px, var(--jei-safe-area-right)) + 8px);
    }

    .filter-toggle {
        padding: 0 14px;
        font-size: 15px;
    }
}

/* Filter icon styling */
.filter-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.filter-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.filter-icon .icon-filter {
    opacity: 1;
}

.filter-icon .icon-close {
    position: absolute;
    opacity: 0;
}

/* When filter is active, show X icon */
body.filter-active .filter-icon .icon-filter {
    opacity: 0;
    transform: rotate(90deg);
}

body.filter-active .filter-icon .icon-close {
    opacity: 1;
}

/* Filter text scroll animation similar to menu button */
.filter-text-wrapper {
    height: 1em;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: inherit;
    line-height: 1;
    font-weight: 600;
}

.filter-text-wrapper span {
    display: block;
    transition: transform 0.3s ease;
}

body.filter-active .filter-text-wrapper span:first-child {
    transform: translateY(-100%);
}

body.filter-active .filter-text-wrapper span:last-child {
    transform: translateY(-100%);
}

/* Dark mode styling */
html.dark-mode .filter-toggle {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

html.dark-mode body.post-type-archive-product .filter-toggle,
html.dark-mode body.tax-product_cat .filter-toggle {
    color: #ffffff !important;
}

/* Explicit Active State for Filter Toggle in Dark Mode to match Menu Active */
html.dark-mode body.filter-active .filter-toggle {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* ============================================================================= 
   FILTER SIDEBAR - Full screen overlay on mobile
   ============================================================================= */

@media (max-width: 949px) {

    /* Sidebar default state - off screen with transform (prevents sticking out) */
    .shop-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        min-height: 100vh !important;
        max-height: none !important;
        z-index: 9998 !important;
        background-color: var(--color-white, #ffffff) !important;
        padding-top: calc(var(--jei-header-frame-bottom) + 35px) !important;
        padding-bottom: calc(60px + var(--jei-safe-area-bottom)) !important;
        padding-left: 25px !important;
        padding-right: 25px !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
        /* Smooth animation matching menu panel */
        transform: translateX(-100%) !important;
        transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.65s !important;
        visibility: hidden !important;
    }

    body.post-type-archive-product .shop-sidebar,
    body.tax-product_cat .shop-sidebar {
        background: transparent !important;
        background-color: transparent !important;
        padding-top: calc(var(--jei-header-frame-bottom) + 18px) !important;
    }

    html.dark-mode body:not(.post-type-archive-product):not(.tax-product_cat) .shop-sidebar {
        background-color: #0a0a0a !important;
    }

    /* When filter is active, slide sidebar in - FORCE left:0 to override plugin */
    body.filter-active .shop-sidebar,
    body.filter-active aside.shop-sidebar,
    body.filter-active #shop-sidebar,
    body.filter-closing .shop-sidebar,
    body.filter-closing aside.shop-sidebar,
    body.filter-closing #shop-sidebar,
    body.post-type-archive-product.filter-active .shop-sidebar,
    body.tax-product_cat.filter-active .shop-sidebar,
    body.post-type-archive-product.filter-closing .shop-sidebar,
    body.tax-product_cat.filter-closing .shop-sidebar {
        transform: translateX(0) !important;
        visibility: visible !important;
        left: 0 !important;
    }

    body.filter-closing .shop-sidebar,
    body.filter-closing aside.shop-sidebar,
    body.filter-closing #shop-sidebar,
    body.post-type-archive-product.filter-closing .shop-sidebar,
    body.tax-product_cat.filter-closing .shop-sidebar {
        transform: translateX(-100%) !important;
    }

    html:not(.dark-mode) body.post-type-archive-product.filter-active .shop-sidebar,
    html:not(.dark-mode) body.tax-product_cat.filter-active .shop-sidebar,
    html:not(.dark-mode) body.post-type-archive-product.filter-closing .shop-sidebar,
    html:not(.dark-mode) body.tax-product_cat.filter-closing .shop-sidebar {
        background:
            radial-gradient(circle at 18% 22%, rgba(254, 197, 229, 0.22), transparent 28%),
            radial-gradient(circle at 76% 30%, rgba(238, 149, 198, 0.14), transparent 24%),
            linear-gradient(180deg, rgba(255, 251, 253, 0.96) 0%, rgba(250, 244, 249, 0.92) 100%) !important;
        background-color: rgba(252, 246, 250, 0.94) !important;
        border-color: rgba(67, 53, 67, 0.1) !important;
        box-shadow:
            0 28px 64px rgba(60, 36, 66, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.88),
            inset 0 0 0 1px rgba(255, 255, 255, 0.44) !important;
        backdrop-filter: blur(34px) saturate(150%) !important;
        -webkit-backdrop-filter: blur(34px) saturate(150%) !important;
    }

    /* FILTER BUTTON - always on top of sidebar */
    .filter-toggle,
    button#filter-toggle {
        position: fixed !important;
        z-index: 10002 !important;
    }

    body.filter-active .filter-toggle,
    body.filter-active button#filter-toggle {
        position: fixed !important;
        z-index: 10015 !important;
    }

    /* Neutralize the plugin's own mobile bottom-sheet so filters render inside our overlay sidebar. */
    body.post-type-archive-product .shop-sidebar .widget_wpc_filters_widget,
    body.post-type-archive-product .shop-sidebar .wpc-filters-main-wrap,
    body.post-type-archive-product .shop-sidebar .wpc-filters-widget-content,
    body.post-type-archive-product .shop-sidebar .wpc-filters-widget-containers-wrapper,
    body.post-type-archive-product .shop-sidebar .wpc-filters-scroll-container,
    body.post-type-archive-product .shop-sidebar .wpc-filters-widget-wrapper,
    body.tax-product_cat .shop-sidebar .widget_wpc_filters_widget,
    body.tax-product_cat .shop-sidebar .wpc-filters-main-wrap,
    body.tax-product_cat .shop-sidebar .wpc-filters-widget-content,
    body.tax-product_cat .shop-sidebar .wpc-filters-widget-containers-wrapper,
    body.tax-product_cat .shop-sidebar .wpc-filters-scroll-container,
    body.tax-product_cat .shop-sidebar .wpc-filters-widget-wrapper {
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        inset: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        display: block !important;
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        overflow: visible !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.post-type-archive-product .shop-sidebar .wpc-widget-close-container,
    body.post-type-archive-product .shop-sidebar .wpc-filters-open-button-container,
    body.post-type-archive-product .shop-sidebar .wpc-filters-widget-controls-container,
    body.post-type-archive-product .shop-sidebar .wpc-filters-overlay,
    body.tax-product_cat .shop-sidebar .wpc-widget-close-container,
    body.tax-product_cat .shop-sidebar .wpc-filters-open-button-container,
    body.tax-product_cat .shop-sidebar .wpc-filters-widget-controls-container,
    body.tax-product_cat .shop-sidebar .wpc-filters-overlay {
        display: none !important;
    }

    body.post-type-archive-product .shop-sidebar .wpc-filters-widget-content,
    body.post-type-archive-product .shop-sidebar .wpc-filters-widget-containers-wrapper,
    body.tax-product_cat .shop-sidebar .wpc-filters-widget-content,
    body.tax-product_cat .shop-sidebar .wpc-filters-widget-containers-wrapper {
        background: transparent !important;
        border-radius: 0 !important;
    }
}

/* ============================================================================= 
   FILTER BUTTON & SIDEBAR FIXES
   ============================================================================= */

/* Hide the FilterEverything plugin's own toggle button - we use our custom one */
@media (max-width: 949px) {

    body.post-type-archive-product .filter-toggle-btn,
    body.tax-product_cat .filter-toggle-btn {
        display: none !important;
    }
}

/* Lower Z-Index hack REMOVED - Controlled by Wrapper Z-Index now */

/* ============================================================================= 
   MOBILE BUTTON ALIGNMENT - FINAL OVERRIDE (must be last for CSS cascade)
   ============================================================================= */

@media (max-width: 767px) {
    :root {
        --jei-mobile-header-action-right: calc(max(12px, var(--jei-safe-area-right)) + 10px);
    }
}

/* Finds mobile controls: filter left, menu furthest right, both inside the header bar */
@media (max-width: 949px) {

    body.post-type-archive-product .sm-toggle,
    body.tax-product_cat .sm-toggle {
        top: var(--jei-mobile-header-action-top) !important;
        right: var(--jei-mobile-header-action-right) !important;
        left: auto !important;
    }

    body.post-type-archive-product .filter-toggle,
    body.tax-product_cat .filter-toggle {
        top: var(--jei-mobile-header-action-top) !important;
        right: calc(var(--jei-mobile-header-action-right) + var(--jei-header-action-size) + var(--jei-mobile-header-action-gap)) !important;
        left: auto !important;
    }
}

button#sm-toggle:focus-visible,
button.sm-toggle:focus-visible,
.filter-toggle:focus-visible,
#sm-dark-mode-btn:focus-visible {
    outline: none !important;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.92),
        0 0 0 6px rgba(79, 64, 95, 0.42) !important;
}

html.dark-mode button#sm-toggle:focus-visible,
html.dark-mode button.sm-toggle:focus-visible,
html.dark-mode .filter-toggle:focus-visible,
html.dark-mode #sm-dark-mode-btn:focus-visible {
    box-shadow:
        0 0 0 3px rgba(10, 10, 10, 0.94),
        0 0 0 6px rgba(82, 39, 255, 0.42) !important;
}


/* ============================================================================= 
   MOBILE GRID TOGGLE BUTTON (HIDDEN FOR NOW)
   ============================================================================= */
.grid-toggle-btn {
    display: none !important;
}

@media (max-width: 479px) {
    body.post-type-archive-product .grid-toggle-btn,
    body.tax-product_cat .grid-toggle-btn {
        display: inline-flex !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 14px !important;
        justify-content: center !important;
        align-items: center !important;
        align-self: start !important;
    }

    body.post-type-archive-product .grid-toggle-btn svg,
    body.tax-product_cat .grid-toggle-btn svg,
    body.post-type-archive-product .grid-toggle-btn .pill-icon,
    body.tax-product_cat .grid-toggle-btn .pill-icon {
        width: 16px !important;
        height: 16px !important;
        margin-left: 0 !important;
    }
}

@media (max-width: 479px) {
    body.post-type-archive-product .grid-toggle-btn,
    body.tax-product_cat .grid-toggle-btn {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
    }
}
