/*
 * Estimate — форма (Figma компонент 65:161: крок 1 = 65:162, крок 2 = 65:1049)
 * + картка відгуків. Секція: desktop 39:873, mobile 44:2991.
 * Desktop: фон #f3f8fa, py 150, px 48; форма flex 1 + картка 688, gap 48;
 *   висота блоку 811. Поля: label 18 Medium, input h 58 radius 12,
 *   рамка #c6e1e8, текст 18; кнопки-перемикачі active = бірюзові.
 * Mobile: pt 100, px 12 для форми; label 16, поле h 48, текст 14;
 *   далі картка відгуків на всю ширину з radius 20 зверху (див. reviews.css).
 */
.estimate {
  padding: 150px var(--gutter);
  background: var(--color-primary-tint);
}

.estimate__inner {
  display: flex;
  align-items: stretch;
  gap: 48px;
  max-width: 1344px;
  margin: 0 auto;
}

/* ---------- Form ---------- */
.estimate-form {
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  min-width: 0;
  min-height: 811px;
}

.estimate-form__step {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
}

.estimate-form__step[hidden] {
  display: none;
}

.estimate-form__top {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.estimate-form__intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.estimate-form__title {
  font-size: 48px;
  font-weight: 500;
  line-height: 1.1;
}

.estimate-form__title em {
  color: var(--color-primary);
}

.estimate-form__lead {
  max-width: 589px;
  font-size: 20px;
  line-height: 1.2;
  color: var(--color-text-muted);
}

.estimate-form__lead strong {
  display: block;
  font-weight: 500;
  color: var(--color-primary);
}

.estimate-form__fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.estimate-form__group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.estimate-form__group--choice {
  gap: 16px;
}

/* legend не є flex-елементом fieldset, тому відступ задаємо явно */
.estimate-form__group--choice > legend {
  margin-bottom: 16px;
  padding: 0;
}

.estimate-form__row {
  display: flex;
  gap: 16px;
}

.estimate-form__row > * {
  flex: 1 0 0;
  min-width: 0;
}

.estimate-form__label {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.estimate-form__input,
.estimate-form__select {
  width: 100%;
  height: 58px;
  padding: 8px 20px;
  border: 1px solid var(--color-primary-soft);
  border-radius: 12px;
  background: transparent;
  font-size: 18px;
  line-height: 1.2;
  outline: none;
  transition: border-color 0.2s ease;
}

.estimate-form__input::placeholder {
  color: var(--color-text-placeholder);
}

.estimate-form__input:focus,
.estimate-form__select:focus {
  border-color: var(--color-primary);
}

.estimate-form__input:user-invalid {
  border-color: var(--color-error);
}

.estimate-form__select {
  appearance: none;
  padding-right: 52px;
  background: url('../../images/icons/chevron-down-black.svg') right 20px center / 24px 24px no-repeat;
  cursor: pointer;
}

.estimate-form__options {
  display: flex;
  gap: 8px;
}

.estimate-form__option {
  position: relative;
  flex: 1 0 0;
  min-width: 0;
}

.estimate-form__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.estimate-form__option > span:not(.estimate-form__badge) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 58px;
  padding: 16px 20px;
  border: 1px solid var(--color-primary-soft);
  border-radius: 12px;
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.estimate-form__option input:checked + span {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: 500;
}

.estimate-form__option input:focus-visible + span {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Іконка лапки — 68:1244, rotate −15.43° */
.estimate-form__pet-icon {
  display: none;
  width: 16px;
  height: 16px;
  transform: rotate(-15.43deg);
}

/* Іконки House / Apartment (images/icons/house.svg, apartment.svg) —
   як лапка, видно лише у вибраному стані */
.estimate-form__option-icon {
  display: none;
  width: 16px;
  height: 16px;
}

.estimate-form__option input:checked + span .estimate-form__pet-icon,
.estimate-form__option input:checked + span .estimate-form__option-icon {
  display: block;
}

/* Не обрано при спробі перейти далі — підсвічуємо групу */
.estimate-form__group--choice.is-invalid .estimate-form__option > span:not(.estimate-form__badge) {
  border-color: var(--color-error);
}

/* Бейдж «most popular» на Biweekly — 68:1293 */
.estimate-form__badge {
  position: absolute;
  top: -5.52px;
  left: 7.25px;
  display: flex;
  align-items: center;
  gap: 4.479px;
  padding: 4.479px 6.719px;
  border-radius: 3.359px;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 7.838px;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  width: max-content;
  z-index: 2; /* поверх сусідньої кнопки, якщо бейдж ширший за свою */
  pointer-events: none;
}

.estimate-form__badge img {
  width: 10.078px;
  height: 10.078px;
}

.estimate-form__badge .estimate-form__badge-icon-on {
  display: none;
}

/* Biweekly обрано — кнопка бірюзова, тож бейдж інвертуємо */
.estimate-form__option input:checked ~ .estimate-form__badge {
  background: var(--color-white);
  color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.estimate-form__option input:checked ~ .estimate-form__badge img {
  display: none;
}

.estimate-form__option input:checked ~ .estimate-form__badge .estimate-form__badge-icon-on {
  display: block;
}

.estimate-form__hint {
  font-size: 14px;
  line-height: 1.2;
}

.estimate-form__hint a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.estimate-form__bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.estimate-form__note {
  font-size: 18px;
  line-height: 1.2;
  color: var(--color-text-muted);
}

/* Помилка відправки (немає в Figma): текст над кнопками кроку 2, кольором невалідних полів */
.estimate-form__status {
  font-size: 16px;
  line-height: 1.3;
  color: var(--color-error);
}

/* Поки заявка відправляється — кнопки неактивні */
.estimate-form[aria-busy='true'] .estimate-form__actions {
  opacity: 0.6;
  pointer-events: none;
}

/* Cloudflare Turnstile (немає в Figma): у режимі Managed зазвичай невидимий,
   галочка «I'm human» з'являється лише при підозрілій активності */
.estimate-form__captcha:empty {
  display: none;
}

/* Пастка для ботів: прихована від людей, але не display: none
   (деякі боти пропускають такі поля) */
.estimate-form__hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Крок 2: «Back» — ліворуч, «Get an Estimate» — праворуч */
.estimate-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.estimate-form__back {
  font-size: 16px;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.estimate-form__back:hover {
  color: var(--color-black);
}

@media (max-width: 1199px) {
  .estimate__inner {
    flex-direction: column;
  }

  .estimate-form {
    flex: none;
    min-height: 0;
  }
}

@media (max-width: 900px) {
  .estimate {
    padding: 100px 0 0;
  }

  .estimate__inner {
    gap: 100px;
  }

  .estimate-form {
    padding: 0 var(--gutter);
  }

  .estimate-form__step {
    gap: 32px;
  }

  .estimate-form__intro {
    text-align: center;
  }

  .estimate-form__title {
    font-size: 32px;
  }

  .estimate-form__title br {
    display: none;
  }

  .estimate-form__lead {
    font-size: 16px;
  }

  .estimate-form__lead strong {
    display: inline;
    color: var(--color-black);
  }

  .estimate-form__fields {
    gap: 24px;
  }

  .estimate-form__label {
    font-size: 14px;
  }

  .estimate-form__group,
  .estimate-form__group--choice {
    gap: 8px;
  }

  .estimate-form__group--choice > legend {
    margin-bottom: 8px;
  }

  .estimate-form__input,
  .estimate-form__select {
    height: 48px;
    font-size: 14px;
  }

  .estimate-form__select {
    background-size: 16px 16px;
  }

  .estimate-form__row--stack-mobile {
    flex-direction: column;
    gap: 24px;
  }

  .estimate-form__options--tight {
    gap: 4px;
  }

  .estimate-form__option > span:not(.estimate-form__badge) {
    height: 48px;
    padding: 12px 8px;
    font-size: 14px;
  }

  .estimate-form__note {
    font-size: 14px;
    text-align: center;
  }

  /* Кнопка Biweekly вузька — бейдж по центру над нею, в один рядок */
  .estimate-form__badge {
    top: -7px;
    left: 50%;
    gap: 3px;
    padding: 3px 5px;
    font-size: 7px;
    translate: -50% 0;
  }

  .estimate-form__badge img {
    width: 8px;
    height: 8px;
  }

  .estimate-form__bottom {
    align-items: center;
  }
}
