/* Select2 theme for the filter panels. Loaded after lib/select2/select2.min.css. */
.fs-field { min-width: 0; }
.fs-field > label { display: block; }

.fs-field .select2-container--default .select2-selection--single {
    height: 48px;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 12px;
    background: var(--white, #fff);
    transition: border-color .18s, box-shadow .18s;
}

.fs-field .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 45px;
    padding-left: 14px;
    padding-right: 58px;
    font-size: 15px;
    color: var(--ink, #0f172a);
}

.fs-field .select2-container--default .select2-selection--single .select2-selection__placeholder { color: #64748b; }
.fs-field .select2-container--default .select2-selection--single .select2-selection__arrow { height: 45px; right: 8px; }

/* Clear (x): a real tap target, placed left of the arrow */
.fs-field .select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 30px;
    top: 8px;
    width: 30px;
    height: 30px;
    margin: 0;
    line-height: 28px;
    text-align: center;
    font-size: 19px;
    color: #64748b;
    border-radius: 8px;
}

.fs-field .select2-container--default .select2-selection--single .select2-selection__clear:hover { background: #f1f5f9; color: #b91c1c; }

/* A chosen value stands out from "Any" */
.fs-field select.is-set + .select2-container .select2-selection--single,
.fs-field.is-set .select2-container--default .select2-selection--single { border-color: #2563eb; background: #eff6ff; }
.fs-field.is-set .select2-container--default .select2-selection--single .select2-selection__rendered { font-weight: 700; color: #1d4ed8; }

.fs-field .select2-container--default.select2-container--focus .select2-selection--single,
.fs-field .select2-container--default.select2-container--open .select2-selection--single {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

/* Dropdown (rendered at the end of <body>). Its wrapper has no width, so the site-wide
   max-width:100% rule would collapse it. */
.fs-dropdown,
.fs-dropdown .select2-dropdown { max-width: none; }

.fs-dropdown .select2-dropdown {
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
}

.select2-container--open { z-index: 1200; }
.fs-dropdown .select2-search--dropdown { padding: 10px; }

.fs-dropdown .select2-dropdown .select2-search--dropdown .select2-search__field {
    height: 44px;
    padding: 0 12px;
    font-size: 16px; /* below 16px, iOS zooms the page */
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: #0f172a;
}

.fs-dropdown .select2-dropdown .select2-search--dropdown .select2-search__field:focus { border-color: #2563eb; }

.fs-dropdown .select2-results > .select2-results__options {
    max-height: min(320px, 46vh);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.fs-dropdown .select2-results__option { padding: 11px 14px; min-height: 44px; font-size: 15px; line-height: 1.35; display: flex; align-items: center; }
.fs-dropdown .select2-results__option > .fs-option { flex: 1; }

.fs-dropdown .select2-dropdown .select2-results__option[aria-selected=true],
.fs-dropdown .select2-dropdown .select2-results__option--selected { background: #dbeafe; color: #1e3a8a; font-weight: 700; }
.fs-dropdown .select2-dropdown .select2-results__option--highlighted[aria-selected] { background: #2563eb; color: #fff; }

.fs-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.fs-option__text { min-width: 0; overflow-wrap: anywhere; }
.fs-option__text small { display: block; font-size: 12.5px; font-weight: 400; opacity: .75; }
.fs-option__count { flex: 0 0 auto; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(100, 116, 139, .16); }

/* Dark theme */
html[data-theme="dark"] .fs-field .select2-container--default .select2-selection--single { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .fs-field .select2-container--default .select2-selection--single .select2-selection__rendered { color: #e2e8f0; }
html[data-theme="dark"] .fs-field.is-set .select2-container--default .select2-selection--single { background: #172554; border-color: #60a5fa; }
html[data-theme="dark"] .fs-field.is-set .select2-container--default .select2-selection--single .select2-selection__rendered { color: #bfdbfe; }
html[data-theme="dark"] .fs-dropdown .select2-dropdown,
html[data-theme="dark"] .fs-dropdown .select2-dropdown .select2-search--dropdown .select2-search__field { background: #0f172a; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .fs-dropdown .select2-dropdown .select2-results__option[aria-selected=true] { background: #1e3a8a; color: #dbeafe; }

@media (max-width: 575.98px) {
    .fs-field .select2-container--default .select2-selection--single { height: 52px; }
    .fs-field .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 49px; font-size: 16px; }
    .fs-field .select2-container--default .select2-selection--single .select2-selection__arrow { height: 49px; }
    .fs-field .select2-container--default .select2-selection--single .select2-selection__clear { top: 5px; width: 40px; height: 40px; line-height: 38px; }
    .fs-field .select2-container--default .select2-selection--single .select2-selection__rendered { padding-right: 70px; }
    .fs-dropdown .select2-results__option { min-height: 48px; font-size: 16px; }
}
