/* Global Select2 Materio / Bootstrap 5 theme + downward-only presentation */
.select2-container {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

.select2-container--default .select2-selection--single {
  height: 38px;
  min-height: 38px;
  padding: 0.4375rem 2.1rem 0.4375rem 0.875rem;
  font-size: 0.9375rem;
  line-height: 1.375;
  color: #3b4056;
  background-color: #ffffff;
  border: 1px solid #d4d3d5;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  position: relative;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

select.form-select-sm + .select2-container--default .select2-selection--single {
  height: 32px;
  min-height: 32px;
  padding: 0.25rem 2rem 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 0;
  padding-right: 0;
  color: inherit;
  line-height: 1.375;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9e9aa7;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 8px;
  width: 22px;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
  order: 2;
  float: none;
  margin-left: 6px;
  margin-right: 4px;
  color: #8a8d93;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 600;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
  color: #ff4c51;
}

/* Multiple select */
.select2-container--default .select2-selection--multiple {
  min-height: 38px;
  padding: 2px 8px;
  background-color: #ffffff;
  border: 1px solid #d4d3d5;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  white-space: normal;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: #f3eeff;
  border: 1px solid #ddd0ff;
  color: #5e35b1;
  border-radius: 0.25rem;
  padding: 2px 8px;
  margin: 2px 0;
  font-size: 0.8125rem;
  font-weight: 500;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: #7e57c2;
  margin-right: 5px;
}

.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
  margin-top: 2px;
  font-size: 0.875rem;
  color: #3b4056;
}

/* Focus, Open & Invalid states */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: #8c57ff;
  box-shadow: 0 0 0 2px rgba(140, 87, 255, 0.16);
  outline: 0;
}

.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

select.is-invalid + .select2-container--default .select2-selection--single,
select.is-invalid + .select2-container--default .select2-selection--multiple {
  border-color: #ff4c51;
}

/* Support Bootstrap input-group addon + Select2 */
.input-group > .select2-container--default {
  flex: 1 1 auto !important;
  width: 1% !important;
  min-width: 0;
}

.input-group > .select2-container--default:not(:first-child) .select2-selection--single {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

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

/* Dropdown panel strictly below the input & search field */
.select2-container--open .select2-dropdown {
  z-index: 1065;
  left: 0;
}

.modal .select2-container--open .select2-dropdown,
.select2-dropdown {
  background-color: #ffffff;
  border: 1px solid #8c57ff;
  border-top: 1px solid #eceaf4;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 10px 26px rgba(46, 38, 61, 0.16);
  overflow: hidden;
}

.select2-search--dropdown {
  display: block;
  padding: 8px;
  background-color: #fafafc;
  border-bottom: 1px solid #eceaf4;
}

.select2-search--dropdown .select2-search__field {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px 7px 32px;
  border: 1px solid #d4d3d5;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: #3b4056;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='%238a8d93'%3E%3Cpath d='M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z'/%3E%3C/svg%3E") no-repeat 10px center;
  outline: none;
}

.select2-search--dropdown .select2-search__field:focus {
  border-color: #8c57ff;
  box-shadow: 0 0 0 2px rgba(140, 87, 255, 0.14);
}

.select2-results__options {
  max-height: 230px !important;
  overflow-y: auto !important;
  font-size: 0.875rem;
}

.select2-results__option {
  padding: 8px 12px;
  color: #3b4056;
  line-height: 1.35;
}

.select2-results__group {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6d6777;
  background-color: #f6f5fa;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: rgba(140, 87, 255, 0.12);
  color: #5e35b1;
  font-weight: 600;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #8c57ff;
  color: #ffffff;
}
