/*
 * Випадаючі списки форми в стилі сайту (js/custom-select.js).
 * Поле — як .estimate-form__select (Figma 65:169), список — як меню
 * телефону в шапці (phone-dropdown.css): біла плашка, radius 12, тінь.
 * Нативний <select> лишається прихованим і синхронізованим (для відправки форми).
 */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select > select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.custom-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  background: transparent;
}

.custom-select__trigger::after {
  content: '';
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: url('../../images/icons/chevron-down-black.svg') center / contain no-repeat;
  transition: transform 0.25s ease;
}

/* Лише один варіант — поле просто показує значення */
.custom-select__trigger:disabled {
  cursor: default;
}

.custom-select__trigger:disabled::after {
  opacity: 0.25;
}

.custom-select__trigger[aria-expanded='true'] {
  border-color: var(--color-primary);
}

.custom-select__trigger[aria-expanded='true']::after {
  transform: rotate(180deg);
}

/* Перевизначаємо фон-шеврон нативного вигляду — тут шеврон у ::after */
.custom-select .estimate-form__select.custom-select__trigger {
  padding-right: 20px;
  background: transparent;
}

.custom-select__list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 296px;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--color-white);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  list-style: none;
  opacity: 0;
  translate: 0 -6px;
  visibility: hidden;
  transition: opacity 0.2s ease, translate 0.2s ease, visibility 0s linear 0.2s;
}

.custom-select.is-open .custom-select__list {
  opacity: 1;
  translate: 0 0;
  visibility: visible;
  transition: opacity 0.2s ease, translate 0.2s ease, visibility 0s;
}

/* Якщо знизу мало місця — відкриваємо вгору */
.custom-select.is-up .custom-select__list {
  top: auto;
  bottom: calc(100% + 8px);
  translate: 0 6px;
}

.custom-select.is-up.is-open .custom-select__list {
  translate: 0 0;
}

.custom-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.custom-select__option.is-active {
  background: var(--color-primary-tint);
}

.custom-select__option[aria-selected='true'] {
  color: var(--color-primary);
  font-weight: 500;
}

.custom-select__option[aria-selected='true']::after {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: url('../../images/icons/check-box.svg') center / contain no-repeat;
}

@media (max-width: 900px) {
  .custom-select__trigger::after {
    width: 16px;
    height: 16px;
  }

  .custom-select__option {
    padding: 10px 12px;
    font-size: 14px;
  }

  .custom-select__option[aria-selected='true']::after {
    width: 16px;
    height: 16px;
  }
}
