/* Updated version with CoreUI CSS variables replacing colors */

.select2-container--bootstrap-5 {
  display: block;
}
select + .select2-container--bootstrap-5 {
  z-index: 1;
}

.select2-container--bootstrap-5 *:focus {
  outline: 0;
}
.select2-container--bootstrap-5 .select2-selection {
  width: 100%;
  min-height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--cui-body-color);
  background-color: var(--cui-body-bg);
  border: 1px solid var(--cui-border-color);
  border-radius: 0.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
}
@media (prefers-reduced-motion: reduce) {
  .select2-container--bootstrap-5 .select2-selection {
    transition: none;
  }
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--cui-primary);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.select2-container--bootstrap-5 .select2-search {
  width: 100%;
}
.select2-container--bootstrap-5 .select2-dropdown {
  z-index: 1056;
  overflow: hidden;
  color: var(--cui-body-color);
  background-color: var(--cui-body-bg);
  border-color: var(--cui-primary);
  border-radius: 0.25rem;
}
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option {
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--cui-body-color);
}
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__message {
  color: var(--cui-secondary-color);
}
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted {
  color: var(--cui-body-color);
  background-color: var(--cui-secondary-bg);
}
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
  color: var(--cui-light-color);
  background-color: var(--cui-primary);
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  color: var(--cui-body-color);
  display: flex;
  align-items: center;
  height: 100%;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
  color: var(--cui-secondary-color);
}
.select2-container--bootstrap-5 .select2-selection--single {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
  margin-left: auto;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background-image: var(--cui-form-select-bg-img), var(--cui-form-select-bg-icon, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
  color: var(--cui-body-color);
  border: 1px solid var(--cui-border-color);
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice .select2-selection__choice__remove {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ced4da'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/0.75rem auto no-repeat;
}
.select2-container--bootstrap-5.select2-container--disabled .select2-selection {
  color: var(--cui-secondary-color);
  background-color: var(--cui-secondary-bg);
  border-color: var(--cui-border-color);
}
.select2-container--bootstrap-5.select2-container--disabled .select2-selection--multiple .select2-selection__choice {
  color: var(--cui-secondary-color);
}
.is-valid + .select2-container--bootstrap-5 .select2-selection {
  border-color: var(--cui-success);
  box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}
.is-invalid + .select2-container--bootstrap-5 .select2-selection {
  border-color: var(--cui-danger);
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Updated version with CoreUI CSS variables replacing colors and adjusted for form-select-sm size */

.select2-container--bootstrap-5s {
  display: block;
}
select + .select2-container--bootstrap-5s {
  z-index: 1;
}

.select2-container--bootstrap-5s *:focus {
  outline: 0;
}
.select2-container--bootstrap-5s .select2-selection {
  width: 100%;
  min-height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--cui-body-color);
  background-color: var(--cui-body-bg);
  border: 1px solid var(--cui-border-color);
  border-radius: 0.2rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
}
@media (prefers-reduced-motion: reduce) {
  .select2-container--bootstrap-5s .select2-selection {
    transition: none;
  }
}
.select2-container--bootstrap-5s.select2-container--focus .select2-selection,
.select2-container--bootstrap-5s.select2-container--open .select2-selection {
  border-color: var(--cui-primary);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.select2-container--bootstrap-5s .select2-search {
  width: 100%;
}
.select2-container--bootstrap-5s .select2-dropdown {
  z-index: 1056;
  overflow: hidden;
  color: var(--cui-body-color);
  background-color: var(--cui-body-bg);
  border-color: var(--cui-primary);
  border-radius: 0.2rem;
}
.select2-container--bootstrap-5s .select2-dropdown .select2-results__options .select2-results__option {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--cui-body-color);
}
.select2-container--bootstrap-5s .select2-dropdown .select2-results__options .select2-results__option.select2-results__message {
  color: var(--cui-secondary-color);
}
.select2-container--bootstrap-5s .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted {
  color: var(--cui-body-color);
  background-color: var(--cui-secondary-bg);
}
.select2-container--bootstrap-5s .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5s .select2-dropdown .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
  color: var(--cui-light-color);
  background-color: var(--cui-primary);
}
.select2-container--bootstrap-5s .select2-selection--single .select2-selection__rendered {
  color: var(--cui-body-color);
  display: flex;
  align-items: center;
  height: 100%;
}
.select2-container--bootstrap-5s .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
  color: var(--cui-secondary-color);
}
.select2-container--bootstrap-5s .select2-selection--single {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.select2-container--bootstrap-5s .select2-selection--single .select2-selection__arrow {
  margin-left: auto;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background-image: var(--cui-form-select-bg-img), var(--cui-form-select-bg-icon, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.select2-container--bootstrap-5s .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
  color: var(--cui-body-color);
  border: 1px solid var(--cui-border-color);
}
.select2-container--bootstrap-5s .select2-selection--multiple .select2-selection__rendered .select2-selection__choice .select2-selection__choice__remove {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ced4da'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/0.5rem auto no-repeat;
}
.select2-container--bootstrap-5s.select2-container--disabled .select2-selection {
  color: var(--cui-secondary-color);
  background-color: var(--cui-secondary-bg);
  border-color: var(--cui-border-color);
}
.select2-container--bootstrap-5s.select2-container--disabled .select2-selection--multiple .select2-selection__choice {
  color: var(--cui-secondary-color);
}
.is-valid + .select2-container--bootstrap-5s .select2-selection {
  border-color: var(--cui-success);
  box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}
.is-invalid + .select2-container--bootstrap-5s .select2-selection {
  border-color: var(--cui-danger);
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.select2-container .select2-search--inline .select2-search__field {
  padding: 4px;
  width: 100% !important;
}
.select2-container--default .select2-selection--multiple {
  min-height: 2.5rem !important; /* Adjust to your preferred height */
}
.select2-container--default .select2-selection--multiple .select2-search__field {
  height: 2.5rem !important;
}