/* ============================================
   Request List Filters Component
   ============================================ */

/* Filter Container */
.filters-container {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 16px;
    margin-bottom: 2rem;
}

/* Filter Header */
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.filters-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-title i {
    color: #667eea;
}

/* Filter Group */
.filter-group {
    margin-bottom: 12px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group-title i {
    font-size: 1rem;
    color: #667eea;
}

/* Filter Row */
.filter-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-row:last-child {
    margin-bottom: 0;
}

/* Full width filter row - for search field */
.filter-row.filter-row-full {
    display: block;
    width: 100%;
}

.filter-row.filter-row-full .filter-field {
    width: 100%;
    max-width: 100%;
}

.filter-row.filter-row-full .filter-field .form-control {
    width: 100%;
}

/* Filter Field */
.filter-field {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.filter-field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.filter-field label i {
    font-size: 0.75rem;
    color: #6c757d;
}

.filter-field .form-control,
.filter-field .form-select {
    font-size: 0.875rem;
    border-color: #dee2e6;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

.filter-field .form-control:focus,
.filter-field .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.filter-field-help {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Primary Filters - Always visible */
.filters-primary {
    display: block;
}

/* Secondary Filters - Hidden by default, collapsible */
.filters-secondary {
    display: none;
    margin-top: 1rem;
    animation: slideDown 0.3s ease forwards;
}

.filters-secondary.show {
    display: block;
}

/* Toggle Advanced Filters Button */
.filters-toggle {
    margin-top: 1rem;
    text-align: center;
}

.toggle-advanced-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.toggle-advanced-filters:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.toggle-advanced-filters i {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.toggle-advanced-filters[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Slide down animation for secondary filters */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }
    to {
        opacity: 1;
        max-height: 2000px;
        overflow: visible;
    }
}

/* Active Filters Section */
.active-filters {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    display: none;
}

.active-filters.has-filters {
    display: block;
}

.active-filters-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.active-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Filter Chip */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: #495057;
    transition: all 0.15s ease;
}

.filter-chip:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.filter-chip-label {
    font-weight: 500;
    color: #6c757d;
}

.filter-chip-value {
    color: #212529;
}

.filter-chip-remove {
    background: none;
    border: none;
    color: #6c757d;
    padding: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s ease;
}

.filter-chip-remove:hover {
    color: #dc3545;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.filter-actions-primary {
    display: flex;
    gap: 0.75rem;
    flex: 1;
}

.filter-actions-secondary {
    display: flex;
    gap: 0.75rem;
}

/* Results Count */
.results-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.results-count-number {
    font-weight: 700;
    color: #667eea;
    font-size: 1.125rem;
}

/* Loading State */
.filter-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.filter-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Breakpoints */

/* Tablet - 768px and below */
@media (max-width: 768px) {
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-actions-primary,
    .filter-actions-secondary {
        flex-direction: column;
    }
    
    .filter-actions-primary .btn,
    .filter-actions-secondary .btn {
        width: 100%;
    }
    
    .results-count {
        justify-content: center;
    }
}

/* Mobile - 576px and below */
@media (max-width: 576px) {
    .filters-container {
        padding: 1rem;
    }
    
    .filters-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .filter-group-title {
        font-size: 0.8125rem;
    }
    
    .active-filters-chips {
        flex-direction: column;
    }
    
    .filter-chip {
        width: 100%;
        justify-content: space-between;
    }
}

/* Large Desktop - 1200px and above */
@media (min-width: 1200px) {
    .filter-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Print Styles */
@media print {
    .filters-container {
        display: none;
    }
}

/* Accessibility Enhancements */
.filter-field label:focus-within,
.filter-chip:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .filters-container {
        border: 2px solid #000;
    }
    
    .filter-chip {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .filter-field .form-control,
    .filter-field .form-select,
    .toggle-advanced-filters i,
    .filter-chip {
        transition: none;
    }
    
    .filter-loading::after {
        animation: none;
    }
}
