/* Advanced Filter Sidebar Styles */

.search-filters {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 80vh;
    overflow-y: auto;
    position: sticky;
    top: 20px;
}

.filter-section {
    margin-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 20px;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.filter-section-toggle {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s;
}

.filter-section-toggle:hover {
    color: #333;
}

.filter-content {
    transition: all 0.3s ease;
}

/* Active Filters */
.active-filters {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.active-filters-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    gap: 6px;
}

.filter-tag .remove-filter {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.filter-tag .remove-filter:hover {
    background: rgba(0,0,0,0.1);
}

/* Form Controls */
.form-check {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.form-check-input {
    margin-right: 8px;
    margin-top: 0;
}

.form-check-label {
    font-size: 14px;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.filter-count {
    color: #666;
    font-size: 12px;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Price Range Slider */
.price-range {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.price-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.price-slider-wrapper {
    margin-top: 15px;
}

.price-slider-track {
    position: relative;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin: 20px 0;
}

.price-slider-range {
    position: absolute;
    height: 100%;
    background: #007bff;
    border-radius: 3px;
    transition: all 0.1s;
}

.price-slider-min,
.price-slider-max {
    position: absolute;
    top: -7px;
    width: 100%;
    height: 20px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.price-slider-min::-webkit-slider-thumb,
.price-slider-max::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.price-slider-min::-moz-range-thumb,
.price-slider-max::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.price-slider-values {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Color Filter */
.color-filter .form-check-label {
    position: relative;
    padding-left: 25px;
}

.color-swatch {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #ddd;
    transition: all 0.2s;
}

.color-filter input:checked + label .color-swatch {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Category Tree */
.category-tree {
    max-height: 200px;
    overflow-y: auto;
}

.category-item {
    margin-bottom: 5px;
}

.category-children {
    margin-left: 20px;
    margin-top: 5px;
}

.category-toggle {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    margin-right: 5px;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.2s;
}

.category-toggle:hover {
    background: #f8f9fa;
    color: #333;
}

/* Size Filter */
.size-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.size-option {
    position: relative;
}

.size-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.size-option label {
    display: block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    min-width: 40px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: white;
}

.size-option input:checked + label {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.size-option label:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.size-option input:checked + label:hover {
    background: #0056b3;
}

/* Rating Filter */
.rating-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rating-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
}

.rating-stars {
    color: #ffc107;
    margin-right: 8px;
}

.rating-stars .far {
    color: #e9ecef;
}

/* Brand Filter */
.brand-filter {
    max-height: 150px;
    overflow-y: auto;
}

.brand-search {
    margin-bottom: 10px;
}

.brand-search input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Filter Actions */
.filter-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.apply-filters {
    flex: 1;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.apply-filters:hover {
    background: #0056b3;
}

.clear-all-filters {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.clear-all-filters:hover {
    background: #545b62;
}

/* Loading States */
.filter-loading {
    opacity: 0.6;
    pointer-events: none;
}

.filter-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-filters {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
        max-height: none;
        overflow-y: auto;
        border-radius: 0;
        border-left: none;
    }
    
    .search-filters.show {
        left: 0;
    }
    
    .filter-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    
    .filter-overlay.show {
        display: block;
    }
    
    .mobile-filter-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        border-bottom: 1px solid #e9ecef;
        margin: -20px -20px 20px -20px;
        background: #f8f9fa;
    }
    
    .mobile-filter-close {
        background: none;
        border: none;
        font-size: 18px;
        color: #666;
        cursor: pointer;
    }
    
    .price-range {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .price-input {
        width: 100%;
    }
    
    .filter-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px 0 0 0;
        margin: 20px -20px -20px -20px;
        border-top: 1px solid #e9ecef;
        padding: 15px 20px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .search-filters {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .filter-section {
        border-color: #4a5568;
    }
    
    .filter-title {
        color: #e2e8f0;
    }
    
    .active-filters {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .filter-tag {
        background: #2b6cb0;
        color: #e2e8f0;
    }
    
    .form-check-label {
        color: #cbd5e0;
    }
    
    .filter-count {
        background: #4a5568;
        color: #cbd5e0;
    }
    
    .price-input {
        background: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .price-slider-track {
        background: #4a5568;
    }
    
    .size-option label {
        background: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .size-option input:checked + label {
        background: #3182ce;
        border-color: #3182ce;
    }
    
    .brand-search input {
        background: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .search-filters {
        border-width: 2px;
    }
    
    .filter-tag {
        border: 1px solid currentColor;
    }
    
    .form-check-input:checked {
        border-width: 2px;
    }
    
    .size-option input:checked + label {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .filter-content,
    .search-filters,
    .filter-tag .remove-filter,
    .apply-filters,
    .clear-all-filters,
    .size-option label,
    .color-swatch,
    .category-toggle {
        transition: none;
    }
    
    .filter-loading::after {
        animation: none;
    }
}