/**
 * Universal Filter Component Styles
 * Modern, responsive design for the universal filter system
 */

/* Main Filter Container */
.universal-filter-component {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.universal-filter-component:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Filter Header */
.filter-header {
    padding: 24px 28px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-title i {
    color: #3498db;
    font-size: 1.2em;
}

.filter-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-actions .btn {
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.filter-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#clear-all-filters {
    background: #ffffff;
    color: #6c757d;
    border-color: #6c757d;
}

#clear-all-filters:hover {
    background: #6c757d;
    color: #ffffff;
}

#save-filter-btn {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
}

#save-filter-btn:hover {
    background: #2980b9;
    border-color: #2980b9;
}

/* Filter Body */
.filter-body {
    padding: 28px;
}

.filter-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f1f3f4;
}

.filter-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.filter-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #34495e;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Quick Filters */
.quick-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-filter {
    background: #ffffff;
    color: #5a6c7d;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-filter:hover {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
    transform: translateY(-1px);
}

.quick-filter.active {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
}

.form-control:focus, .form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
    outline: none;
}

.form-check-input {
    border-radius: 4px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: #3498db;
    border-color: #3498db;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Price Range */
.price-range-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.price-range-container .row {
    margin: 0 -10px;
}

.price-range-container .col-md-6 {
    padding: 0 10px;
}

.price-range-container label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

/* Filter Actions */
.filter-actions-bottom {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 2px solid #f1f3f4;
    text-align: center;
}

#apply-filters {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

#apply-filters:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

#apply-filters:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Favorite Filters */
.favorite-filters {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 24px;
    margin-top: 24px;
}

.favorite-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.favorite-filter-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.apply-saved-filter {
    background: #ffffff;
    color: #5a6c7d;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.apply-saved-filter:hover {
    background: #28a745;
    color: #ffffff;
    border-color: #28a745;
    transform: translateY(-1px);
}

.delete-saved-filter {
    background: #ffffff;
    color: #dc3545;
    border: 2px solid #dc3545;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.delete-saved-filter:hover {
    background: #dc3545;
    color: #ffffff;
    transform: scale(1.1);
}

/* Loading States */
.filter-loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.filter-loading.active {
    display: block;
}

.filter-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Results Container */
.filter-results {
    min-height: 200px;
    transition: opacity 0.3s ease;
}

.filter-results.loading {
    opacity: 0.6;
}

/* Pagination */
.filter-pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.filter-pagination .pagination {
    margin: 0;
}

.filter-pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 2px solid #e9ecef;
    color: #5a6c7d;
    transition: all 0.3s ease;
}

.filter-pagination .page-link:hover {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
}

.filter-pagination .page-item.active .page-link {
    background: #3498db;
    border-color: #3498db;
    color: #ffffff;
}

/* Error States */
.filter-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.filter-error .btn {
    margin-top: 15px;
}

/* Empty State */
.filter-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.filter-empty i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.filter-empty h4 {
    color: #495057;
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .filter-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .filter-actions {
        justify-content: center;
        width: 100%;
    }
    
    .filter-body {
        padding: 20px;
    }
    
    .quick-filters {
        justify-content: center;
    }
    
    .quick-filter {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .price-range-container .row {
        margin: 0;
    }
    
    .price-range-container .col-md-6 {
        padding: 0;
        margin-bottom: 15px;
    }
    
    .price-range-container .col-md-6:last-child {
        margin-bottom: 0;
    }
    
    .favorite-filter-item {
        flex-direction: column;
        width: 100%;
    }
    
    .apply-saved-filter {
        justify-content: center;
        width: 100%;
    }
    
    .delete-saved-filter {
        width: 100%;
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .filter-header {
        padding: 16px;
    }
    
    .filter-title {
        font-size: 1.2rem;
    }
    
    .filter-body {
        padding: 16px;
    }
    
    .quick-filters {
        flex-direction: column;
    }
    
    .quick-filter {
        width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .universal-filter-component {
        background: #2d3748;
        color: #e2e8f0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .filter-header {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-bottom-color: #4a5568;
    }
    
    .filter-title {
        color: #e2e8f0;
    }
    
    .filter-section-title {
        color: #e2e8f0;
    }
    
    .form-control, .form-select {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.25);
    }
    
    .quick-filter {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
    
    .quick-filter:hover {
        background: #3b82f6;
        border-color: #3b82f6;
    }
    
    .filter-section {
        border-bottom-color: #4a5568;
    }
    
    .price-range-container, .favorite-filters {
        background: #374151;
    }
    
    .filter-actions-bottom {
        border-top-color: #4a5568;
    }
}

/* Animation for filter updates */
@keyframes filterUpdate {
    0% {
        opacity: 0.6;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-results.updated {
    animation: filterUpdate 0.3s ease-out;
}

/* Accessibility improvements */
.universal-filter-component *:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .universal-filter-component {
        border: 2px solid #000;
    }
    
    .form-control, .form-select {
        border-width: 2px;
    }
    
    .quick-filter {
        border-width: 2px;
    }
}