/**
 * XCO Smart Filters - Styles
 * Version: 1.0.0
 */

/* ========================================
   CSS Variables & Base Styles
   ======================================== */
:root {
    --xco-primary: #E97730;
    --xco-primary-dark: #D56620;
    --xco-primary-light: #F59B5A;
    --xco-secondary: #00A0DC;
    --xco-secondary-dark: #0088BE;
    --xco-text: #333333;
    --xco-text-light: #666666;
    --xco-border: #E0E0E0;
    --xco-bg: #FFFFFF;
    --xco-bg-light: #F8F9FA;
    --xco-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --xco-radius: 6px;
    --xco-transition: all 0.2s ease;
}

/* ========================================
   Filter Wrapper
   ======================================== */
.xco-filters-wrapper {
    position: relative;
    font-family: inherit;
    max-width: 100%;
}

.xco-filters-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ========================================
   Filter Groups
   ======================================== */
.xco-filter-group {
    background: var(--xco-bg);
    border-radius: var(--xco-radius);
    overflow: visible;
    position: relative;
}

/* Stacking order - higher filters get higher z-index by default */
.xco-filter-category { z-index: 50; position: relative; }
.xco-filter-brand { z-index: 40; position: relative; }
.xco-filter-price { z-index: 30; position: relative; }
.xco-filter-colour { z-index: 20; position: relative; }
.xco-filter-sku { z-index: 10; position: relative; }

/* When a dropdown is open, boost its z-index */
.xco-filter-group.dropdown-open {
    z-index: 1000 !important;
}

.xco-filter-header {
    background: var(--xco-primary);
    color: #FFFFFF;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xco-filter-price .xco-filter-header {
    background: #FFB347;
    color: var(--xco-text);
}

.xco-filter-colour .xco-filter-header {
    background: var(--xco-secondary);
    color: #FFFFFF;
}

.xco-filter-sku .xco-filter-header {
    background: var(--xco-secondary);
    color: #FFFFFF;
}

.xco-filter-content {
    padding: 16px;
    background: var(--xco-bg);
    border: 1px solid var(--xco-border);
    border-top: none;
    border-radius: 0 0 var(--xco-radius) var(--xco-radius);
    overflow: visible;
    position: relative;
}

/* ========================================
   Select Inputs (Multi-select)
   ======================================== */
.xco-select {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--xco-border);
    border-radius: var(--xco-radius);
    background: var(--xco-bg);
    font-size: 14px;
    color: var(--xco-text);
    cursor: pointer;
    transition: var(--xco-transition);
}

.xco-select:hover {
    border-color: var(--xco-primary);
}

.xco-select:focus {
    outline: none;
    border-color: var(--xco-primary);
    box-shadow: 0 0 0 3px rgba(233, 119, 48, 0.15);
}

.xco-select option {
    padding: 8px;
}

.xco-select option:checked {
    background: var(--xco-primary);
    color: #FFFFFF;
}

/* ========================================
   Custom Dropdown with Checkboxes
   ======================================== */
.xco-dropdown {
    position: relative;
    width: 100%;
}

.xco-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--xco-bg);
    border: 1px solid var(--xco-border);
    border-radius: var(--xco-radius);
    cursor: pointer;
    transition: var(--xco-transition);
    user-select: none;
}

.xco-dropdown-trigger:hover {
    border-color: var(--xco-primary);
}

.xco-dropdown.open .xco-dropdown-trigger {
    border-color: var(--xco-primary);
    box-shadow: 0 0 0 3px rgba(233, 119, 48, 0.15);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.xco-dropdown-placeholder {
    color: var(--xco-text-light);
    font-size: 14px;
}

.xco-dropdown-trigger.has-selection .xco-dropdown-placeholder {
    color: var(--xco-text);
}

.xco-dropdown-arrow {
    font-size: 10px;
    color: var(--xco-text-light);
    transition: var(--xco-transition);
}

.xco-dropdown.open .xco-dropdown-arrow {
    transform: rotate(180deg);
}

.xco-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--xco-bg);
    border: 1px solid var(--xco-primary);
    border-top: none;
    border-radius: 0 0 var(--xco-radius) var(--xco-radius);
    max-height: 280px;
    overflow: hidden;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.xco-dropdown.open .xco-dropdown-menu {
    display: block;
}

.xco-dropdown-search {
    padding: 10px;
    border-bottom: 1px solid var(--xco-border);
}

.xco-dropdown-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--xco-border);
    border-radius: var(--xco-radius);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.xco-dropdown-search-input:focus {
    border-color: var(--xco-primary);
}

.xco-dropdown-options {
    max-height: 220px;
    overflow-y: auto;
    padding: 6px 0;
}

.xco-dropdown-option {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--xco-transition);
    margin: 0;
    font-weight: normal;
}

.xco-dropdown-option:hover {
    background: var(--xco-bg-light);
}

.xco-dropdown-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.xco-checkbox-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--xco-border);
    border-radius: 4px;
    margin-right: 10px;
    transition: var(--xco-transition);
    background: var(--xco-bg);
}

.xco-dropdown-option:hover .xco-checkbox-custom {
    border-color: var(--xco-primary);
}

.xco-dropdown-option input[type="checkbox"]:checked + .xco-checkbox-custom {
    background: var(--xco-primary);
    border-color: var(--xco-primary);
}

.xco-dropdown-option input[type="checkbox"]:checked + .xco-checkbox-custom::after {
    content: '✓';
    color: #FFFFFF;
    font-size: 12px;
    font-weight: bold;
}

.xco-option-label {
    flex: 1;
    font-size: 14px;
    color: var(--xco-text);
}

.xco-option-count {
    font-size: 12px;
    color: var(--xco-text-light);
    margin-left: 8px;
}

/* Selected Tags */
.xco-selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.xco-selected-tags:empty {
    display: none;
}

.xco-selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--xco-primary);
    color: #FFFFFF;
    border-radius: 4px;
    font-size: 12px;
    animation: xco-fade-in 0.2s ease;
}

.xco-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: var(--xco-transition);
}

.xco-tag-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Hidden option (for search) */
.xco-dropdown-option.hidden {
    display: none;
}

/* No options message */
.xco-no-options {
    color: var(--xco-text-light);
    font-size: 14px;
    padding: 10px 0;
    text-align: center;
    margin: 0;
}

/* ========================================
   Text Input (SKU Search)
   ======================================== */
.xco-text-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--xco-border);
    border-radius: var(--xco-radius);
    font-size: 14px;
    color: var(--xco-text);
    transition: var(--xco-transition);
    box-sizing: border-box;
}

.xco-text-input:hover {
    border-color: var(--xco-primary);
}

.xco-text-input:focus {
    outline: none;
    border-color: var(--xco-primary);
    box-shadow: 0 0 0 3px rgba(233, 119, 48, 0.15);
}

.xco-text-input::placeholder {
    color: var(--xco-text-light);
}

/* ========================================
   Price Slider
   ======================================== */
.xco-price-slider-wrapper {
    padding: 8px 0;
}

.xco-price-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.xco-price-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--xco-border);
    border-radius: var(--xco-radius);
    font-size: 14px;
    text-align: center;
    color: var(--xco-text);
    transition: var(--xco-transition);
    -moz-appearance: textfield;
}

.xco-price-input::-webkit-outer-spin-button,
.xco-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.xco-price-input:focus {
    outline: none;
    border-color: var(--xco-primary);
    box-shadow: 0 0 0 3px rgba(233, 119, 48, 0.15);
}

.xco-price-separator {
    color: var(--xco-text-light);
    font-weight: 500;
}

/* Range Slider */
.xco-range-slider {
    position: relative;
    height: 8px;
    margin: 20px 0;
    background: var(--xco-bg-light);
    border-radius: 4px;
}

.xco-range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 8px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.xco-range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--xco-primary);
    cursor: pointer;
    pointer-events: all;
    border: 3px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: var(--xco-transition);
}

.xco-range-slider input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--xco-primary-dark);
    transform: scale(1.1);
}

.xco-range-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--xco-primary);
    cursor: pointer;
    pointer-events: all;
    border: 3px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.xco-range-slider-track {
    position: absolute;
    height: 8px;
    background: var(--xco-primary);
    border-radius: 4px;
}

.xco-price-display {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--xco-text);
    padding: 8px 0;
}

/* ========================================
   Reset Button
   ======================================== */
.xco-filter-actions {
    margin-top: 8px;
}

.xco-reset-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--xco-secondary);
    color: #FFFFFF;
    border: none;
    border-radius: var(--xco-radius);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--xco-transition);
}

.xco-reset-btn:hover {
    background: var(--xco-secondary-dark);
}

.xco-reset-btn:active {
    transform: translateY(1px);
}

/* ========================================
   Loading Overlay
   ======================================== */
.xco-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.xco-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--xco-bg-light);
    border-top-color: var(--xco-primary);
    border-radius: 50%;
    animation: xco-spin 0.8s linear infinite;
}

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

/* Loop Grid Loading State */
.xco-loading .e-loop-item,
.xco-loading .elementor-loop-container > *,
.xco-loading .xco-product-card {
    opacity: 0.5;
    pointer-events: none;
}

.xco-loop-loading {
    position: relative;
}

.xco-loop-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border: 4px solid var(--xco-bg-light);
    border-top-color: var(--xco-primary);
    border-radius: 50%;
    animation: xco-spin 0.8s linear infinite;
}

/* ========================================
   Results Count
   ======================================== */
.xco-results-count,
.xco-results-count-standalone {
    padding: 12px 16px;
    margin-top: 16px;
    background: var(--xco-bg-light);
    border-radius: var(--xco-radius);
    font-size: 14px;
    color: var(--xco-text-light);
    text-align: center;
}

.xco-results-count strong,
.xco-results-count-standalone strong {
    color: var(--xco-text);
}

/* ========================================
   Active Filters
   ======================================== */
.xco-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.xco-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--xco-primary);
    color: #FFFFFF;
    border-radius: 20px;
    font-size: 13px;
}

.xco-active-filter-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--xco-transition);
    border: none;
    padding: 0;
    color: #FFFFFF;
    font-size: 14px;
    line-height: 1;
}

.xco-active-filter-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   No Results
   ======================================== */
.xco-no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--xco-text-light);
}

.xco-no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.xco-no-results-text {
    font-size: 16px;
    margin-bottom: 16px;
}

.xco-no-results-btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--xco-primary);
    color: #FFFFFF;
    border-radius: var(--xco-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--xco-transition);
}

.xco-no-results-btn:hover {
    background: var(--xco-primary-dark);
    color: #FFFFFF;
}

/* ========================================
   XCO Shop - Combined Filter + Grid Layout
   ======================================== */
.xco-shop-wrapper {
    display: grid !important;
    grid-template-columns: 280px 1fr !important;
    gap: 30px !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative;
}

.xco-shop-wrapper * {
    box-sizing: border-box;
}

.xco-shop-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    width: 100%;
}

/* More compact filter groups */
.xco-shop-sidebar .xco-filter-group {
    margin-bottom: 6px;
}

.xco-shop-sidebar .xco-filter-header {
    padding: 6px 10px;
    font-size: 12px;
}

.xco-shop-sidebar .xco-filter-content {
    padding: 8px 10px;
}

.xco-shop-sidebar .xco-dropdown-trigger {
    padding: 6px 10px;
    font-size: 13px;
}

.xco-shop-sidebar .xco-price-inputs {
    gap: 6px;
}

.xco-shop-sidebar .xco-price-input {
    padding: 5px 6px;
    font-size: 12px;
}

.xco-shop-sidebar .xco-price-display {
    font-size: 12px;
    margin-top: 6px;
}

.xco-shop-sidebar .xco-text-input {
    padding: 6px 10px;
    font-size: 13px;
}

.xco-shop-sidebar .xco-filter-actions {
    margin-top: 10px;
}

.xco-shop-sidebar .xco-reset-btn {
    padding: 8px 14px;
    font-size: 13px;
}

.xco-current-category {
    margin-bottom: 10px;
}

.xco-current-category h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--xco-text);
    margin: 0 0 6px 0;
}

.xco-shop-main {
    position: relative;
    min-height: 400px;
    width: 100%;
}

.xco-shop-header {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--xco-border);
    overflow-x: auto;
}

.xco-results-count {
    background: #f5f5f5;
    padding: 8px 16px;
    border-radius: var(--xco-radius);
    font-size: 14px;
    color: var(--xco-text);
    border: 1px solid #e0e0e0;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Active Filters Display */
.xco-active-filters {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.xco-active-filters:empty {
    display: none;
}

.xco-active-filter-tag {
    display: inline-flex;
    align-items: center;
    background: #fff5ed;
    color: var(--xco-primary);
    padding: 8px 12px;
    border-radius: var(--xco-radius);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--xco-primary);
    white-space: nowrap;
}

.xco-active-filter-tag .xco-filter-value {
    font-weight: 500;
}

.xco-active-filter-tag .xco-remove-filter {
    margin-left: 8px;
    cursor: pointer;
    opacity: 0.7;
    font-size: 16px;
    line-height: 1;
    font-weight: bold;
}

.xco-active-filter-tag .xco-remove-filter:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .xco-shop-header {
        flex-wrap: wrap;
    }
    
    .xco-results-count {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .xco-active-filter-tag {
        padding: 6px 10px;
        font-size: 13px;
    }
}

.xco-product-grid {
    display: grid !important;
    gap: 24px !important;
    width: 100% !important;
}

.xco-product-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr) !important;
}

.xco-product-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr) !important;
}

.xco-product-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr) !important;
}

.xco-product-grid[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr) !important;
}

.xco-product-grid:not([data-columns]) {
    grid-template-columns: repeat(3, 1fr) !important;
}

.xco-shop-pagination {
    margin-top: 30px;
}

/* Shop loading state */
.xco-shop-main.xco-loading .xco-product-grid {
    opacity: 0.5;
    pointer-events: none;
}

.xco-shop-main .xco-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* ========================================
   Mobile Elements - HIDDEN on Desktop
   ======================================== */
.xco-mobile-filter-toggle,
.xco-mobile-overlay,
.xco-sidebar-close,
.xco-mobile-apply-filters {
    display: none !important;
}

/* ========================================
   Desktop Responsive (stays as sidebar)
   ======================================== */
@media (max-width: 1024px) {
    .xco-shop-wrapper {
        grid-template-columns: 250px 1fr !important;
        gap: 20px !important;
    }
    
    .xco-product-grid[data-columns="4"],
    .xco-product-grid[data-columns="5"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ========================================
   Mobile - Slide Out Panel
   ======================================== */
@media (max-width: 768px) {
    /* Change to single column layout */
    .xco-shop-wrapper {
        display: block !important;
    }
    
    /* Show mobile filter toggle button */
    .xco-mobile-filter-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 100%;
        background: var(--xco-primary);
        color: white;
        border: none;
        padding: 12px 20px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        margin-bottom: 15px;
        border-radius: var(--xco-radius);
    }
    
    .xco-mobile-filter-toggle:hover {
        background: var(--xco-primary-dark);
    }
    
    .xco-mobile-filter-toggle .xco-filter-icon {
        margin-right: 8px;
    }
    
    /* Overlay behind panel */
    .xco-mobile-overlay {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .xco-mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Hide sidebar by default on mobile */
    .xco-shop-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 90% !important;
        max-width: 350px !important;
        height: 100vh !important;
        max-height: 100vh !important;
        background: white !important;
        z-index: 9999 !important;
        padding: 60px 15px 80px 15px !important;
        overflow-y: auto !important;
        transition: left 0.3s ease !important;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Show sidebar when open */
    .xco-shop-sidebar.open {
        left: 0 !important;
    }
    
    /* Show close button on mobile */
    .xco-sidebar-close {
        display: block !important;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 28px;
        cursor: pointer;
        color: var(--xco-text);
        padding: 5px 10px;
        z-index: 10;
        line-height: 1;
    }
    
    .xco-sidebar-close:hover {
        color: var(--xco-primary);
    }
    
    /* Show apply button at bottom of mobile sidebar */
    .xco-mobile-apply-filters {
        display: block !important;
        background: var(--xco-secondary);
        color: white;
        border: none;
        padding: 15px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        width: 100%;
        margin-top: 15px;
        border-radius: var(--xco-radius);
    }
    
    .xco-mobile-apply-filters:hover {
        background: var(--xco-secondary-dark);
    }
    
    /* Product grid - 2 columns on mobile */
    .xco-shop-main {
        width: 100%;
    }
    
    .xco-product-grid,
    .xco-product-grid[data-columns="3"],
    .xco-product-grid[data-columns="4"],
    .xco-product-grid[data-columns="5"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .xco-product-grid,
    .xco-product-grid[data-columns="2"],
    .xco-product-grid[data-columns="3"],
    .xco-product-grid[data-columns="4"],
    .xco-product-grid[data-columns="5"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

/* ========================================
   Filtered Results Container
   ======================================== */
.xco-filtered-results {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 20px 0;
}

.xco-filtered-results.xco-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Hide class - use !important to override any Elementor styles */
.xco-hidden-by-filter {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

@media (max-width: 1024px) {
    .xco-filtered-results {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .xco-filtered-results {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .xco-filtered-results {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ========================================
   Fallback Product Cards
   ======================================== */
.xco-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
}

.xco-product-card {
    background: var(--xco-bg);
    border-radius: var(--xco-radius);
    overflow: hidden;
    box-shadow: var(--xco-shadow);
    transition: var(--xco-transition);
    text-align: center;
}

.xco-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.xco-product-card a {
    text-decoration: none;
    color: inherit;
}

.xco-product-image {
    position: relative;
    padding-top: 100%;
    overflow: hidden;
}

.xco-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--xco-transition);
}

.xco-product-card:hover .xco-product-image img {
    transform: scale(1.05);
}

.xco-product-title {
    padding: 12px 12px 6px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--xco-text);
    line-height: 1.4;
    text-align: center;
}

.xco-product-price {
    padding: 0 12px 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--xco-primary);
    text-align: center;
}

.xco-product-price del {
    color: var(--xco-text-light);
    font-size: 12px;
    font-weight: 400;
    margin-right: 6px;
}

.xco-product-price ins {
    text-decoration: none;
}

/* ========================================
   Pagination
   ======================================== */
.xco-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    flex-wrap: wrap;
}

/* Hide Elementor pagination when our filters are active */
.xco-filters-active .elementor-pagination,
.xco-filters-active .e-load-more-anchor,
.xco-filters-active nav.woocommerce-pagination,
.xco-filters-active .elementor-loader-wrapper {
    display: none !important;
}

/* Also hide Elementor's loading overlay when we're controlling the filter */
.xco-loop-loading .elementor-loader-wrapper,
.xco-loading .elementor-loader-wrapper {
    display: none !important;
}

/* Prevent Elementor from showing its content while we have filtered content */
.elementor-widget-loop-grid-disabled .elementor-loader-wrapper {
    display: none !important;
}

/* Make sure our filtered content stays visible */
[data-xco-filtered="true"] {
    visibility: visible !important;
    opacity: 1 !important;
}

.xco-pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    background: var(--xco-bg);
    border: 1px solid var(--xco-border);
    border-radius: var(--xco-radius);
    color: var(--xco-text);
    cursor: pointer;
    transition: var(--xco-transition);
    font-size: 14px;
    font-weight: 500;
}

.xco-pagination-btn:hover:not(:disabled):not(.active) {
    border-color: var(--xco-primary);
    color: var(--xco-primary);
}

.xco-pagination-btn.active {
    background: var(--xco-primary);
    border-color: var(--xco-primary);
    color: #FFFFFF;
}

.xco-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.xco-pagination-ellipsis {
    padding: 0 4px;
    color: var(--xco-text-light);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .xco-filter-header {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .xco-filter-content {
        padding: 12px;
    }
    
    .xco-price-inputs {
        flex-direction: column;
        gap: 8px;
    }
    
    .xco-price-separator {
        display: none;
    }
    
    .xco-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .xco-product-title {
        font-size: 13px;
        padding: 12px 12px 6px;
    }
    
    .xco-product-price {
        font-size: 14px;
        padding: 0 12px 12px;
    }
}

@media (max-width: 480px) {
    .xco-products-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Enhanced Multi-Select Styling
   ======================================== */
.xco-select-wrapper {
    position: relative;
}

.xco-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--xco-bg);
    border: 1px solid var(--xco-border);
    border-top: none;
    border-radius: 0 0 var(--xco-radius) var(--xco-radius);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.xco-select-wrapper.open .xco-select-dropdown {
    display: block;
}

.xco-select-option {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--xco-transition);
}

.xco-select-option:hover {
    background: var(--xco-bg-light);
}

.xco-select-option.selected {
    background: rgba(233, 119, 48, 0.1);
}

.xco-select-checkbox {
    margin-right: 10px;
    accent-color: var(--xco-primary);
}

.xco-selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.xco-selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--xco-primary);
    color: #FFFFFF;
    border-radius: 4px;
    font-size: 12px;
}

.xco-selected-tag-remove {
    cursor: pointer;
    opacity: 0.7;
    transition: var(--xco-transition);
}

.xco-selected-tag-remove:hover {
    opacity: 1;
}

/* ========================================
   Animations
   ======================================== */
@keyframes xco-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.xco-product-card {
    animation: xco-fade-in 0.3s ease forwards;
}

.xco-product-card:nth-child(1) { animation-delay: 0ms; }
.xco-product-card:nth-child(2) { animation-delay: 50ms; }
.xco-product-card:nth-child(3) { animation-delay: 100ms; }
.xco-product-card:nth-child(4) { animation-delay: 150ms; }
.xco-product-card:nth-child(5) { animation-delay: 200ms; }
.xco-product-card:nth-child(6) { animation-delay: 250ms; }
.xco-product-card:nth-child(7) { animation-delay: 300ms; }
.xco-product-card:nth-child(8) { animation-delay: 350ms; }
