/* ================================================
   NEXAR FILTERS CSS - Sistema Filtri
   ================================================ */

.nexar-filters-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nexar-filters-container h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.results-count {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

/* ================================================
   FILTRI GENERALI
   ================================================ */

.filter-group {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    transition: border-color 0.2s ease;
}

.filter-group:hover {
    border-color: #0070b8;
}

.filter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    font-size: 14px;
}

.filter-type {
    background: #0070b8;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================================
   DROPDOWN FILTERS
   ================================================ */

.dropdown-container {
    position: relative;
}

.dropdown-select {
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    position: relative;
}

.dropdown-select:hover {
    border-color: #0070b8;
}

.dropdown-select::after {
    content: "▼";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #666;
}

.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.dropdown-options.show {
    display: block;
}

.dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.dropdown-option:hover {
    background: #e9ecef;
}

.option-count {
    color: #666;
    font-size: 12px;
    font-weight: 500;
}

/* ================================================
   RANGE FILTERS - DUAL SLIDER [CORRETTO]
   ================================================ */

.range-container {
    background: white;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.range-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
}

.range-input-group label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    min-width: 25px;
    margin: 0;
}

.range-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 13px;
    min-width: 0;
}

.range-input:focus {
    outline: none;
    border-color: #0070b8;
    box-shadow: 0 0 0 2px rgba(0, 112, 184, 0.2);
}

.input-units {
    font-size: 12px;
    color: #666;
    min-width: 20px;
}

.range-separator {
    font-weight: bold;
    color: #666;
    padding: 0 5px;
}

/* ================================================
   DUAL RANGE SLIDER - CORRETTO PER DUE CURSORI
   ================================================ */

.dual-range-container {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    margin: 20px 0;
    /* IMPORTANTE: Per far funzionare il dual slider */
    background: transparent;
}

.range-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
}

.range-progress {
    position: absolute;
    height: 6px;
    background: #0070b8;
    border-radius: 3px;
    top: 0;
    transition: all 0.1s ease;
}

/* CORREZIONE: Slider sovrapposti per dual range */
.range-slider {
    position: absolute;
    width: 100%;
    height: 20px; /* Aumentato per migliore interazione */
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: all;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    /* IMPORTANTE: Per far funzionare entrambi i cursori */
    z-index: 1;
}

.range-slider.range-max {
    z-index: 2; /* Cursore max sopra min per interazione migliore */
}

/* Track styles per webkit */
.range-slider::-webkit-slider-track {
    background: transparent;
    height: 6px;
    border: none;
    outline: none;
    cursor: pointer;
}

.range-slider::-webkit-slider-runnable-track {
    background: transparent;
    height: 6px;
    border: none;
    outline: none;
    cursor: pointer;
}

/* Thumb styles per webkit */
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #0070b8;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    position: relative;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,112,184,0.4);
}

/* Styles per Firefox */
.range-slider::-moz-range-track {
    background: transparent;
    height: 6px;
    border: none;
    outline: none;
    cursor: pointer;
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #0070b8;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    -moz-appearance: none;
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,112,184,0.4);
}

.range-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

.range-bound {
    font-weight: 500;
}

/* ================================================
   SEARCH BUTTON & SUMMARY
   ================================================ */

.search-button-container {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.search-filters-btn {
    background: #0070b8;
    border: none;
    color: white;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: center;
}

.search-filters-btn:hover {
    background: #005a94;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,112,184,0.3);
}

.search-filters-btn:active {
    transform: translateY(0);
}

.search-filters-btn i {
    font-size: 18px;
}

.active-filters-summary {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    min-height: 20px;
    font-size: 13px;
    color: #666;
}

.active-filters-summary small {
    display: block;
    line-height: 1.4;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .range-inputs {
        flex-direction: column;
        gap: 8px;
    }
    
    .range-input-group {
        width: 100%;
    }
    
    .range-separator {
        display: none;
    }
    
    .search-filters-btn {
        width: 100%;
        padding: 15px 20px;
    }
    
    .dual-range-container {
        height: 50px;
        margin: 25px 0;
    }
    
    .range-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .range-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .nexar-filters-container {
        padding: 15px;
    }
    
    .filter-group {
        padding: 12px;
    }
}

/* ================================================
   STATES & ANIMATIONS
   ================================================ */

.filter-group.has-active-filter {
    border-color: #0070b8;
    background: #f0f8ff;
}

.filter-group.has-active-filter .filter-type {
    background: #28a745;
}

.dropdown-options {
    animation: slideDown 0.2s ease-out;
}

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

.search-filters-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.search-filters-btn.loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}