/*---------------------------------------
    SELECT2 (surgical fixes only)
----------------------------------------*/
.select2-container {
    width: 100% !important;
}

.select2-container--bootstrap-5 {
    min-width: 0;
    max-width: 100%;
}

.select2-container--bootstrap-5 .select2-selection {
    background-color: transparent !important;
    border-color: var(--bs-border-color) !important;
    border-radius: var(--bs-border-radius) !important;
    box-shadow: none !important;
    outline: 0 !important;
}

.select2-container--bootstrap-5 .select2-selection--single {
    min-height: calc(1.5em + 0.75rem + 2px) !important;
}

.select2-container--bootstrap-5 .select2-selection:hover,
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--mangofit-color) !important;
    box-shadow: none !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    display: block;
    color: var(--bs-body-color) !important;
    line-height: 1.5 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Keep vertical centering on compact selects (e.g. comments exercise filter). */
.form-select-sm + .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.5 !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: rgba(var(--contrast-theme-color-rgb), 0.65) !important;
}

.mf-select2-user-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
}

.mf-select2-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
    flex-shrink: 0;
}

.mf-select2-user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select2-container--bootstrap-5 .select2-dropdown,
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}

.select2-container--bootstrap-5 .select2-search__field::placeholder {
    color: rgba(var(--contrast-theme-color-rgb), 0.65) !important;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--bs-border-color) !important;
    box-shadow: none !important;
    outline: 0 !important;
}

.select2-container--bootstrap-5 .select2-results__option {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}

.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
    background-color: transparent !important;
    color: var(--bs-body-color) !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected],
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected="true"],
.select2-container--bootstrap-5 .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: rgba(var(--contrast-theme-color-rgb), 0.14) !important;
    color: var(--bs-body-color) !important;
}

.select2-container--bootstrap-5.select2-container--open .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-dropdown {
    border-color: var(--mangofit-color) !important;
}

.select2-container--bootstrap-5.select2-container--open.select2-container--below .select2-selection {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.select2-container--bootstrap-5.select2-container--open.select2-container--below .select2-dropdown {
    border-top: 0 !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}
