/*
 * Bridges the Bootstrap-4 select2 theme to this Bootstrap-5 admin theme, so a
 * select2 box ends up the same height / radius / focus ring as a .form-select
 * sitting next to it. Loaded by resources/views/admin/components/select2all.blade.php.
 */

.select2-container--bootstrap4 .select2-selection {
    border-radius: .375rem;
    border-color: #dee2e6;
}

.select2-container--bootstrap4 .select2-selection--single {
    height: calc(1.5em + .75rem + 2px);
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + .75rem);
    padding-left: .75rem;
    padding-right: 1.75rem;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder {
    line-height: calc(1.5em + .75rem);
}

.select2-container--bootstrap4 .select2-selection--multiple {
    min-height: calc(1.5em + .75rem + 2px) !important;
}

/* counterpart of .form-select-sm / .form-control-sm (added by select2-init.js) */
.select2-container--bootstrap4 .select2-selection--single.s2-sm {
    height: calc(1.5em + .5rem + 2px);
    font-size: .875rem;
    border-radius: .25rem;
}

.select2-container--bootstrap4 .select2-selection--single.s2-sm .select2-selection__rendered {
    line-height: calc(1.5em + .5rem);
    padding-left: .5rem;
}

.select2-container--bootstrap4 .select2-selection--single.s2-sm .select2-selection__placeholder {
    line-height: calc(1.5em + .5rem);
}

.select2-container--bootstrap4 .select2-selection--multiple.s2-sm {
    min-height: calc(1.5em + .5rem + 2px) !important;
    font-size: .875rem;
}

.s2-sm-drop .select2-results__option,
.s2-sm-drop .select2-search__field {
    font-size: .875rem;
}

/* same focus treatment as .form-select:focus */
.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .25);
}

select.is-invalid + .select2-container--bootstrap4 .select2-selection {
    border-color: #dc3545;
}

/* the dropdown has to clear cards, sticky headers and modals */
.select2-container--open {
    z-index: 1060;
}

.modal .select2-container--open,
.select2-container--open.s2-in-modal {
    z-index: 1065;
}

.select2-search--dropdown .select2-search__field {
    padding: .25rem .5rem;
}
