/* ==============================
   Overrides: Select2 + input-group (Vuexy/Bootstrap5 + crispy)
   ============================== */

/* Контейнер Select2 должен вести себя как обычный input внутри input-group */
.input-group > .select2-container,
.input-group > .select2-container--bootstrap,
.input-group > .select2-container--bootstrap-5 {
  flex: 1 1 auto;
  width: auto !important; /* перекрываем inline width:100% */
  min-width: 0;
}

/* Высота/паддинги/вертикальное центрирование под Vuexy/BS5 */
.input-group > .select2-container .select2-selection--single,
.input-group > .select2-container--bootstrap .select2-selection--single,
.input-group > .select2-container--bootstrap-5 .select2-selection--single {
  height: 100%;
  display: flex;              /* вертикальное центрирование текста */
  align-items: center;        /* вертикальное центрирование текста */
  padding: .467rem 1rem;      /* как у .form-select в Vuexy */
  line-height: normal;
  font-size: var(--bs-body-font-size, 1rem);
  /* убираем скругления справа для ровного стыка с кнопкой */
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  position: relative;         /* для позиционирования крестика справа */
}

/* Текст внутри selection */
.input-group .select2-container .select2-selection__rendered {
  line-height: normal;
  padding-left: 0;            /* паддинг берём у selection */
  padding-right: 3.5rem;      /* место под крестик + стрелку */
  font-size: var(--bs-body-font-size, 1rem);
}

/* Стрелка Select2 — на всю высоту и немного внутрь */
.input-group .select2-container .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: .75rem;              /* соответствует Vuexy отступам */
}

/* Крестик очистки — фиксируем справа, перед стрелкой */
.input-group .select2-container .select2-selection--single .select2-selection__clear,
.input-group .select2-container--bootstrap .select2-selection--single .select2-selection__clear,
.input-group .select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
  position: absolute;
  right: 2.75rem;             /* расположен перед стрелкой */
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  float: none !important;
  line-height: 1;
  opacity: .75;
  cursor: pointer;
}

.input-group .select2-container .select2-selection--single .select2-selection__clear:hover,
.input-group .select2-container--bootstrap .select2-selection--single .select2-selection__clear:hover,
.input-group .select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear:hover {
  opacity: 1;
}

/* 1. Элементы, которые НЕ последние (слева), не должны иметь правых скруглений */
.input-group > :not(:last-child).input-group-text,
.input-group > :not(:last-child).btn,
.input-group > :not(:last-child).form-control,
.input-group > :not(:last-child).form-select {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

/* 2. Элементы, которые НЕ первые (справа), не должны иметь левых скруглений */
.input-group > :not(:first-child).input-group-text,
.input-group > :not(:first-child).btn,
.input-group > :not(:first-child).form-control,
.input-group > :not(:first-child).form-select {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

/* Лёгкий серый фон для Vuexy-подобного addon */
.input-group > .input-group-text.bg-lighter {
  background-color: #f5f5f7 !important;
  border-color: #d9dee3; /* Цвет бордера как у инпутов в Vuexy */
  color: #697a8d;
}

/* Форсируем стили Vuexy form-control для инпута телефона */
.ti-phone-input-group .ti-phone-input {
  /* Flex свойства для корректной работы внутри input-group */
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;

  display: block;
  padding: 0.467rem 1rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #697a8d;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #d9dee3;
  appearance: none;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;

  /* Стыковка с аддоном */
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  margin-left: -1px;
}

/* Состояние фокуса: Желтый цвет (#fbbe07) */
.ti-phone-input-group .ti-phone-input:focus {
  color: #697a8d;
  background-color: #fff;
  border-color: #fbbe07;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(251, 190, 7, 0.15);
  z-index: 3;
}

/* Аддон телефона */
.ti-phone-input-group .ti-phone-addon {
  border-color: #d9dee3 !important;
  z-index: 2;
}

/* ==============================
   Select2 Dropdown в модальных окнах
   ============================== */

.select2-dropdown-fixed {
  position: fixed !important;
  z-index: 99999 !important;
}

.select2-dropdown-fixed .select2-search,
.select2-dropdown-fixed .select2-results {
  z-index: 100000 !important;
}
