/**
 * Custom Woo Filters Automation – Styles front-end
 * Design e-commerce moderne, compatible Elementor + thèmes standards
 */

/* ─── Conteneur principal ─────────────────────────────────────────────────── */
.cwfa-sidebar-filters {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 24px;
    font-family: inherit;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* ─── Titre sidebar ──────────────────────────────────────────────────────── */
.cwfa-filters-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 20px 0;
    padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Groupes de filtres YITH ─────────────────────────────────────────────── */
.cwfa-sidebar-filters .yith-wcan-filters .yith-wcan-filter {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.cwfa-sidebar-filters .yith-wcan-filters .yith-wcan-filter:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Titre de chaque filtre */
.cwfa-sidebar-filters .yith-wcan-filters .filter-title,
.cwfa-sidebar-filters .yith-wcan-filters h4 {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0 0 12px 0;
}

/* ─── Liste des filtres (checkbox / radio) ────────────────────────────────── */
.cwfa-sidebar-filters .yith-wcan-filters ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cwfa-sidebar-filters .yith-wcan-filters ul li {
    margin: 0;
    padding: 0;
}

.cwfa-sidebar-filters .yith-wcan-filters ul li a,
.cwfa-sidebar-filters .yith-wcan-filters ul li label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    color: #444;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

.cwfa-sidebar-filters .yith-wcan-filters ul li a:hover,
.cwfa-sidebar-filters .yith-wcan-filters ul li label:hover {
    background: #f7f7f7;
    color: #000;
}

/* Item actif / sélectionné */
.cwfa-sidebar-filters .yith-wcan-filters ul li.chosen a,
.cwfa-sidebar-filters .yith-wcan-filters ul li.chosen label,
.cwfa-sidebar-filters .yith-wcan-filters ul li.selected a {
    background: #f0f4ff;
    color: #2563eb;
    font-weight: 600;
}

/* Compteur */
.cwfa-sidebar-filters .yith-wcan-filters .count,
.cwfa-sidebar-filters .yith-wcan-filters .term-count {
    margin-left: auto;
    font-size: 11px;
    color: #999;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 1px 7px;
}

/* ─── Filtre Prix (slider) ───────────────────────────────────────────────── */
.cwfa-sidebar-filters .price_slider_wrapper {
    padding: 8px 4px;
}

.cwfa-sidebar-filters .price_slider {
    margin: 8px 0 16px;
}

/* Track du slider */
.cwfa-sidebar-filters .ui-slider {
    background: #e0e0e0;
    border: none;
    height: 4px;
    border-radius: 2px;
    position: relative;
}

/* Range colorée */
.cwfa-sidebar-filters .ui-slider .ui-slider-range {
    background: #2563eb;
    border-radius: 2px;
}

/* Poignées */
.cwfa-sidebar-filters .ui-slider .ui-slider-handle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #2563eb;
    top: -6px;
    cursor: grab;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.cwfa-sidebar-filters .ui-slider .ui-slider-handle:hover,
.cwfa-sidebar-filters .ui-slider .ui-slider-handle:active {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
    cursor: grabbing;
}

/* Montants prix */
.cwfa-sidebar-filters .price_slider_amount {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333;
}

.cwfa-sidebar-filters .price_slider_amount .from,
.cwfa-sidebar-filters .price_slider_amount .to {
    font-weight: 600;
    color: #2563eb;
}

.cwfa-sidebar-filters .price_slider_amount button.button {
    margin-left: auto;
    padding: 5px 14px;
    font-size: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cwfa-sidebar-filters .price_slider_amount button.button:hover {
    background: #1d4ed8;
}

/* ─── Filtres couleur (swatches) ─────────────────────────────────────────── */
.cwfa-sidebar-filters .yith-wcan-filters .color-swatch-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.cwfa-sidebar-filters .yith-wcan-filters .color-swatch-list li a {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    display: block;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.cwfa-sidebar-filters .yith-wcan-filters .color-swatch-list li a:hover {
    transform: scale(1.15);
    border-color: #2563eb;
    background: transparent;
}

.cwfa-sidebar-filters .yith-wcan-filters .color-swatch-list li.chosen a,
.cwfa-sidebar-filters .yith-wcan-filters .color-swatch-list li.selected a {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
    background: transparent;
}

/* ─── Bouton Reset ───────────────────────────────────────────────────────── */
.cwfa-reset-wrapper {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.cwfa-sidebar-filters .yith-wcan-reset-navigation,
.cwfa-reset-wrapper a {
    display: block;
    text-align: center;
    padding: 9px 16px;
    background: #f5f5f5;
    color: #555;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cwfa-sidebar-filters .yith-wcan-reset-navigation:hover,
.cwfa-reset-wrapper a:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* ─── Notice fallback (sans YITH) ────────────────────────────────────────── */
.cwfa-notice {
    background: #fff8e1;
    border-left: 4px solid #f59e0b;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    color: #78350f;
    margin-bottom: 16px;
}

/* ─── Filtres natifs (fallback) ──────────────────────────────────────────── */
.cwfa-filter-group {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f0f0f0;
}

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

.cwfa-filter-label {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
}

.cwfa-cat-list,
.cwfa-attr-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cwfa-cat-list li a,
.cwfa-attr-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    border-radius: 6px;
    color: #444;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.cwfa-cat-list li a:hover,
.cwfa-attr-list li a:hover {
    background: #f7f7f7;
    color: #000;
}

.cwfa-count {
    font-size: 11px;
    color: #999;
}

/* ─── Loader AJAX ────────────────────────────────────────────────────────── */
.cwfa-sidebar-filters.cwfa-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cwfa-sidebar-filters {
        border-radius: 8px;
        padding: 16px;
    }

    .cwfa-sidebar-filters .yith-wcan-filters .color-swatch-list li a {
        width: 24px;
        height: 24px;
    }
}
