/**
 * Sticky Filters CSS
 * Makes filter sidebar sticky and scrollable
 * Reference: http://tatilimsensin.test/tatilpro/villalar design
 */

/* Filter sidebar container */
.filter-sidebar {
    position: sticky;
    top: 100px; /* Below header */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
}

/* Smooth scrolling */
.filter-sidebar {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

/* Custom scrollbar styling */
.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* Filter sections */
.filter-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

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

/* Filter section title */
.filter-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Filter options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Filter checkbox/radio items */
.filter-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.filter-item:hover {
    background-color: #f3f4f6;
}

.filter-item input[type="checkbox"],
.filter-item input[type="radio"] {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-item input[type="checkbox"]:checked,
.filter-item input[type="radio"]:checked {
    background-color: #0066cc;
    border-color: #0066cc;
}

.filter-item label {
    flex: 1;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.filter-item-count {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Price range filter */
.price-range-filter {
    padding: 1rem 0;
}

.price-range-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
}

.price-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    width: 100%;
}

.price-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Range slider */
.range-slider {
    width: 100%;
    margin: 1rem 0;
}

.range-slider input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #0066cc;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #0066cc;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Filter buttons */
.filter-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.filter-button {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.filter-button-primary {
    background-color: #0066cc;
    color: #ffffff;
    border: none;
}

.filter-button-primary:hover {
    background-color: #0052a3;
}

.filter-button-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.filter-button-secondary:hover {
    background-color: #e5e7eb;
}

/* Mobile responsive */
@media (max-width: 1023px) {
    .filter-sidebar {
        position: relative;
        top: auto;
        max-height: none;
        overflow-y: visible;
        margin-bottom: 2rem;
    }
    
    /* Mobile filter toggle button */
    .mobile-filter-toggle {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 40;
        background-color: #0066cc;
        color: #ffffff;
        padding: 1rem 2rem;
        border-radius: 9999px;
        font-weight: 600;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    /* Mobile filter drawer */
    .filter-sidebar.mobile-drawer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #ffffff;
        z-index: 50;
        padding: 1rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .filter-sidebar.mobile-drawer.open {
        transform: translateX(0);
    }
}

/* Ensure layout doesn't shift when filters update */
.filter-sidebar * {
    box-sizing: border-box;
}

/* Color standardization - Villa page reference */
.filter-section {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
}

.filter-section-title {
    color: #1f2937;
}

.filter-item label {
    color: #4b5563;
}

.filter-item:hover label {
    color: #1f2937;
}

/* Active filter indicator */
.filter-item.active {
    background-color: #eff6ff;
    border-left: 3px solid #0066cc;
}

.filter-item.active label {
    color: #0066cc;
    font-weight: 600;
}
