/* Filter Section Styling */
.filter-section {
    position: sticky;
    top: var(--header-height); /* Stick below the fixed header */
    left: 0;
    width: 100%;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem; /* Increased padding */
    z-index: 999; /* Position below header (z-index 1000) */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
    max-height: 80vh; /* Limit height to prevent overflow */
    overflow-y: auto; /* Add scroll if content exceeds max-height */
}

.filter-section.minimized {
    /* Removed transform for simpler height control */
    box-shadow: none;
    border-bottom: none;
    overflow: hidden; /* Hide content when minimized */
    height: 65px; /* Set fixed height for minimized state */
}

.filter-section.minimized #filter-controls {
    display: none;
}

#toggle-filters-btn {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    z-index: 1001; /* Ensure button is above content */
}

.filter-section.minimized #toggle-filters-btn {
    top: 50%; /* Center button vertically */
    transform: translateY(-50%); /* Adjust for button's own height */
    /* Ensure right positioning is maintained */
    right: 1rem;
}


#filter-controls {
    padding-top: 2.5rem; /* Space below the toggle button */
    display: flex; /* Enable flexbox */
    flex-direction: column; /* Stack children vertically */
    align-items: center; /* Center children horizontally */
    /* Add justify-content: center; if vertical centering is also desired and feasible */
}

#filter-controls h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem; /* Add space below text */
    font-size: 1.6rem; /* Slightly larger title */
    color: #FFFFFF; /* Heading Text Color */
    text-align: center;
    border-bottom: 1px solid var(--border-color); /* Subtle border */
}

#filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
    gap: 2rem; /* Increased gap between filter groups */
    align-items: start;
    width: 100%; /* Ensure form takes width within flex container */
    max-width: 1100px; /* Prevent form from becoming too wide */
}

.filter-group {
    margin-bottom: 1rem;
    background-color: var(--surface-color); /* Slightly lighter than theme-background */
    padding: 1rem; /* Padding within group */
    border-radius: var(--border-radius-lg, 8px); /* Rounded corners for group */
    border: 1px solid var(--border-color); /* Subtle border */
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #E0E0E0; /* Main Text Color */
}

.filter-group input[type="text"],
.filter-group input[type="range"],
.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color); /* Subtle border */
    border-radius: var(--border-radius-md, 6px); /* Slightly more rounded corners */
    box-sizing: border-box; /* Include padding and border in element's total width and height */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; /* Smooth transition */
}

.filter-group input[type="text"],
.filter-group select {
     background-color: #264A4A; /* Consistent dark input background */
     color: #E0E0E0; /* Main Text Color */
}

.filter-group input[type="text"]:focus,
.filter-group select:focus {
    border-color: var(--primary-color); /* Aqua for focus */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(93, 156, 156, 0.25); /* Accent color glow on focus */
}


/* Range Slider Specific Styling */
.range-slider {
    display: flex;
    gap: 0.5rem; /* Space between min/max sliders */
    align-items: center;
    margin-bottom: 0.5rem;
}

.range-slider input[type="range"] {
    flex-grow: 1;
    padding: 0; /* Remove default padding for range inputs */
    cursor: pointer;
    /* Consider adding custom track/thumb styles for better cross-browser consistency */
}

.range-values {
    text-align: center;
    font-size: 0.9rem;
    color: #E0E0E0; /* Main Text Color */
}

/* Category Multiselect Styling */
.category-multiselect {
    max-height: 150px; /* Limit height */
    overflow-y: auto; /* Add scrollbar if needed */
    border: 1px solid var(--border-color); /* Subtle border */
    padding: 0.5rem;
    border-radius: var(--border-radius-md, 6px); /* Slightly more rounded corners */
    background-color: #264A4A; /* Consistent dark input background */
}

.category-multiselect label {
    display: block; /* Each checkbox on a new line */
    margin-bottom: 0.3rem;
    font-weight: normal; /* Reset bold from group label */
    cursor: pointer;
    color: var(--theme-text-primary);
}

.category-multiselect input[type="checkbox"] {
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Filter Actions */
.filter-actions {
    grid-column: 1 / -1; /* Span across all columns */
    text-align: right;
    margin-top: 1rem;
}

/* Use existing button styles if available */
/* .btn, .btn-secondary, .btn-warning defined in buttons.css or base styles */

/* Responsive Adjustments (Example) */
@media (max-width: 768px) {
    #filter-form {
        grid-template-columns: 1fr; /* Stack filters vertically on smaller screens */
    }

    .filter-actions {
        text-align: center;
    }

    /* Ensure minimized state height is correct on mobile */
    .filter-section.minimized {
        height: 65px !important; /* Match desktop fixed height */
    }

    /* Ensure button positioning is correct in minimized state on mobile */
    .filter-section.minimized #toggle-filters-btn {
        top: 50% !important;
        transform: translateY(-50%) !important;
        right: 1rem !important; /* Maintain right alignment */
    }

    /* Ensure title color is white on mobile */
    #filter-controls h2 {
        color: #FFFFFF !important; /* Heading Text Color */
    }

     #toggle-filters-btn {
        /* Adjust position if needed for mobile (general case, not minimized) */
        /* Example: top: 0.8rem; right: 0.8rem; */
     }
}