/* ===================================
   Filter Sidebar Styles
   =================================== */

/* Main Layout */
.page-wrapper {
    display: flex;
    gap: 20px;
    position: relative;
}

/* Filter Sidebar */
.filter-sidebar {
    width: 320px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 24px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    position: sticky;
    top: 100px;
    transition: all 0.3s ease;
}

.filter-sidebar.collapsed {
    display: none;
}

.filter-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e3e6f0;
}

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

.filter-sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #858796;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.filter-sidebar-close:hover {
    color: #e74a3b;
}

/* Filter Toggle Button (Mobile) */
.filter-toggle-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.filter-toggle-btn i {
    margin-right: 8px;
}

.filter-toggle-btn .badge {
    background: #e74a3b;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.75rem;
    margin-left: 6px;
}

/* Main Content Area */
.main-content-area {
    flex: 1;
    min-width: 0;
}

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

.filter-group-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #5a5c69;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.filter-group-title .filter-title-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group-title i {
    color: #4e73df;
    font-size: 0.9rem;
}

/* Collapsible Filter Groups */
.filter-group.collapsible .filter-group-title {
    cursor: pointer;
    padding: 10px 12px;
    margin-bottom: 0;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.filter-group.collapsible .filter-group-title:hover {
    background-color: #f8f9fc;
}

.filter-group.collapsible .filter-group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-top: 0;
}

.filter-group.collapsible.expanded .filter-group-content {
    max-height: 1000px;
    padding-top: 12px;
    transition: max-height 0.3s ease-in;
}

/* Toggle Icon */
.toggle-icon {
    font-size: 0.8rem;
    color: #858796;
    transition: transform 0.3s ease;
}

.filter-group.collapsible.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Always expanded filters (Nationality, Country of Birth) */
.filter-group.expanded .filter-group-content {
    max-height: none;
    padding-top: 12px;
}

/* Filter Options */
.filter-option {
    margin-bottom: 8px;
}

.filter-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    color: #5a5c69;
}

.filter-option label:hover {
    background-color: #f8f9fc;
}

.filter-option input[type="radio"],
.filter-option input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #4e73df;
}

/* Searchable Select Filter */
.searchable-select {
    position: relative;
}

.searchable-select-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d3e2;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #5a5c69;
    background-color: #fff;
    transition: all 0.2s;
    cursor: pointer;
}

.searchable-select-input:focus {
    outline: none;
    border-color: #4e73df;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.1);
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #d1d3e2;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.searchable-select-dropdown.active {
    display: block;
}

.searchable-select-search {
    padding: 8px;
    border-bottom: 1px solid #e3e6f0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.searchable-select-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d3e2;
    border-radius: 6px;
    font-size: 0.85rem;
}

.searchable-select-options {
    padding: 4px;
}

.searchable-select-option {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #5a5c69;
    transition: background-color 0.2s;
}

.searchable-select-option:hover {
    background-color: #f8f9fc;
}

.searchable-select-option.selected {
    background-color: #4e73df;
    color: white;
}

.searchable-select-option.no-results {
    text-align: center;
    color: #858796;
    cursor: default;
}

.searchable-select-option.no-results:hover {
    background-color: transparent;
}

/* Selected Filters Display */
.selected-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fc;
    border-radius: 8px;
    min-height: 44px;
}

.selected-filters:empty::before {
    content: 'No filters selected';
    color: #858796;
    font-size: 0.85rem;
    font-style: italic;
}

.selected-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.selected-filter-tag .remove-filter {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.selected-filter-tag .remove-filter:hover {
    opacity: 1;
}

/* Filter Actions - Hidden since auto-apply is enabled */
.filter-actions {
    display: none;
}

/* Counselor Filter - Searchable Dropdown in Sidebar */
/* Uses same styles as other searchable-select filters */
.searchable-select[data-filter-id="counselor"] .searchable-select-option i {
    color: #4e73df;
}

.searchable-select[data-filter-id="counselor"] .searchable-select-option.selected i {
    color: white;
}

/* Active Filter Count Badge */
.active-filters-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: #e74a3b;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0 6px;
    margin-left: 8px;
}

/* Scrollbar Styling */
.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: #d1d3e2;
    border-radius: 10px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: #858796;
}

.searchable-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
    background: #d1d3e2;
    border-radius: 10px;
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablet View */
@media (max-width: 992px) {
    .filter-sidebar {
        width: 280px;
        padding: 20px;
    }
    
    .page-wrapper {
        gap: 15px;
    }
}

/* Mobile View */
@media (max-width: 768px) {
    .page-wrapper {
        flex-direction: column;
    }
    
    /* Filter Sidebar as Overlay on Mobile */
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 400px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        border-radius: 0;
        box-shadow: none;
        transition: transform 0.3s ease;
    }
    
    .filter-sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }
    
    .filter-sidebar-close {
        display: block;
    }
    
    /* Show toggle button on mobile */
    .filter-toggle-btn {
        display: flex;
        align-items: center;
    }
    
    /* Main content takes full width */
    .main-content-area {
        width: 100%;
    }
    
    /* Backdrop overlay */
    .filter-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }
    
    .filter-backdrop.active {
        display: block;
    }
}

/* Very Small Mobile */
@media (max-width: 576px) {
    .filter-sidebar {
        max-width: 100%;
    }
    
    .filter-toggle-btn {
        bottom: 15px;
        right: 15px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .selected-filters {
        flex-direction: column;
        gap: 6px;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .filter-actions .btn {
        width: 100%;
    }
}

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

.filter-loading {
    text-align: center;
    padding: 40px 20px;
    color: #858796;
}

.filter-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #4e73df;
}

/* Empty State */
.filter-empty {
    text-align: center;
    padding: 20px;
    color: #858796;
    font-size: 0.9rem;
}

/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.filter-group {
    animation: slideIn 0.3s ease;
}

