/* ============================================
   ADVANCED PRODUCT FILTERING SYSTEM
   ============================================ */

/* Filter Sidebar Container */
.product-filters-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.product-filters-sidebar::-webkit-scrollbar {
    width: 6px;
}

.product-filters-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.product-filters-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.product-filters-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Filter Header */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.filter-title {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-title i {
    color: #e74c3c;
}

.clear-all-btn {
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-all-btn:hover {
    background: #e74c3c;
    color: #fff;
    transform: translateY(-2px);
}

.clear-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Individual Filter Section */
.filter-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.filter-section-title i {
    font-size: 12px;
    color: #7f8c8d;
    transition: transform 0.3s ease;
}

.filter-section-title.collapsed i {
    transform: rotate(-90deg);
}

.filter-section-content {
    max-height: 300px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filter-section-content.collapsed {
    max-height: 0;
}

/* Price Range Filter */
.price-range-container {
    padding: 20px 10px;
}

.price-range-slider {
    margin: 25px 0;
}

.price-range-values {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.price-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.price-input-group label {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 600;
}

.price-input-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.price-input-group input:focus {
    outline: none;
    border-color: #e74c3c;
}

/* Range Slider Styling */
.noUi-target {
    background: #ecf0f1;
    border: none;
    box-shadow: none;
    height: 6px;
    border-radius: 10px;
}

.noUi-connect {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.noUi-handle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #e74c3c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

.noUi-handle:active {
    transform: scale(1.2);
}

/* Checkbox Filter Items */
.filter-checkbox-list {
    max-height: 250px;
    overflow-y: auto;
}

.filter-checkbox-list::-webkit-scrollbar {
    width: 4px;
}

.filter-checkbox-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.filter-checkbox-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-checkbox-item:hover {
    padding-left: 5px;
}

.filter-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #e74c3c;
}

.filter-checkbox-item label {
    flex: 1;
    cursor: pointer;
    font-size: 14px;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-checkbox-item .count {
    font-size: 12px;
    color: #95a5a6;
    font-weight: 600;
}

/* Color Filter */
.color-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.color-filter-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.color-filter-item:hover {
    transform: scale(1.1);
}

.color-filter-item.active {
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2c3e50;
}

.color-filter-item.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Active Filters Display */
.active-filters-bar {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
}

.active-filters-bar.has-filters {
    display: block;
}

.active-filters-title {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: #2c3e50;
}

.active-filter-tag i {
    color: #e74c3c;
    cursor: pointer;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.active-filter-tag i:hover {
    transform: scale(1.3);
}

/* Sort & View Options */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.product-count {
    font-size: 14px;
    color: #7f8c8d;
}

.product-count strong {
    color: #2c3e50;
    font-weight: 700;
}

.toolbar-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.sort-dropdown {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    color: #2c3e50;
    cursor: pointer;
    background: #fff;
    transition: all 0.3s ease;
}

.sort-dropdown:hover,
.sort-dropdown:focus {
    border-color: #e74c3c;
    outline: none;
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.view-toggle-btn {
    width: 35px;
    height: 35px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #7f8c8d;
}

.view-toggle-btn:hover,
.view-toggle-btn.active {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

/* Loading State */
.products-loading {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.products-loading.active {
    display: block;
}

.products-loading .spinner {
    border: 4px solid rgba(231, 76, 60, 0.2);
    border-top: 4px solid #e74c3c;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.products-loading p {
    color: #7f8c8d;
    font-size: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results State */
.no-results {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.no-results.active {
    display: block;
}

.no-results i {
    font-size: 64px;
    color: #e0e0e0;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 10px;
}

.no-results p {
    color: #7f8c8d;
    font-size: 15px;
    margin-bottom: 20px;
}

.no-results button {
    padding: 12px 30px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.no-results button:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

/* Mobile Filter Toggle Button */
.mobile-filter-toggle {
    display: none;
    width: 100%;
    padding: 15px 20px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.mobile-filter-toggle i {
    margin-right: 10px;
}

/* Mobile Filter Overlay */
.mobile-filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.mobile-filter-overlay.active {
    display: block;
}

@media (max-width: 991px) {
    .mobile-filter-toggle {
        display: block;
    }
    
    .product-filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        border-radius: 0;
    }
    
    .product-filters-sidebar.mobile-open {
        left: 0;
    }
    
    .products-toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .toolbar-controls {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 576px) {
    .filter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .active-filters-list {
        flex-direction: column;
    }
    
    .active-filter-tag {
        width: 100%;
        justify-content: space-between;
    }
    
    .color-filter-item {
        width: 35px;
        height: 35px;
    }
    
    .view-toggle {
        display: none;
    }
}
