/**
 * La Buchette - Filter Styles
 * CSS grid layout with sidebar (theme-independent)
 */

/* Grid layout: sidebar + main content */
.lb-shop-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
}

/* Sidebar */
.lb-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.lb-filters {
    background: var(--lb-white, #fff);
    border-radius: var(--lb-radius, 6px);
    padding: 20px;
    box-shadow: var(--lb-shadow, 0 2px 8px rgba(0,0,0,0.08));
}

.lb-filters-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--lb-dark, #2C3E50);
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--lb-orange, #E67E22);
}

/* Reset button */
.lb-filters-reset {
    display: block;
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    background: var(--lb-gray-lighter, #ECF0F1);
    border: 1px solid var(--lb-gray-light, #BDC3C7);
    border-radius: var(--lb-radius-sm, 4px);
    color: var(--lb-dark, #2C3E50);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lb-filters-reset:hover {
    background: var(--lb-gray-light, #BDC3C7);
}

/* Filter groups */
.lb-filter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--lb-gray-lighter, #ECF0F1);
}

.lb-filter-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.lb-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--lb-dark, #2C3E50);
    margin: 0 0 10px;
}

/* Checkbox list */
.lb-filter-options {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lb-filter-options li {
    margin-bottom: 6px;
}

.lb-filter-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--lb-dark-light, #34495E);
    transition: color 0.2s ease;
}

.lb-filter-options label:hover {
    color: var(--lb-orange, #E67E22);
}

.lb-filter-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--lb-orange, #E67E22);
    flex-shrink: 0;
}

.lb-filter-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--lb-gray, #7F8C8D);
}

/* Color swatches */
.lb-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.lb-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.lb-swatch input[type="checkbox"] {
    display: none;
}

.lb-swatch-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--lb-gray-light, #BDC3C7);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lb-swatch input:checked + .lb-swatch-circle {
    border-color: var(--lb-orange, #E67E22);
    box-shadow: 0 0 0 2px var(--lb-orange, #E67E22);
}

.lb-swatch:hover .lb-swatch-circle {
    border-color: var(--lb-orange-light, #F39C12);
}

.lb-swatch-name {
    font-size: 11px;
    color: var(--lb-gray, #7F8C8D);
}

/* Price range */
.lb-filter-price .lb-price-display {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--lb-dark, #2C3E50);
    margin-bottom: 12px;
}

.lb-price-slider {
    margin: 0 5px;
}

/* noUiSlider overrides */
.lb-price-slider .noUi-connect {
    background: var(--lb-orange, #E67E22);
}

.lb-price-slider .noUi-handle {
    border-radius: 50%;
    width: 20px !important;
    height: 20px !important;
    right: -10px !important;
    top: -6px !important;
    border: 2px solid var(--lb-orange, #E67E22);
    background: var(--lb-white, #fff);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
}

.lb-price-slider .noUi-handle::before,
.lb-price-slider .noUi-handle::after {
    display: none;
}

.lb-price-slider .noUi-target {
    background: var(--lb-gray-lighter, #ECF0F1);
    border: none;
    box-shadow: none;
    height: 6px;
}

/* Overlay - hidden by default, shown only on mobile/tablet */
.lb-filter-overlay {
    display: none;
}

/* No products message */
.lb-no-products {
    text-align: center;
    padding: 40px 20px;
    color: var(--lb-gray, #7F8C8D);
}

.lb-no-products p {
    font-size: 16px;
    margin-bottom: 15px;
}

/* Results count */
.lb-results-count {
    font-size: 14px;
    color: var(--lb-gray, #7F8C8D);
}

/* Category page title */
.woocommerce-products-header__title.page-title {
    color: #000 !important;
}

/* Filter toggle button - hidden on desktop */
.lb-mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--lb-orange, #E67E22);
    color: var(--lb-white, #fff);
    border: none;
    border-radius: var(--lb-radius, 6px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
}

.lb-mobile-filter-toggle:hover {
    background: var(--lb-orange-dark, #D35400);
}

/* Close button inside popup */
.lb-popup-close {
    display: none;
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid var(--lb-gray-lighter, #ECF0F1) !important;
    font-size: 14px;
    font-weight: 600;
    color: var(--lb-dark, #2C3E50);
    cursor: pointer;
    text-align: right;
}

.lb-popup-close:hover {
    background: transparent !important;
    color: var(--lb-orange, #E67E22);
}

/* Apply button inside popup */
.lb-popup-apply {
    display: none;
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: var(--lb-orange, #E67E22);
    color: var(--lb-white, #fff);
    border: none;
    border-radius: var(--lb-radius, 6px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.lb-popup-apply:hover {
    background: var(--lb-orange-dark, #D35400);
}

/* Mobile + Tablet: popup filter */
@media (max-width: 1200px) {
    .lb-shop-layout {
        display: block;
    }

    .lb-mobile-filter-toggle {
        display: inline-flex;
    }

    .lb-popup-close,
    .lb-popup-apply {
        display: block;
    }

    /* Overlay */
    .lb-filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
    }

    body.lb-filters-active .lb-filter-overlay {
        display: block;
    }

    /* Sidebar as centered popup */
    .lb-sidebar {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        width: 90%;
        max-width: 420px;
        max-height: 85vh;
        background: var(--lb-white, #fff);
        z-index: 9999;
        overflow-y: auto;
        padding: 20px;
        border-radius: var(--lb-radius, 6px);
        box-shadow: 0 10px 40px rgba(0,0,0,0.25);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    }

    .lb-sidebar.lb-mobile-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate(-50%, -50%) scale(1);
    }

    /* Remove the old pseudo-element close button */
    .lb-sidebar.lb-mobile-open::before {
        display: none;
    }
}

/* Category title on mobile */
@media (max-width: 767px) {
    .woocommerce-products-header__title.page-title {
        font-size: 25px !important;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .lb-sidebar {
        width: 95%;
        max-height: 90vh;
        padding: 15px;
    }
}
