/* Select2 overrides to match app input styling */
.select2-container {
    width: 100% !important;
    display: block;
    vertical-align: top;
}
.select2-container .select2-selection--single {
    height: 46px;
    border: 1px solid #e5e7eb;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 0.5rem;
    background-color: #ffffff;
    display: flex;
    align-items: center;
}
.select2-container--default
    .select2-selection--single
    .select2-selection__rendered {
    line-height: 42px;
    color: #111827;
}
.select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    height: 42px;
    right: 8px;
}
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus
    .select2-selection--single {
    border-color: #60a5fa; /* blue-400 */
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.5); /* ring-blue-300 */
}
.select2-dropdown {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}
.select2-results__option {
    padding: 8px 12px;
}
.select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #eff6ff; /* blue-50 */
    color: #1f2937; /* gray-800 */
}
.select2-results__option[aria-selected="true"] {
    background-color: #dbeafe; /* blue-100 */
    color: #1f2937;
}
.select2-search--dropdown .select2-search__field {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem; /* rounded-md */
    padding: 6px 10px;
}

/* Multiple select adjustments */
.select2-container .select2-selection--multiple {
    min-height: 44px;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #ffffff;
}
.select2-container--default
    .select2-selection--multiple
    .select2-selection__choice {
    background-color: #eef2ff; /* indigo-100 */
    border: 1px solid #c7d2fe; /* indigo-200 */
    color: #1e3a8a; /* indigo-800 */
    border-radius: 0.375rem;
    padding: 2px 6px;
}

/* Dark mode support */
html[data-theme="dark"] .select2-container .select2-selection--single {
    background-color: #111827; /* gray-900 */
    border-color: #374151; /* gray-700 */
}
html[data-theme="dark"]
    .select2-container--default
    .select2-selection--single
    .select2-selection__rendered {
    color: #f9fafb;
}
html[data-theme="dark"] .select2-dropdown {
    background-color: #111827;
    border-color: #374151;
}
html[data-theme="dark"]
    .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #1f2937; /* gray-800 */
    color: #f9fafb;
}
html[data-theme="dark"] .select2-results__option[aria-selected="true"] {
    background-color: #374151; /* gray-700 */
    color: #f9fafb;
}
html[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: #0b0f19;
    border-color: #374151;
    color: #f9fafb;
}
/* ---- Enhancements for multi-select chips and payers dropdown ---- */
/* Add breathing room inside the multi-select container */
.select2-container .select2-selection--multiple {
    padding: 6px 8px;
}
/* Make chips layout predictable and avoid overlap */
.select2-container--default
    .select2-selection--multiple
    .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
}
/* Chip: provide left padding to avoid the X overlapping text */
.select2-container--default
    .select2-selection--multiple
    .select2-selection__choice {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px 2px 22px; /* room for remove icon */
    margin-top: 4px;
}
/* Position the remove (×) icon to the left, not over the text */
.select2-container--default
    .select2-selection--multiple
    .select2-selection__choice__remove {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    float: none;
    border: none;
    background: transparent;
    color: #4b5563; /* gray-600 */
    font-weight: 600;
    cursor: pointer;
}
.select2-container--default
    .select2-selection--multiple
    .select2-selection__choice__remove:hover {
    color: #111827; /* gray-900 */
}
/* Prevent chip text clipping */
.select2-container--default
    .select2-selection--multiple
    .select2-selection__choice__display {
    white-space: nowrap;
}
/* Constrain payers dropdown width: at least field width, cap at 480px */
.payers-dropdown.select2-dropdown {
    width: 450px !important;
    /* min-width: 100% !important; */
    max-width: 700px;
}
