/* ============================================
   MRLV Product Filters — Styles
   ============================================ */

.mrlv-filters-wrapper {
    width: 100%;
    margin-bottom: 24px;
}

/* Barre de filtres */
.mrlv-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Groupe de filtre */
.mrlv-filter-group {
    position: relative;
}

/* Bouton toggle dropdown */
.mrlv-filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mrlv-filter-toggle:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.mrlv-filter-toggle.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.mrlv-filter-toggle svg {
    transition: transform 0.2s ease;
}

.mrlv-filter-group.open .mrlv-filter-toggle svg {
    transform: rotate(180deg);
}

/* Dropdown */
.mrlv-filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 8px;
    z-index: 100;
}

.mrlv-filter-group.open .mrlv-filter-dropdown {
    display: block;
    animation: mrlvDropIn 0.15s ease-out;
}

@keyframes mrlvDropIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Options checkbox */
.mrlv-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 14px;
    color: #374151;
}

.mrlv-filter-option:hover {
    background: #f9fafb;
}

.mrlv-filter-option input[type="checkbox"] {
    display: none;
}

/* Custom checkbox */
.mrlv-checkmark {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.15s ease;
    position: relative;
    background: #fff;
}

.mrlv-filter-option input:checked + .mrlv-checkmark {
    background: #3b82f6;
    border-color: #3b82f6;
}

.mrlv-filter-option input:checked + .mrlv-checkmark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mrlv-filter-label {
    flex: 1;
}

.mrlv-filter-count {
    font-size: 12px;
    color: #9ca3af;
}

/* Bouton réinitialiser */
.mrlv-filters-reset {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.mrlv-filters-reset:hover {
    background: #fef2f2;
}

/* Tags filtres actifs */
.mrlv-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.mrlv-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    font-size: 13px;
    color: #1d4ed8;
    font-weight: 500;
}

.mrlv-active-tag button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #1d4ed8;
    padding: 0;
    line-height: 1;
}

.mrlv-active-tag button:hover {
    color: #dc2626;
}

/* Loader */
.mrlv-loading-overlay {
    position: relative;
    min-height: 200px;
}

.mrlv-loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mrlv-loading-overlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: mrlvSpin 0.6s linear infinite;
    z-index: 11;
}

@keyframes mrlvSpin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Message aucun résultat */
.mrlv-no-results {
    text-align: center;
    padding: 48px 20px;
    color: #6b7280;
    font-size: 15px;
}

/* Compteur résultats */
.mrlv-results-count {
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
}

/* ============================================
   Responsive Mobile
   ============================================ */
@media (max-width: 768px) {
    .mrlv-filters-bar {
        padding: 12px;
        gap: 8px;
    }

    .mrlv-filter-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Overlay fond sombre */
    .mrlv-mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99998;
    }

    .mrlv-mobile-overlay.active {
        display: block;
    }

    /* Bottom sheet dropdown */
    .mrlv-filter-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        max-height: 70vh;
        border-radius: 20px 20px 0 0;
        padding: 0;
        z-index: 99999;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
        overflow: hidden;
    }

    .mrlv-filter-group.open .mrlv-filter-dropdown {
        animation: mrlvSlideUp 0.25s ease-out;
    }

    @keyframes mrlvSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Header du bottom sheet */
    .mrlv-dropdown-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 18px;
        border-bottom: 1px solid #e5e7eb;
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .mrlv-dropdown-title {
        font-size: 16px;
        font-weight: 700;
        color: #111827;
    }

    .mrlv-dropdown-close {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        border: 1px solid #e5e7eb;
        background: #f9fafb;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.15s;
    }

    .mrlv-dropdown-close:hover {
        background: #f3f4f6;
    }

    .mrlv-dropdown-close svg {
        width: 16px;
        height: 16px;
        stroke: #374151;
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
    }

    /* Options dans le bottom sheet */
    .mrlv-dropdown-options {
        padding: 12px 18px 24px;
        overflow-y: auto;
        max-height: calc(70vh - 60px);
        -webkit-overflow-scrolling: touch;
    }

    .mrlv-filter-option {
        padding: 14px 12px;
        font-size: 15px;
    }

    .mrlv-checkmark {
        width: 22px;
        height: 22px;
        min-width: 22px;
    }

    .mrlv-filter-count {
        font-size: 13px;
    }

    .mrlv-filters-reset {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .mrlv-active-filters {
        margin-top: 8px;
    }
}

/* Desktop : cacher les éléments mobile-only */
@media (min-width: 769px) {
    .mrlv-mobile-overlay {
        display: none !important;
    }

    .mrlv-dropdown-header {
        display: none !important;
    }

    .mrlv-dropdown-options {
        padding: 0;
    }
}

