/* ============================================
   Filter Bar (Dashboard Controls)
   ============================================ */

/* Main container */
.filter-bar {
    --filter-ctrl-h: 36px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    margin-bottom: var(--spacing-md);
}

/* Horizontal filter row */
.filters-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: visible;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.filters-row::-webkit-scrollbar {
    display: none;
}

/* Search input with icon */
.search-input-wrapper {
    position: relative;
    flex: 1 1 260px;
    min-width: 220px;
}

.search-input-wrapper .filter-control {
    width: 100%;
    padding-left: 2.5rem;
}

.search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    width: 18px;
    height: 18px;
}

/* Base control style - pill shaped inputs */
.filter-control {
    height: var(--filter-ctrl-h, 36px);
    min-width: 180px;
    padding: 0 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #f9fafb;
    color: var(--color-text);
    font-size: 0.875rem;
    font-family: var(--font-family);
    line-height: 1;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-control:hover {
    background: #f3f4f6;
}

.filter-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.1);
    background: #fff;
}

.filter-control::placeholder {
    color: #9ca3af;
}

/* Growing control that takes available space */
.filter-control--grow {
    flex: 1 1 260px;
    min-width: 220px;
}

/* Filter select dropdowns - custom chevron */
.filter-select {
    height: var(--filter-ctrl-h, 36px);
    padding: 0 2.25rem 0 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E") right 0.5rem center/1.25rem no-repeat;
    appearance: none;
    cursor: pointer;
    min-width: 90px;
    color: #374151;
    font-weight: 500;
    line-height: 1;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.1);
}

.filter-select:hover {
    border-color: #9ca3af;
}

/* Icon buttons (for filters panel toggle, etc.) */
.icon-btn,
.filter-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn:hover,
.filter-reset-btn:hover {
    background: #f3f4f6;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Toggle switches */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.toggle-switch input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #e5e7eb;
    position: relative;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.toggle-switch input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.toggle-switch input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    border-color: transparent;
    box-shadow: 0 0 0 2px rgba(70, 6, 43, 0.25);
}

.toggle-switch input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

.toggle-switch input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.2);
}

/* Apply/Primary action button */
.filter-apply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 40px;
    padding: 0 1.5rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(70, 6, 43, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.filter-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(70, 6, 43, 0.28);
    background: linear-gradient(90deg, var(--brand-accent), var(--brand-primary));
}

.filter-apply-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .filter-bar {
        padding: 1rem;
    }

    .filters-row {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .search-input-wrapper {
        flex: 1 1 auto;
        min-width: 0;
    }

    .filter-control--grow {
        flex: 1 1 auto;
    }

    .icon-btn,
    .filter-reset-btn {
        width: 100%;
    }

    .status-toggle {
        width: 100%;
        margin-left: 0;
    }

    .status-toggle__btn {
        flex: 1;
    }
}

/* Legacy support - map old class names */
.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 200px;
}

.filter-bar .btn {
    white-space: nowrap;
}
