/* Filter Sidebar - Stile Amazon */

/* Layout principale a 2 colonne */
.catalog-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-areas: "sidebar content";
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    margin-top: var(--header-height);
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Sidebar filtri - Altezza compatta */
.filter-sidebar {
    grid-area: sidebar;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    height: fit-content;
    position: sticky;
    top: 100px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.filter-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #232f3e;
}

.filter-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #232f3e;
    margin: 0;
}

.btn-close-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
}

.btn-close-mobile:hover {
    color: #232f3e;
}

/* Sezioni filtri */
.filter-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #232f3e;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-section-items {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Checkbox custom stile Amazon - Layout compatto */
.filter-checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.3rem 0;
    margin: 0;
    transition: background-color 0.2s ease;
}

.filter-checkbox-item:hover {
    background-color: #f8f8f8;
}

.filter-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 0.6rem;
    cursor: pointer;
    accent-color: #ff9900;
    flex-shrink: 0;
}

.filter-label {
    font-size: 0.875rem;
    color: #444;
    user-select: none;
    line-height: 1.3;
}

.filter-checkbox-item:hover .filter-label {
    color: #232f3e;
}

/* Pulsante "Mostra più/meno" */
.btn-show-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.4rem 0.5rem;
    background: none;
    border: none;
    color: #007185;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-show-more:hover {
    color: #c7511f;
    text-decoration: underline;
}

.btn-show-more i {
    font-size: 0.75rem;
    margin-left: 0.3rem;
}

/* Link "Cancella filtri" compatto */
.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
    padding: 0.3rem 0;
    background: none;
    border: none;
    color: #c7511f;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.btn-clear-filters:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.btn-clear-filters i {
    font-size: 0.85rem;
}

/* Area risultati */
.results-area {
    grid-area: content;
    min-width: 0;
}

/* Mobile toggle button - stile Amazon */
.mobile-filter-toggle {
    display: none;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f1111;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(15, 17, 17, 0.15);
}

.mobile-filter-toggle:hover {
    background: #f7f8f8;
    border-color: #ff9900;
}

.mobile-filter-toggle:active {
    background: #ededed;
}

/* Responsive - Layout mobile (≤768px) */
@media (max-width: 768px) {
    /* Layout principale diventa single-column */
    .catalog-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "content";
        gap: 1rem;
        padding: 0.5rem;
    }

    /* Sidebar filtri diventa drawer laterale (nascosta di default) */
    .filter-sidebar {
        grid-area: unset;
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1050;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        border: none;
        border-right: 1px solid #e0e0e0;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
    }

    /* Stato aperto del drawer filtri */
    .filter-sidebar.mobile-visible {
        left: 0;
    }

    .btn-close-mobile {
        display: block;
    }

    .mobile-filter-toggle {
        display: none;
    }

    .results-area {
        grid-column: 1 / -1;
    }

    /* Overlay per chiudere sidebar mobile */
    .filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }

    .filter-overlay.active {
        display: block;
    }
}

/* Tablet - Layout ibrido */
@media (min-width: 769px) and (max-width: 1024px) {
    .catalog-layout {
        grid-template-columns: 220px 1fr;
        gap: 1.5rem;
    }

    .filter-sidebar {
        padding: 1rem;
    }
}

/* Accessibilità */
.filter-checkbox-item input[type="checkbox"]:focus {
    outline: 2px solid #ff9900;
    outline-offset: 2px;
}

/* Scrollbar personalizzata per sidebar */
.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Stili per input filtri aggiuntivi in sidebar */
.filter-section .filtro-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.filter-section .filtro-input:focus {
    outline: none;
    border-color: #ff9900;
}

/* Range prezzi compatto */
.filter-section .price-range {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-section .price-input-small {
    width: 100%;
    padding: 0.4rem;
}

.filter-section .price-separator {
    color: #999;
    font-weight: 600;
}

