/* Based on https://github.com/tagliala/select2-bootstrap4-theme/tree/feature/bootstrap-5 */

.select2-container--bootstrap5 {
  display: block;
}

.select2-container--bootstrap5 *:focus {
  outline: 0;
}

.input-group .select2-container--bootstrap5 {
  -ms-flex-positive: 1;
  flex-grow: 1;
}

.input-group-text~.select2-container--bootstrap5 .select2-selection {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.input-group>.select2-container--bootstrap5:not(:last-child) .select2-selection {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.select2-container--bootstrap5 .select2-selection {
  width: 100%;
  min-height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  /* font-family: var(--bs-font-sans-serif); */
  /* font-size: 1rem; */
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  vertical-align: middle;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .select2-container--bootstrap5 .select2-selection {
    transition: none;
  }
}

.select2-container--bootstrap5.select2-container--focus .select2-selection {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-container--bootstrap5.select2-container--open.select2-container--above .select2-selection {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.select2-container--bootstrap5.select2-container--open.select2-container--below .select2-selection {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.select2-container--bootstrap5.select2-container--disabled .select2-selection,
.select2-container--bootstrap5.select2-container--disabled .select2-search__field {
  cursor: not-allowed;
  background-color: #e9ecef;
  border-color: #ced4da;
  box-shadow: none;
}

select.is-valid~.select2-container--bootstrap5 .select2-selection,
form.was-validated select:valid~.select2-container--bootstrap5 .select2-selection {
  border-color: #198754;
}

select.is-valid~.select2-container--bootstrap5.select2-container--focus .select2-selection,
form.was-validated select:valid~.select2-container--bootstrap5.select2-container--focus .select2-selection {
  border-color: #198754;
  box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

select.is-invalid~.select2-container--bootstrap5 .select2-selection,
form.was-validated select:invalid~.select2-container--bootstrap5 .select2-selection {
  border-color: #dc3545;
}

select.is-invalid~.select2-container--bootstrap5.select2-container--focus .select2-selection,
form.was-validated select:invalid~.select2-container--bootstrap5.select2-container--focus .select2-selection {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.select2-container--bootstrap5 .select2-dropdown {
  border-color: #ced4da;
  border-radius: 0;
}

.select2-container--bootstrap5 .select2-dropdown.select2-dropdown--below {
  border-bottom-right-radius: 0.25rem;
  border-bottom-left-radius: 0.25rem;
}

.select2-container--bootstrap5 .select2-dropdown.select2-dropdown--above {
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

.select2-container--bootstrap5 .select2-results__option {
  padding: 0.375rem 0.75rem;
}

.select2-container--bootstrap5 .select2-results__option--selected {
  color: #000;
  background-color: #e9ecef;
}

.select2-container--bootstrap5 .select2-results__option--disabled {
  color: #6c757d;
}

.select2-container--bootstrap5 .select2-results__option--highlighted {
  color: #fff;
  background-color: #080F48;
}

.select2-container--bootstrap5 .select2-results__option--group {
  padding: 0;
}

.select2-container--bootstrap5 .select2-results__option--group .select2-results__options--nested .select2-results__option {
  padding-left: 0.75rem;
}

.select2-container--bootstrap5 .select2-results>.select2-results__options {
  max-height: 15em;
  overflow-y: auto;
}

.select2-container--bootstrap5 .select2-results__group {
  display: list-item;
  padding: 0.375rem 0.375rem;
  color: #6c757d;
}

.select2-container--bootstrap5 .select2-selection__clear {
  float: right;
  width: 1em;
  height: 1em;
  padding: 0;
  margin: 0.25em 0 0;
  font-weight: 700;
  line-height: 0.75em;
  color: #212529;
  background: #e6e6e6 url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16'%3e%3cpath fill='%23212529' d='M1 12l4-4-4-4 3-3 4 4 4-4 3 3-4 4 4 4-3 3-4-4-4 4z'/%3e%3c/svg%3e") center no-repeat !important;
  border-radius: 100%;
}

.select2-container--bootstrap5 .select2-selection__clear span {
  display: none;
}

.select2-container--bootstrap5 .select2-selection__clear:hover {
  background-color: #d9d9d9 !important;
}

.select2-container--bootstrap5 .select2-results__message {
  color: #6c757d;
}

.select2-container--bootstrap5 .select2-selection--single {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
}

select.is-valid~.select2-container--bootstrap5 .select2-selection--single,
form.was-validated select:valid~.select2-container--bootstrap5 .select2-selection--single {
  padding-right: 4.125rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-position: right 0.75rem center, center right 2.25rem;
  background-size: 16px 12px, calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

select.is-invalid~.select2-container--bootstrap5 .select2-selection--single,
form.was-validated select:invalid~.select2-container--bootstrap5 .select2-selection--single {
  padding-right: 4.125rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-position: right 0.75rem center, center right 2.25rem;
  background-size: 16px 12px, calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.select2-container--bootstrap5 .select2-selection--single .select2-selection__placeholder {
  color: #6c757d;
}

.select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
  padding: 0;
  color: #212529;
}

.select2-container--bootstrap5 .select2-search--dropdown .select2-search__field {
  padding: 0.375rem 0.75rem;
  color: #212529;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
}

.select2-container--bootstrap5 .select2-search--dropdown .select2-search__field:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-container--bootstrap5 .select2-selection--multiple {
  padding: 0 0.75rem;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__rendered {
  margin: 0;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-search--inline {
  display: inline-block;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice {
  position: relative;
  display: inline-block;
  padding: 0 5px 0 21px;
  margin: 0.375rem 0.375rem 0.375rem 0;
  color: #fff;
  vertical-align: top;
  cursor: pointer;
  background-color: #6c757d;
  border-radius: 0.2rem;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__display {
  padding: 0 5px;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-search__field {
  height: calc(1.5em + 0.75rem);
  padding-top: 0.375rem;
  margin: 0;
  /* font-family: var(--bs-font-sans-serif); */
  line-height: 1.5;
  color: #212529;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__remove {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 5px;
  margin: 0;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  background: none;
  border: none;
  border-right: 1px solid #a1a8ae;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: rgba(255, 255, 255, 0.85);
}

.select2-container--bootstrap5 .select2-selection--multiple.select2-selection--clearable {
  padding-right: 32px;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__clear {
  position: absolute;
  top: 0.375rem;
  right: 0.75rem;
}

select.is-valid~.select2-container--bootstrap5 .select2-selection--multiple,
form.was-validated select:valid~.select2-container--bootstrap5 .select2-selection--multiple {
  padding-right: calc(1.5em + 0.75rem) !important;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e") top calc(0.375em + 0.1875rem) right calc(0.375em + 0.1875rem)/calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) no-repeat;
}

select.is-valid~.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__clear,
form.was-validated select:valid~.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__clear {
  right: calc(1.5em + 0.75rem);
}

select.is-invalid~.select2-container--bootstrap5 .select2-selection--multiple,
form.was-validated select:invalid~.select2-container--bootstrap5 .select2-selection--multiple {
  padding-right: calc(1.5em + 0.75rem) !important;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e") top calc(0.375em + 0.1875rem) right calc(0.375em + 0.1875rem)/calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) no-repeat;
}

select.is-invalid~.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__clear,
form.was-validated select:invalid~.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__clear {
  right: calc(1.5em + 0.75rem);
}

.select2-container--bootstrap5.select2-container--disabled .select2-selection--multiple .select2-selection__choice {
  padding-left: 5px;
  cursor: not-allowed;
}

.select2-container--bootstrap5.select2-container--disabled .select2-selection--multiple .select2-selection__choice .select2-selection__choice__remove {
  display: none;
}
