/* ========== FILTER INPUT STYLES - SHARED ACROSS ALL PAGES ========== */
/* Unified filter input design for consistent UI across the application */

/* ========== CSS Variables for Filters ========== */
:root {
    --filter-input-width: 180px;
    --filter-spacing: 0.75rem;
    --filter-input-padding: 0.3125rem 0.5rem;
    --filter-input-font-size: 0.8125rem;
    --filter-label-font-size: 0.8125rem;
}

/* ========== Base Filter Input Styles ========== */
.filter-input,
.filter-select,
input[type="text"].filter-input,
input[type="number"].filter-input,
input[type="search"].filter-input,
select.filter-input,
select.filter-select {
    /* Layout */
    width: var(--filter-input-width);
    padding: var(--filter-input-padding);
    box-sizing: border-box;

    /* Typography */
    font-size: var(--filter-input-font-size);
    font-family: inherit;
    line-height: 1.5;

    /* Appearance - Dark Theme */
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);

    /* Behavior */
    transition: border-color 0.15s ease-in-out,
                box-shadow 0.15s ease-in-out,
                background-color 0.15s ease-in-out;
}

/* ========== Placeholder Styling ========== */
.filter-input::placeholder,
input.filter-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ========== Hover States ========== */
.filter-input:hover:not(:focus),
.filter-select:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========== Focus States ========== */
.filter-input:focus,
.filter-select:focus,
input[type="text"].filter-input:focus,
input[type="number"].filter-input:focus,
input[type="search"].filter-input:focus,
select.filter-input:focus,
select.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ========== Light Theme Overrides ========== */
.theme-light .filter-input,
.theme-light .filter-select,
[data-theme="light"] .filter-input,
[data-theme="light"] .filter-select,
.theme-light input[type="text"].filter-input,
.theme-light input[type="number"].filter-input,
.theme-light input[type="search"].filter-input,
.theme-light select.filter-input,
.theme-light select.filter-select,
[data-theme="light"] input[type="text"].filter-input,
[data-theme="light"] input[type="number"].filter-input,
[data-theme="light"] input[type="search"].filter-input,
[data-theme="light"] select.filter-input,
[data-theme="light"] select.filter-select {
    background: white;
    border: 1px solid #dee2e6;
    color: #212529;
}

/* Light theme placeholder */
.theme-light .filter-input::placeholder,
.theme-light input.filter-input::placeholder,
[data-theme="light"] .filter-input::placeholder,
[data-theme="light"] input.filter-input::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

/* Light theme hover */
.theme-light .filter-input:hover:not(:focus),
.theme-light .filter-select:hover:not(:focus),
[data-theme="light"] .filter-input:hover:not(:focus),
[data-theme="light"] .filter-select:hover:not(:focus) {
    border-color: #adb5bd;
}

/* Light theme focus - CRITICAL: Keep background white! */
.theme-light .filter-input:focus,
.theme-light .filter-select:focus,
[data-theme="light"] .filter-input:focus,
[data-theme="light"] .filter-select:focus,
.theme-light input[type="text"].filter-input:focus,
.theme-light input[type="number"].filter-input:focus,
.theme-light input[type="search"].filter-input:focus,
.theme-light select.filter-input:focus,
.theme-light select.filter-select:focus,
[data-theme="light"] input[type="text"].filter-input:focus,
[data-theme="light"] input[type="number"].filter-input:focus,
[data-theme="light"] input[type="search"].filter-input:focus,
[data-theme="light"] select.filter-input:focus,
[data-theme="light"] select.filter-select:focus {
    background: white !important; /* Stay white on focus in light mode */
    border-color: #1976D2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* ========== Select Dropdown Styling ========== */
select.filter-input,
select.filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2rem;
}

/* Dark theme select arrow */
select.filter-input,
select.filter-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

/* Light theme select arrow - only for filter selects */
.theme-light select.filter-input,
.theme-light select.filter-select,
[data-theme="light"] select.filter-input,
[data-theme="light"] select.filter-select {
    background-color: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

/* Light theme select on focus - maintain white background and arrow */
.theme-light select.filter-input:focus,
.theme-light select.filter-select:focus,
[data-theme="light"] select.filter-input:focus,
[data-theme="light"] select.filter-select:focus {
    background-color: white !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

/* ========== Filter Label Styles ========== */
.filter-label {
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    font-size: var(--filter-label-font-size);
}

.theme-light .filter-label,
[data-theme="light"] .filter-label {
    color: #495057;
}

/* ========== Filter Container Styles ========== */
.modern-filters {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.theme-light .modern-filters,
[data-theme="light"] .modern-filters {
    background: white;
    border: 1px solid #dee2e6;
}

/* ========== Filter Grid Layout ========== */
.filter-grid {
    display: grid;
    gap: var(--filter-spacing);
    align-items: center;
    justify-content: start;
}

/* ========== Disabled State ========== */
.filter-input:disabled,
.filter-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

.theme-light .filter-input:disabled,
.theme-light .filter-select:disabled,
[data-theme="light"] .filter-input:disabled,
[data-theme="light"] .filter-select:disabled {
    background: #f8f9fa;
}

/* ========== Responsive Overrides ========== */
@media (max-width: 768px) {
    .filter-input,
    .filter-select {
        width: 100% !important;
        max-width: none !important;
    }

    .filter-label {
        text-align: left !important;
    }
}

/* ========== Special Cases ========== */
/* Provider input that spans multiple columns */
.provider-input.filter-input {
    width: 100%;
}

/* Date picker inputs */
.blazor-datepicker-container .filter-input,
.date-picker-wrapper .filter-input {
    width: 100%;
}

/* ========== Utility Classes ========== */
.filter-input-sm {
    width: 120px;
}

.filter-input-md {
    width: var(--filter-input-width);
}

.filter-input-lg {
    width: 240px;
}

.filter-input-full {
    width: 100%;
}