/**
 * Styles pour Filtres en Liste Déroulante
 * Mayram Fashion House
 */

 /* === LAYOUT PAGE PRODUITS === */
 .products-layout {
     display: grid;
     grid-template-columns: 320px 1fr;
     gap: 2.5rem;
     align-items: start;
 }

 .products-sidebar {
     grid-column: 1;
 }

 .products-main {
     grid-column: 2;
     min-width: 0;
 }

 .filters-overlay {
     position: fixed;
     inset: 0;
     background: rgba(0, 0, 0, 0.45);
     opacity: 0;
     pointer-events: none;
     transition: opacity 0.25s ease;
     z-index: 999;
 }

 .filters-overlay.active {
     opacity: 1;
     pointer-events: auto;
 }

 .products-sidebar-header {
     display: none;
 }

/* === SIDEBAR FILTRES === */
.products-sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 90px;
    height: fit-content;
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* === SECTIONS DE FILTRES === */
.filter-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.filter-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === CHAMP DE RECHERCHE === */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

/* === LISTES DÉROULANTES === */
.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select:hover {
    border-color: #d4af37;
    background-color: #fefaf0;
}

.filter-select:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Options dans le select */
.filter-select option {
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* === BOUTON RÉINITIALISER === */
.btn-block {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #1a1a1a;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-block:hover {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-block:active {
    transform: translateY(0);
}

/* === BOUTON FILTRES MOBILE === */
.mobile-filters-toggle {
    display: none;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--secondary-color, #d4af37), #b8941f);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mobile-filters-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.4);
}

.mobile-filters-toggle:active {
    transform: translateY(0);
}

.mobile-filters-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.mobile-filters-toggle.active svg {
    transform: rotate(180deg);
}

/* Mode sombre - Bouton toggle */
@media (prefers-color-scheme: dark) {
    .mobile-filters-toggle {
        background: linear-gradient(135deg, #d4af37, #b8941f);
        box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    }
    
    .mobile-filters-toggle:hover {
        box-shadow: 0 6px 16px rgba(212, 175, 55, 0.5);
    }
}

[data-theme="dark"] .mobile-filters-toggle {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

[data-theme="dark"] .mobile-filters-toggle:hover {
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.5);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    /* Afficher le bouton toggle sur mobile */
    .mobile-filters-toggle {
        display: flex;
        grid-column: 1;
        grid-row: 1;
    }
    
    .products-sidebar {
        grid-column: 1;
        grid-row: 2;
        position: fixed;
        top: 80px;
        left: 0;
        bottom: auto;
        height: calc(100dvh - 80px);
        width: min(340px, 88vw);
        margin: 0;
        padding: 1.25rem;
        background: white;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
        border-radius: 0 14px 14px 0;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .products-main {
        grid-column: 1;
        grid-row: 3;
    }
    
    .products-sidebar.active {
        transform: translateX(0);
    }

     body.filters-open {
         overflow: hidden;
     }

     .products-sidebar-header {
         display: flex;
         align-items: center;
         justify-content: space-between;
         padding-bottom: 1rem;
         margin-bottom: 1rem;
         border-bottom: 1px solid #e5e7eb;
     }

     .products-sidebar-title {
         font-weight: 700;
         font-size: 1.05rem;
         color: #1a1a1a;
     }

     .filters-close {
         display: inline-flex;
         align-items: center;
         justify-content: center;
         width: 38px;
         height: 38px;
         border-radius: 10px;
         border: 2px solid #e5e7eb;
         background: #f9fafb;
         cursor: pointer;
         transition: all 0.2s ease;
     }

     .filters-close:hover {
         border-color: #d4af37;
         background: #fefaf0;
     }
    
    .filter-section {
        margin-bottom: 1.25rem;
        padding-bottom: 1.25rem;
        border-bottom: 2px solid #f1f5f9;
    }
    
    .filter-section:last-of-type {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    
    .filter-title {
        font-size: 0.9375rem;
        margin-bottom: 0.75rem;
        font-weight: 700;
        color: #1a1a1a;
    }
    
    .form-input,
    .filter-select {
        font-size: 0.9375rem;
        padding: 0.875rem 1rem;
        border-width: 2px;
        border-radius: 10px;
    }
    
    .filter-select {
        padding-right: 2.5rem;
        background-size: 14px;
    }
    
    /* Mode sombre - Mobile */
    @media (prefers-color-scheme: dark) {
        .filter-select {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23d4af37' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
        }
        
        .filter-select:hover {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
        }
        
        .filter-select:focus {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
        }
    }

    [data-theme="dark"] .filter-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23d4af37' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    }
    
    [data-theme="dark"] .filter-select:hover {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    }
    
    [data-theme="dark"] .filter-select:focus {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    }
    
    .btn-block {
        padding: 1rem 1.5rem;
        font-size: 0.9375rem;
        font-weight: 700;
        border-radius: 10px;
        margin-top: 0.5rem;
    }
    
    /* Améliorer l'espacement général */
    .products-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* === TRI (TOOLBAR) - Styles de base === */
/* Note: Le positionnement est géré par products-fixed-layout.css */
 .products-toolbar {
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 1rem;
 }

 .products-sort {
     display: flex;
     align-items: center;
     gap: 0.75rem;
 }

 .products-sort .sort-select {
     min-width: 220px;
     padding: 0.65rem 2.5rem 0.65rem 1rem;
     border-radius: 10px;
     border: 2px solid #e5e7eb;
     background-color: white;
     background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
     background-repeat: no-repeat;
     background-position: right 0.85rem center;
     background-size: 12px;
     appearance: none;
     -webkit-appearance: none;
     -moz-appearance: none;
     transition: all 0.2s ease;
 }

 @media (max-width: 480px) {
     .products-sort {
         width: 100%;
         justify-content: flex-end;
         flex-wrap: wrap;
     }

     .products-sort .sort-select {
         min-width: 0;
         width: 100%;
     }
 }

 .products-sort .sort-select:hover {
     border-color: #d4af37;
     background-color: #fefaf0;
 }

 .products-sort .sort-select:focus {
     outline: none;
     border-color: #d4af37;
     box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
 }

@media (prefers-color-scheme: dark) {
    .products-sort .sort-select {
        background-color: #0f172a;
        border-color: #475569;
        color: #f1f5f9;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4af37' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    }

    .products-sort .sort-select:hover {
        border-color: #d4af37;
        background-color: rgba(212, 175, 55, 0.12);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f4d03f' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    }

    .products-sort .sort-select:focus {
        border-color: #d4af37;
        box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f4d03f' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    }

    .products-sort .sort-select option {
        background: #0f172a;
        color: #f1f5f9;
    }
}

[data-theme="dark"] .products-sort .sort-select {
    background-color: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4af37' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .products-sort .sort-select:hover {
    border-color: #d4af37;
    background-color: rgba(212, 175, 55, 0.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f4d03f' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .products-sort .sort-select:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f4d03f' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .products-sort .sort-select option {
    background: #0f172a;
    color: #f1f5f9;
}

@media (max-width: 480px) {
    .mobile-filters-toggle {
        padding: 0.875rem;
        font-size: 0.9375rem;
        border-radius: 10px;
    }
    
    .products-sidebar.active {
        padding: 1rem;
        border-radius: 10px;
    }
    
    .filter-section {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .filter-title {
        font-size: 0.875rem;
        margin-bottom: 0.625rem;
    }
    
    .form-input,
    .filter-select {
        font-size: 0.875rem;
        padding: 0.75rem 0.875rem;
    }
    
    .filter-select {
        padding-right: 2.25rem;
        background-size: 12px;
    }
    
    .btn-block {
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* === STYLE ALTERNATIF (GOLD ACCENT) === */
.filter-select:focus option:checked,
.filter-select option:checked {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.05));
    color: #1a1a1a;
    font-weight: 600;
}

/* === ANIMATIONS === */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-section {
    animation: slideIn 0.3s ease;
}

/* === ICÔNES EMOJI === */
.filter-title {
    letter-spacing: 0.01em;
}

/* === MODE SOMBRE === */
@media (prefers-color-scheme: dark) {
    .products-sidebar {
        background: #1e293b;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .filter-section {
        border-bottom-color: #334155;
    }
    
    .filter-title {
        color: #f1f5f9;
    }
    
    .form-input,
    .filter-select {
        background: #0f172a;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .form-input::placeholder {
        color: #94a3b8;
    }
    
    .filter-select {
        background-color: #0f172a;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23d4af37' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 14px;
    }
    
    .filter-select:hover {
        border-color: #d4af37;
        background-color: rgba(212, 175, 55, 0.15);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    }
    
    .filter-select:focus {
        border-color: #d4af37;
        box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    }
    
    .form-input:focus {
        border-color: #d4af37;
        box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    }
    
    .btn-block {
        background: linear-gradient(135deg, #475569, #334155);
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .btn-block:hover {
        background: linear-gradient(135deg, #64748b, #475569);
        border-color: #64748b;
    }
    
    .filter-select option {
        background: #0f172a;
        color: #f1f5f9;
    }
}

/* Styles spécifiques pour [data-theme="dark"] */
[data-theme="dark"] .products-sidebar {
    background: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .filter-section {
    border-bottom-color: #334155;
}

[data-theme="dark"] .filter-title {
    color: #f1f5f9;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .filter-select {
    background: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .form-input::placeholder {
    color: #94a3b8;
}

[data-theme="dark"] .filter-select {
    background-color: #0f172a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23d4af37' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px;
}

[data-theme="dark"] .filter-select:hover {
    border-color: #d4af37;
    background-color: rgba(212, 175, 55, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .filter-select:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23f4d03f' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .form-input:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

[data-theme="dark"] .btn-block {
    background: linear-gradient(135deg, #475569, #334155);
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .btn-block:hover {
    background: linear-gradient(135deg, #64748b, #475569);
    border-color: #64748b;
}

[data-theme="dark"] .filter-select option {
    background: #0f172a;
    color: #f1f5f9;
}

/* Mode sombre - Mobile */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .products-sidebar.active {
        background: #1e293b;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    }
    
    .filter-section {
        border-bottom-color: #334155;
    }
    
    .filter-title {
        color: #f1f5f9;
    }
}

@media (max-width: 768px) {
    [data-theme="dark"] .products-sidebar.active {
        background: #1e293b;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    }
    
    [data-theme="dark"] .filter-section {
        border-bottom-color: #334155;
    }
    
    [data-theme="dark"] .filter-title {
        color: #f1f5f9;
    }
}

@media (max-width: 480px) and (prefers-color-scheme: dark) {
    .products-sidebar.active {
        background: #1e293b;
    }
}

@media (max-width: 480px) {
    [data-theme="dark"] .products-sidebar.active {
        background: #1e293b;
    }
}

/* === LOADING STATE === */
.filter-select.loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait;
}

.filter-select.loading::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 2px solid #d4af37;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}
