/*
 * Filters Component Styles
 * Responsive filter form layouts following mobile-first approach
 * Breakpoints: mobile (default), sm (640px), md (768px), lg (1024px), xl (1280px)
 */

/* Base filter form styles */
.filter-form {
    display: grid;
    gap: 1rem;
    align-items: end;
}

/* Mobile-first: single column by default */
.filter-form {
    grid-template-columns: 1fr;
}

/* Tablet: 2 columns */
@media (min-width: 640px) {
    .filter-form {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns maximum for maintainability */
@media (min-width: 1024px) {
    .filter-form {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large desktop: optional 4th column for very wide screens */
@media (min-width: 1280px) {
    .filter-form.filter-form-xl {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Filter input groups */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Filter action buttons container */
.filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* On mobile, stack filter actions vertically */
@media (max-width: 639px) {
    .filter-actions {
        flex-direction: column;
    }

    .filter-actions button {
        width: 100%;
    }
}

/* Full-width search input option */
.filter-search-full {
    grid-column: 1 / -1;
}

/* Button group at the end of filter form */
.filter-button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

@media (max-width: 639px) {
    .filter-button-group {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .filter-button-group button {
        flex: 1;
    }
}

/* Span multiple columns for special inputs */
.filter-span-2 {
    grid-column: span 1;
}

@media (min-width: 640px) {
    .filter-span-2 {
        grid-column: span 2;
    }
}

/* Responsive number inputs */
.filter-number-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
}

.filter-number-range input {
    width: 100%;
}

.filter-number-range .separator {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Compact mode for filters with many fields */
.filter-form-compact {
    gap: 0.75rem;
}

.filter-form-compact .filter-group label {
    font-size: 0.8125rem;
}

.filter-form-compact .filter-group input,
.filter-form-compact .filter-group select {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

/* Clear all filters button */
.filter-clear-button {
    color: var(--text-secondary);
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.875rem;
}

.filter-clear-button:hover {
    color: var(--primary-color);
}

/* Active filter indicator */
.filter-active-indicator {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    background-color: var(--primary-color);
    border-radius: 50%;
    margin-left: 0.25rem;
}

/* Filter collapse on mobile */
@media (max-width: 639px) {
    .filter-form.filter-collapsible {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .filter-form.filter-collapsible.expanded {
        max-height: 2000px;
    }
}
