/* ==========================================================================
   Krystal Filters — Frontend Styles
   ========================================================================== */

:root {
    --krfl-accent:        #2563eb;
    --krfl-accent-hover:  #1d4ed8;
    --krfl-border:        #e5e7eb;
    --krfl-bg:            #ffffff;
    --krfl-text:          #111827;
    --krfl-muted:         #6b7280;
    --krfl-radius:        6px;
    --krfl-transition:    0.2s ease;
}

/* ---- Widget wrapper ---- */
.krfl-filter-widget {
    position: relative;
    font-size: 14px;
    color: var(--krfl-text);
    contain: layout;
}

/* ---- Active bar / Clear all ---- */
.krfl-active-bar {
    margin-bottom: 12px;
}

.krfl-clear-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid var(--krfl-accent);
    color: var(--krfl-accent);
    border-radius: var(--krfl-radius);
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background var(--krfl-transition), color var(--krfl-transition);
}

.krfl-clear-all:hover,
.krfl-clear-all:focus-visible {
    background: var(--krfl-accent);
    color: #fff;
    outline: none;
}

/* ---- Subcategory navigation (accordion) ---- */
.krfl-subcategories .krfl-subcategories-label {
    display: none;
}

.krfl-subcategories .krfl-subcategory-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.krfl-subcategories--top .krfl-subcategory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.krfl-subcategories--left .krfl-subcategory-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.krfl-subcategory-item {
    margin: 0;
    padding: 0;
}

.krfl-subcategory-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 13px;
    color: var(--krfl-text);
    background: #f3f4f6;
    border-radius: 20px;
    text-decoration: none;
    transition: background var(--krfl-transition), color var(--krfl-transition);
    white-space: nowrap;
}

.krfl-subcategories--left .krfl-subcategory-link {
    border-radius: var(--krfl-radius);
    padding: 7px 10px;
    width: 100%;
    box-sizing: border-box;
}

.krfl-subcategory-link:hover,
.krfl-subcategory-link:focus-visible {
    background: var(--krfl-accent);
    color: #fff;
    outline: none;
}

.krfl-subcategory-link.is-active {
    background: var(--krfl-accent);
    color: #fff;
}

.krfl-subcategory-link.is-active:hover {
    background: var(--krfl-accent-hover);
}

.krfl-subcategory-count {
    font-size: 11px;
    opacity: 0.7;
}

/* ---- Filter section ---- */
.krfl-filter-section {
    border-bottom: 1px solid var(--krfl-border);
    padding: 0;
}

.krfl-filter-section:last-child {
    border-bottom: none;
}

.krfl-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--krfl-text);
    cursor: pointer;
    text-align: left;
}

.krfl-section-header:focus-visible {
    outline: 2px solid var(--krfl-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.krfl-section-arrow {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--krfl-muted);
    border-bottom: 2px solid var(--krfl-muted);
    transform: rotate(45deg);
    transition: transform var(--krfl-transition);
    flex-shrink: 0;
}

.krfl-filter-section.is-collapsed .krfl-section-arrow {
    transform: rotate(-45deg);
}

.krfl-section-body {
    padding-bottom: 12px;
    overflow: hidden;
}

/* ---- Dropdown ---- */
.krfl-display-dropdown {
    padding: 10px 0;
    border-bottom: 1px solid var(--krfl-border);
}

.krfl-display-dropdown:last-child {
    border-bottom: none;
}

.krfl-dropdown-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--krfl-text);
    margin-bottom: 6px;
}

.krfl-dropdown {
    width: 100%;
    padding: 8px 32px 8px 10px;
    font-size: 14px;
    color: var(--krfl-text);
    background: var(--krfl-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--krfl-border);
    border-radius: var(--krfl-radius);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color var(--krfl-transition);
    min-height: 40px;
}

.krfl-dropdown:focus {
    outline: 2px solid var(--krfl-accent);
    outline-offset: 2px;
    border-color: var(--krfl-accent);
}

.krfl-dropdown:hover {
    border-color: var(--krfl-accent);
}

/* ---- Checkboxes ---- */
.krfl-checkboxes {
    list-style: none;
    margin: 0;
    padding: 0;
}

.krfl-checkbox-item {
    margin: 0;
    padding: 2px 0;
}

.krfl-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px 4px;
    border-radius: var(--krfl-radius);
    transition: background var(--krfl-transition);
    min-height: 44px;
}

.krfl-checkbox-label:hover {
    background: #f3f4f6;
}

.krfl-checkbox-label.is-active {
    color: var(--krfl-accent);
    font-weight: 500;
}

.krfl-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.krfl-checkbox-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid var(--krfl-border);
    border-radius: 4px;
    background: #fff;
    transition: border-color var(--krfl-transition), background var(--krfl-transition);
}

.krfl-checkbox:checked + .krfl-checkbox-custom {
    background: var(--krfl-accent);
    border-color: var(--krfl-accent);
}

.krfl-checkbox:checked + .krfl-checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}

.krfl-checkbox:focus-visible + .krfl-checkbox-custom {
    outline: 2px solid var(--krfl-accent);
    outline-offset: 2px;
}

.krfl-term-name {
    flex: 1;
}

.krfl-term-count {
    color: var(--krfl-muted);
    font-size: 12px;
}

.krfl-checkbox-item.krfl-empty {
    opacity: 0.4;
    pointer-events: none;
}

/* ---- Swatches ---- */
.krfl-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.krfl-swatch {
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: 2px solid var(--krfl-border);
    background: #ccc;
    cursor: pointer;
    transition: border-color var(--krfl-transition), transform var(--krfl-transition);
    overflow: hidden;
}

.krfl-swatch:hover,
.krfl-swatch:focus-visible {
    border-color: var(--krfl-accent);
    transform: scale(1.1);
    outline: none;
}

.krfl-swatch.is-active {
    border-color: var(--krfl-accent);
    box-shadow: 0 0 0 2px var(--krfl-accent);
}

.krfl-swatch-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
    opacity: 0;
    transition: opacity var(--krfl-transition);
}

.krfl-swatch.is-active .krfl-swatch-check {
    opacity: 1;
}

/* ---- Loading overlay ---- */
.krfl-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--krfl-transition), visibility var(--krfl-transition);
    border-radius: var(--krfl-radius);
    z-index: 10;
    pointer-events: none;
}

.krfl-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.krfl-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--krfl-border);
    border-top-color: var(--krfl-accent);
    border-radius: 50%;
    animation: krfl-spin 0.7s linear infinite;
    will-change: transform;
}

@keyframes krfl-spin {
    to { transform: rotate(360deg); }
}

/* ---- Product grid loading state ---- */
.krfl-products-loading {
    opacity: 0.4;
    transition: opacity 0.2s ease;
    pointer-events: none;
    overflow-anchor: none;
}

.krfl-products-loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
    overflow-anchor: none;
}

/* ---- Screen reader only ---- */
.krfl-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

/* ==========================================================================
   Mobile — Drawer (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
    .krfl-filter-widget {
        display: none;
    }

    body.krfl-drawer-open .krfl-filter-widget {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        background: var(--krfl-bg);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,.15);
        z-index: 99999;
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 20px 80px;
        overscroll-behavior: contain;
        contain: unset;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        clip: auto !important;
        clip-path: none !important;
        width: auto !important;
        height: auto !important;
        animation: krfl-slide-up 0.25s ease-out;
    }

    @keyframes krfl-slide-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* The widget itself is moved to body when drawer opens — no parent overrides needed */

    /* Drawer handle bar — handled by .krfl-drawer-header now */
    body.krfl-drawer-open .krfl-filter-widget::before {
        display: none;
    }

    body.krfl-drawer-open {
        overflow: hidden;
        padding-right: var(--krfl-scrollbar-width, 0px);
    }

    /* Mobile open button */
    .krfl-mobile-open-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        border: 1px solid var(--krfl-border);
        border-radius: var(--krfl-radius);
        background: var(--krfl-bg);
        font-size: 14px;
        cursor: pointer;
        min-height: 44px;
        margin-bottom: 16px;
    }

    /* Sticky apply button */
    .krfl-mobile-apply {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 20px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        background: var(--krfl-bg);
        border-top: 1px solid var(--krfl-border);
        z-index: 100000;
        display: none;
    }

    body.krfl-drawer-open .krfl-mobile-apply {
        display: block;
    }

    .krfl-mobile-apply-btn {
        display: block;
        width: 100%;
        padding: 14px;
        background: var(--krfl-mobile-btn-bg, var(--krfl-accent));
        color: var(--krfl-mobile-btn-text, #fff);
        border: none;
        border-radius: var(--krfl-radius);
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        min-height: 44px;
    }

    .krfl-mobile-apply-btn:hover {
        background: var(--krfl-accent-hover);
    }

    /* Overlay behind drawer */
    .krfl-mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 99998;
    }

    body.krfl-drawer-open .krfl-mobile-overlay {
        display: block !important;
    }

    /* Mobile touch targets — ensure 44px minimum */
    .krfl-section-header {
        min-height: 48px;
        padding: 14px 0;
    }

    .krfl-swatch {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .krfl-dropdown {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .krfl-subcategory-link {
        padding: 8px 14px;
        font-size: 14px;
    }
}

/* Desktop — hide mobile elements */
@media (min-width: 768px) {
    .krfl-filter-widget {
        display: block !important;
    }

    .krfl-mobile-open-btn,
    .krfl-mobile-apply,
    .krfl-mobile-overlay {
        display: none !important;
    }
}

/* Prevent product grid from narrowing on mobile after AJAX filtering */
@media (max-width: 767px) {
    ul.products,
    .products,
    .woocommerce .products {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* ---- Mobile drawer header (sticky inside drawer) ---- */
.krfl-drawer-header {
    display: none;
    position: sticky;
    top: 0;
    background: var(--krfl-bg);
    border-radius: 16px 16px 0 0;
    z-index: 10;
    padding: 0 20px;
    margin: -8px -20px 0;
}

.krfl-drawer-header.is-visible {
    display: block;
}

.krfl-drawer-handle {
    width: 36px;
    height: 4px;
    background: var(--krfl-border);
    border-radius: 2px;
    margin: 10px auto 0;
}

.krfl-drawer-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 12px;
    border-bottom: 1px solid var(--krfl-border);
}

.krfl-drawer-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--krfl-text);
}

.krfl-drawer-clear-btn {
    font-size: 13px;
    font-weight: 500;
}

.krfl-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--krfl-text);
    transition: background var(--krfl-transition);
    flex-shrink: 0;
}

.krfl-drawer-close:hover {
    background: var(--krfl-border);
}

/* ---- Mobile result count badge ---- */
.krfl-apply-count {
    display: none;
    background: #ff4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    min-width: 24px;
    text-align: center;
}

.krfl-apply-count.is-visible {
    display: inline-block;
}

/* Hide the widget's active bar inside mobile drawer — header handles it */
@media (max-width: 767px) {
    body.krfl-drawer-open .krfl-filter-widget .krfl-active-bar {
        display: none;
    }
}

/* ---- Shoptimizer "Show Filters" button — soft card style ---- */
@media (max-width: 767px) {
    .mobile-filter.shoptimizer-mobile-toggle {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        float: right;
        clear: both;
        width: auto !important;
        margin-bottom: 12px;
        background: #dc9815 !important;
        border: none !important;
        color: #fff !important;
        border-radius: 8px !important;
        padding: 10px 16px !important;
        font-weight: 600 !important;
        font-size: 14px !important;
        line-height: 1 !important;
        box-shadow: 0 2px 6px rgba(220,152,21,0.3);
        cursor: pointer;
        transition: background 0.2s ease;
        position: sticky;
        top: 0;
        z-index: 10;
        white-space: nowrap !important;
        overflow: visible !important;
        text-indent: 0 !important;
        letter-spacing: normal !important;
        text-transform: none !important;
    }

    .mobile-filter.shoptimizer-mobile-toggle svg {
        stroke: #fff !important;
        fill: none !important;
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-self: center !important;
        position: static !important;
        float: none !important;
        vertical-align: middle !important;
        margin-top: 18px !important;
    }

    .mobile-filter.shoptimizer-mobile-toggle:hover,
    .mobile-filter.shoptimizer-mobile-toggle:focus {
        background: #b8800f !important;
        outline: none !important;
    }
}

/* ==========================================================================
   Mobile Layout 2 — Horizontal Chips
   ========================================================================== */
@media (max-width: 767px) {

    /* Hide sidebar widget in chips mode */
    .krfl-filter-widget.krfl-chips-mode {
        display: none !important;
    }

    /* Chips bar */
    .krfl-chips-bar {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 0 10px;
        scrollbar-width: none;
        /* Sticky at top when scrolling */
        position: sticky;
        top: var(--krfl-sticky-top, 0);
        z-index: 50;
        background: var(--krfl-bg);
        margin: 0 0 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,.06);
    }

    .krfl-chips-bar::-webkit-scrollbar {
        display: none;
    }

    /* Clear filters chip — pinned left */
    .krfl-chips-clear {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 7px 14px;
        background: #fff0f0;
        border: 1.5px solid #fca5a5;
        border-radius: 100px;
        font-size: 13px;
        font-weight: 500;
        color: #dc2626;
        white-space: nowrap;
        cursor: pointer;
        flex-shrink: 0;
        transition: background var(--krfl-transition);
        /* Sticky on the left side of the scrollable bar */
        position: sticky;
        left: 0;
        z-index: 2;
        background: #fff0f0;
        box-shadow: 2px 0 6px rgba(255,255,255,0.9);
    }

    .krfl-chips-clear:hover {
        background: #fee2e2;
    }

    /* Individual chip */
    .krfl-chip {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 7px 14px;
        background: #f3f4f6;
        border: 1.5px solid var(--krfl-border);
        border-radius: 100px;
        font-size: 13px;
        font-weight: 500;
        color: var(--krfl-text);
        white-space: nowrap;
        cursor: pointer;
        flex-shrink: 0;
        transition: background var(--krfl-transition), border-color var(--krfl-transition), color var(--krfl-transition);
    }

    .krfl-chip:hover {
        border-color: var(--krfl-accent);
        color: var(--krfl-accent);
    }

    .krfl-chip.is-active {
        background: var(--krfl-accent);
        border-color: var(--krfl-accent);
        color: #fff;
    }

    .krfl-chip.is-active svg {
        stroke: #fff;
    }

    /* Sheet overlay */
    .krfl-chips-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99998;
    }

    .krfl-chips-overlay.is-visible {
        display: block;
    }

    /* Filter sheet */
    .krfl-chips-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--krfl-bg);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,.15);
        z-index: 99999;
        max-height: 60vh;
        overflow-y: auto;
        padding: 0 20px 32px;
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
    }

    .krfl-chips-sheet.is-open {
        transform: translateY(0);
    }

    body.krfl-sheet-open {
        overflow: hidden;
    }

    /* Sheet header */
    .krfl-chips-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 0 12px;
        border-bottom: 1px solid var(--krfl-border);
        position: sticky;
        top: 0;
        background: var(--krfl-bg);
        z-index: 1;
    }

    .krfl-chips-sheet-title {
        font-size: 15px;
        font-weight: 600;
        color: var(--krfl-text);
    }

    .krfl-chips-sheet-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: #f3f4f6;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        color: var(--krfl-text);
    }

    /* Sheet content — reuse existing filter styles */
    .krfl-chips-sheet .krfl-section-body,
    .krfl-chips-sheet .krfl-checkboxes,
    .krfl-chips-sheet .krfl-swatches,
    .krfl-chips-sheet .krfl-dropdown {
        margin-top: 12px;
    }
}

/* Hide theme filter button when Layout 2 (chips) is active */
@media (max-width: 767px) {
    body.krfl-layout-chips .mobile-filter,
    body.krfl-layout-chips .shoptimizer-mobile-toggle,
    body.krfl-layout-chips .show-filters,
    body.krfl-layout-chips .filter-toggle {
        display: none !important;
    }
}

/* ---- Layout 2: Subcategory chips bar ---- */
@media (max-width: 767px) {
    .krfl-subcat-chips-bar {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding: 8px 0 6px;
        scrollbar-width: none;
        position: sticky;
        top: var(--krfl-sticky-top, 0);
        z-index: 49;
        background: var(--krfl-bg);
        margin-bottom: 2px;
    }

    .krfl-subcat-chips-bar::-webkit-scrollbar {
        display: none;
    }

    .krfl-subcat-chips-bar .krfl-subcategory-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .krfl-subcat-chips-bar .krfl-subcategory-link {
        display: inline-flex;
        align-items: center;
        padding: 6px 14px;
        background: #f3f4f6;
        border: 1.5px solid var(--krfl-border);
        border-radius: 100px;
        font-size: 13px;
        font-weight: 500;
        color: var(--krfl-text);
        white-space: nowrap;
        text-decoration: none;
        transition: background var(--krfl-transition), border-color var(--krfl-transition);
    }

    .krfl-subcat-chips-bar .krfl-subcategory-link:hover {
        border-color: var(--krfl-accent);
        color: var(--krfl-accent);
    }

    .krfl-subcat-chips-bar .krfl-subcategory-link.is-active {
        background: var(--krfl-accent);
        border-color: var(--krfl-accent);
        color: #fff;
    }

    /* Chips bar sits below subcat bar */
    .krfl-subcat-chips-bar + .krfl-chips-bar {
        top: calc( var(--krfl-sticky-top, 0px) + 46px );
    }
}

/* ---- Subcategory links inside chips sheet ---- */
@media (max-width: 767px) {
    .krfl-chips-sheet-subcats {
        padding: 12px 0;
    }

    .krfl-chips-sheet-subcats .krfl-subcategory-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .krfl-chips-sheet-subcats .krfl-subcategory-link {
        display: flex;
        align-items: center;
        padding: 12px 8px;
        border-radius: var(--krfl-radius);
        font-size: 15px;
        color: var(--krfl-text);
        text-decoration: none;
        border-bottom: 1px solid var(--krfl-border);
        transition: background var(--krfl-transition);
    }

    .krfl-chips-sheet-subcats .krfl-subcategory-link:last-child {
        border-bottom: none;
    }

    .krfl-chips-sheet-subcats .krfl-subcategory-link:hover {
        background: #f3f4f6;
    }

    .krfl-chips-sheet-subcats .krfl-subcategory-link.is-active {
        color: var(--krfl-accent);
        font-weight: 600;
        background: none;
    }

    .krfl-chips-sheet-subcats .krfl-subcategory-count {
        margin-left: auto;
        font-size: 12px;
        color: var(--krfl-muted);
    }

    /* Hide the separate subcat bar if it was rendered */
    .krfl-subcat-chips-bar {
        display: none !important;
    }
}

/* ---- Chips sheet checkbox flash animation ---- */
@media (max-width: 767px) {
    .krfl-chips-sheet .krfl-checkbox-custom {
        transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    }

    .krfl-chips-sheet .krfl-checkbox-label.krfl-sheet-flash .krfl-checkbox-custom {
        background: var(--krfl-accent);
        border-color: var(--krfl-accent);
        transform: scale(1.2);
    }

    .krfl-chips-sheet .krfl-checkbox-label.is-active .krfl-checkbox-custom {
        background: var(--krfl-accent);
        border-color: var(--krfl-accent);
    }

    .krfl-chips-sheet .krfl-checkbox-label.is-active .krfl-checkbox-custom::after {
        content: '';
        display: block;
        width: 5px;
        height: 9px;
        border: 2px solid #fff;
        border-top: none;
        border-left: none;
        transform: rotate(45deg) translate(-1px, -1px);
    }

    /* Larger touch targets in sheet */
    .krfl-chips-sheet .krfl-checkbox-label {
        min-height: 52px;
        padding: 8px 4px;
    }

    .krfl-chips-sheet .krfl-swatch {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
}

/* ---- Prevent FOUC on theme filter button ---- */
/* Hide the button until our plugin JS has initialized */
@media (max-width: 767px) {
    .mobile-filter.shoptimizer-mobile-toggle {
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    body.krfl-ready .mobile-filter.shoptimizer-mobile-toggle {
        opacity: 1;
    }
}

