/* 
 * filters.css - Filtering and Sorting UI 
 * (Tasks 41-50)
 */

/* Task 47: Sticky Sidebar */
.filter-sidebar {
    position: sticky;
    top: 90px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.filter-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.filter-group h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Task 41: Dual handle price range (Styling input[type=range] is complex, we use a custom approach) */
.range-slider-container {
    padding: 0 10px;
}
.range-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: var(--border-color);
    outline: none;
    border-radius: 2px;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

/* Task 42 & 43: Checkboxes and Toggle switches */
.checkbox-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
}
.checkbox-item input {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: var(--primary);
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Task 46: Active filter badges */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.filter-badge {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.filter-badge .clear-btn {
    cursor: pointer;
    font-weight: bold;
    border: none;
    background: none;
    color: var(--primary);
}

/* Task 44: Sort-by dropdown */
.sort-dropdown {
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

/* Task 45: Transition animations (Isotope style) */
.results-grid {
    transition: all 0.5s ease;
}
.result-card {
    animation: fadeIn 0.4s ease forwards;
}

/* Task 48 & 50: Mobile Filter Drawer */
.mobile-filter-btn {
    display: none;
}

@media (max-width: 992px) {
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 300px;
        z-index: 1001;
        overflow-y: auto;
        border-radius: 0;
        transition: left 0.3s ease;
    }
    .filter-sidebar.open {
        left: 0;
    }
    .mobile-filter-btn {
        display: inline-block;
        margin-bottom: 1rem;
    }
}
