/* =============================================================================
   Астра-мед — квиз «Пройдите опрос — получите подарок»
   Все классы с префиксом aq- : модуль ставится и на лендинг, и на страницы
   Битрикса поверх стилей Aspro Allcorp3, где короткие имена вроде .option
   или .progress уже заняты. Переменные с фолбэками — если на странице нет
   токенов лендинга, квиз всё равно отрисуется фирменными цветами.
   ============================================================================= */

.aq {
  --aq-base: var(--base, #ef7d1b);
  --aq-base-dark: var(--base-dark, #d76c11);
  --aq-base-soft: var(--base-soft, #fff4e9);
  --aq-more: var(--more, #63bcc9);
  --aq-more-soft: var(--more-soft, #eef8fa);
  --aq-text: var(--text, #10262d);
  --aq-text-2: var(--text-2, #4d646c);
  --aq-muted: var(--muted, #8ea3aa);
  --aq-line: var(--line, #e2eaed);
  --aq-radius: 16px;

  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  font-family: inherit;
}
.aq[hidden] { display: none; }

body.aq-lock { overflow: hidden; }

.aq__overlay {
  position: absolute; inset: 0;
  background: rgba(9, 32, 38, .55);
  backdrop-filter: blur(3px);
  animation: aq-fade .25s ease-out;
}

.aq__box {
  position: relative; z-index: 1;
  width: min(560px, 100%); max-height: 100%;
  overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border-radius: var(--aq-radius);
  box-shadow: 0 30px 80px rgba(9, 32, 38, .35);
  padding: 32px 36px 36px;
  animation: aq-pop .32s cubic-bezier(.16, 1, .3, 1);
}
/* Контейнер принимает фокус программно (tabindex="-1"), в табуляции сам
   не участвует — рамка на нём была бы шумом, а не подсказкой */
.aq__box:focus { outline: none; }

.aq__close {
  position: absolute; top: 14px; right: 16px;
  width: 36px; height: 36px; padding: 0;
  font-size: 26px; line-height: 1; color: var(--aq-muted);
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  transition: background .15s, color .15s;
}
.aq__close:hover { background: var(--aq-more-soft); color: var(--aq-text); }

/* --- Прогресс --- */
.aq__head { margin-bottom: 26px; padding-right: 40px; }
.aq__progress { height: 4px; border-radius: 4px; background: var(--aq-line); overflow: hidden; }
.aq__progress-bar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--aq-more), var(--aq-base));
  border-radius: 4px;
  transition: width .35s cubic-bezier(.16, 1, .3, 1);
}
.aq__counter { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--aq-muted); }

/* --- Вопрос --- */
.aq__title { margin: 0 0 8px; font-size: 24px; line-height: 1.2; font-weight: 800; color: var(--aq-text); }
.aq__note { margin: 0 0 22px; font-size: 14px; line-height: 1.5; color: var(--aq-text-2); }
.aq__note a { color: var(--aq-base-dark); }

.aq__options { display: grid; gap: 10px; }
/* Ответ = один клик, без кнопки «Далее»: каждое лишнее действие на шаге
   стоит части дошедших до конца */
.aq__option {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 16px 18px; text-align: left;
  font-family: inherit; font-size: 16px; font-weight: 600; color: var(--aq-text);
  background: #fff; border: 1px solid var(--aq-line); border-radius: 12px;
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.aq__option::before {
  content: ""; flex: 0 0 auto;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--aq-line); transition: border-color .15s, box-shadow .15s;
}
.aq__option:hover { border-color: var(--aq-more); background: var(--aq-more-soft); }
.aq__option:hover::before { border-color: var(--aq-more); }
.aq__option:active { transform: scale(.99); }
.aq__option.is-active { border-color: var(--aq-base); background: var(--aq-base-soft); }
.aq__option.is-active::before { border-color: var(--aq-base); box-shadow: inset 0 0 0 4px var(--aq-base); }
.aq__option:focus-visible { outline: 2px solid var(--aq-base); outline-offset: 2px; }

.aq__back {
  margin-top: 18px; padding: 8px 0;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--aq-muted);
  background: none; border: 0; cursor: pointer;
}
.aq__back:hover { color: var(--aq-text); }

/* --- Подарок --- */
.aq__gift {
  background: var(--aq-base-soft); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 22px;
}
.aq__gift-title { font-size: 15px; font-weight: 800; color: var(--aq-base-dark); margin-bottom: 10px; }
.aq__gift ul { margin: 0; padding: 0; list-style: none; }
.aq__gift li {
  position: relative; padding-left: 26px; margin-bottom: 7px;
  font-size: 15px; font-weight: 600; color: var(--aq-text);
}
.aq__gift li::before {
  content: ""; position: absolute; left: 4px; top: 7px;
  width: 11px; height: 6px;
  border-left: 2px solid var(--aq-base); border-bottom: 2px solid var(--aq-base);
  transform: rotate(-45deg);
}
.aq__gift-note { margin-top: 10px; font-size: 13px; color: var(--aq-text-2); }

/* --- Форма --- */
.aq__field { margin-bottom: 12px; }
.aq__field input {
  width: 100%; padding: 15px 16px;
  font-family: inherit; font-size: 16px; color: var(--aq-text);
  background: #fff; border: 1px solid var(--aq-line); border-radius: 12px;
  transition: border-color .15s;
}
.aq__field input:focus { outline: none; border-color: var(--aq-more); }
.aq__error { display: none; margin-top: 6px; font-size: 13px; color: #e05252; }
.aq__field.is-invalid input { border-color: #e05252; }
.aq__field.is-invalid .aq__error { display: block; }

.aq__consent {
  display: flex; gap: 10px; margin: 14px 0 18px;
  font-size: 13px; line-height: 1.45; color: var(--aq-text-2); cursor: pointer;
}
.aq__consent input { flex: 0 0 auto; margin-top: 2px; accent-color: var(--aq-base); }
.aq__consent.is-invalid { color: #e05252; }
.aq__consent a { color: var(--aq-base-dark); }

.aq__submit {
  width: 100%; padding: 18px 24px;
  font-family: inherit; font-size: 17px; font-weight: 700; color: #fff;
  background: var(--aq-base); border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 12px 28px var(--base-shadow, rgba(239, 125, 27, .32));
  transition: background .15s, transform .15s;
}
.aq__submit:hover:not(:disabled) { background: var(--aq-base-dark); transform: translateY(-2px); }
.aq__submit:disabled { opacity: .6; cursor: default; }

/* --- Финальный экран --- */
.aq__done { text-align: center; padding: 12px 0 8px; }
.aq__done-icon {
  width: 64px; height: 64px; margin: 0 auto 20px;
  border-radius: 50%; background: var(--aq-base-soft);
  position: relative;
}
.aq__done-icon::after {
  content: ""; position: absolute; left: 21px; top: 22px;
  width: 22px; height: 11px;
  border-left: 3px solid var(--aq-base); border-bottom: 3px solid var(--aq-base);
  transform: rotate(-45deg);
}
.aq__done .aq__note { margin-bottom: 0; }
.aq__done a { color: var(--aq-base-dark); font-weight: 700; white-space: nowrap; }

@keyframes aq-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes aq-pop {
  from { opacity: 0; translate: 0 18px; scale: .97; }
  to   { opacity: 1; translate: 0 0;    scale: 1; }
}

/* --- Мобильная: модалка становится «шторкой» на весь экран --- */
@media (max-width: 560px) {
  .aq { padding: 0; align-items: flex-end; }
  .aq__box {
    width: 100%; max-height: 92vh;
    border-radius: 20px 20px 0 0;
    padding: 26px 20px 28px;
    animation: aq-sheet .3s cubic-bezier(.16, 1, .3, 1);
  }
  .aq__title { font-size: 21px; }
  .aq__option { padding: 15px 16px; font-size: 15px; }
}
@keyframes aq-sheet { from { translate: 0 100%; } to { translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .aq__overlay, .aq__box { animation: none; }
  .aq__progress-bar { transition: none; }
  .aq__option, .aq__submit { transition: none; }
}
