/* ============================================================
   КВИЗ «Рассчитать стоимость» — модалка с консультантом
   Палитра: синий #0658AF (основной), оранжевый #FF662D (action)
   ============================================================ */
:root {
  --q-blue:      #0658AF;   /* основной синий */
  --q-blue-2:    #2a86d8;   /* светлее, для градиента панели и ховера */
  --q-orange:    #FF662D;   /* брендовый action */
  --q-ink:       #1B1B1C;
  --q-muted:     #7D8489;
  --q-line:      #E2E9EE;
  --q-surface:   #F3F6F9;
  --q-radius:    14px;
}

/* ---------- overlay + dialog ---------- */
.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 11, 20, .82);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.quiz-overlay.is-open { opacity: 1; visibility: visible; }

.quiz {
  position: relative;
  display: flex;
  width: min(1040px, 100%);
  min-height: 524px;
  max-height: min(740px, 92vh);
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(11, 16, 32, .4);
  transform: translateY(16px) scale(.98);
  transition: transform .25s;
  font-family: var(--font-normal, "Inter", system-ui, sans-serif);
}
.quiz-overlay.is-open .quiz { transform: none; }
/* квиз монтируется в body (вне .pp-main) — задаём border-box, чтобы поля не вылазили */
.quiz, .quiz * { box-sizing: border-box; }

/* ---------- панель консультанта (слева) ---------- */
.quiz__aside {
  position: relative;
  flex: none;
  box-sizing: border-box;
  width: 300px;
  padding: 32px 28px 44px;   /* низ = низу контента, чтобы кнопка телефона встала на уровень «Далее» */
  color: #fff;
  /* чистый мягкий тёмно-синий градиент */
  background: linear-gradient(157deg, #1f2c4d 0%, #16213d 52%, #0e1830 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.quiz__aside::after { /* мягкий блик */
  content: "";
  position: absolute;
  right: -70px; top: -70px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%);
  pointer-events: none;
}
.quiz__consultant { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.quiz__avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  flex: none;
}
.quiz__name { font-family: var(--font-wide, sans-serif); font-size: 18px; line-height: 1.2; }
.quiz__role { font-size: 13px; color: rgba(255,255,255,.72); margin-top: 3px; }
.quiz__status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; line-height: 1; color: rgba(255,255,255,.72); margin-top: 6px; }
.quiz__status span { line-height: 1; }
.quiz__dot {
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #46d27f;
  animation: quizPulse 1.8s ease-out infinite;
}
@keyframes quizPulse {
  0%   { box-shadow: 0 0 0 0 rgba(70,210,127,.6); }
  70%  { box-shadow: 0 0 0 9px rgba(70,210,127,0); }
  100% { box-shadow: 0 0 0 0 rgba(70,210,127,0); }
}

/* реплика консультанта */
.quiz__bubble {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-left: 3px solid var(--q-blue);
  border-radius: 12px;
  padding: 15px 18px;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255,255,255,.9);
}
/* тонкая кавычка-акцент вместо «ромбика» */
.quiz__bubble::before {
  content: "“";
  position: absolute;
  top: 2px; right: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1;
  color: rgba(255,255,255,.16);
}
/* блок быстрой связи в панели консультанта */
.quiz__quick {
  margin-top: auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.16);
}
.quiz__quick-t { font-size: 13px; color: rgba(255,255,255,.72); margin-bottom: 1px; }
.quiz__wa, .quiz__call {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;   /* как у кнопки «Далее» */
  border-radius: 11px;
  text-decoration: none;
  font-family: var(--font-wide, sans-serif);
  transition: filter .15s, background .15s;
}
.quiz__wa svg, .quiz__call svg { flex: none; }
.quiz__wa {
  background: #25D366;
  color: #fff;
  font-size: 15px;
}
.quiz__wa:hover { filter: brightness(1.07); }
.quiz__call {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  font-size: 17px;
}
.quiz__call:hover { background: rgba(255,255,255,.2); }
/* шрифт только Regular — снимаем дефолтный жир у <b> */
.quiz b { font-weight: 400; }
.quiz__done p b { color: var(--q-orange); }

/* ---------- контент (справа) ---------- */
.quiz__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.quiz__head { padding: 44px 30px 0; }   /* «Шаг N» на уровне имени консультанта */
.quiz__steplabel { font-size: 13px; color: var(--q-muted); }
.quiz__progress { height: 6px; border-radius: 6px; background: var(--q-surface); margin-top: 10px; overflow: hidden; }
.quiz__progress-bar {
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--q-blue) 0%, #3a8fe0 50%, var(--q-blue) 100%);
  background-size: 200% 100%;
  animation: quizBarShine 1.8s linear infinite;
  transition: width .4s cubic-bezier(.4, 0, .2, 1);
}
@keyframes quizBarShine {
  0%   { background-position: 150% 0; }
  100% { background-position: -150% 0; }
}

.quiz__body { padding: 22px 30px; overflow-y: auto; flex: 1; }
.quiz__title {
  font-family: var(--font-wide, sans-serif);
  font-weight: 400;
  font-size: 23px;
  line-height: 1.25;
  color: var(--q-ink);
  margin: 0 0 18px;
}

/* варианты */
.quiz__options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quiz__opt {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 13px;
  border: 1.5px solid var(--q-line);
  border-radius: var(--q-radius);
  cursor: pointer;
  font-size: 15px;
  color: var(--q-ink);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.quiz__opt:hover { border-color: var(--q-blue-2); }
.quiz__opt input { position: absolute; opacity: 0; pointer-events: none; }
.quiz__tick {
  flex: none;
  width: 22px; height: 22px;
  border: 1.5px solid var(--q-line);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.quiz__opt[data-type="single"] .quiz__tick { border-radius: 50%; }
.quiz__tick svg { opacity: 0; transform: scale(.6); transition: .15s; color: #fff; }
.quiz__opt.is-checked { border-color: var(--q-blue); background: rgba(6,88,175,.06); }
.quiz__opt.is-checked .quiz__tick { background: var(--q-blue); border-color: var(--q-blue); }
.quiz__opt.is-checked .quiz__tick svg { opacity: 1; transform: scale(1); }

/* свой вариант (input под опцией) */
.quiz__custom { grid-column: 1 / -1; }
.quiz__custom input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1.5px solid var(--q-line);
  border-radius: var(--q-radius);
  font: inherit;
  font-size: 15px;
  color: var(--q-ink);
}
.quiz__custom input:focus { outline: none; border-color: var(--q-blue); }

/* форма контактов */
.quiz__form { display: grid; gap: 12px; max-width: 640px; }
.quiz__field { display: flex; flex-direction: column; gap: 6px; }
.quiz__field label { font-size: 13px; color: var(--q-muted); }
.quiz__field input {
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--q-line);
  border-radius: var(--q-radius);
  font: inherit;
  font-size: 15px;
  color: var(--q-ink);
}
.quiz__field input:focus { outline: none; border-color: var(--q-blue); }
.quiz__field.is-error input { border-color: #e6273e; }
/* согласие — чекбокс как в обычных формах (стили .rq-check из page.css) */
.quiz__consent { margin-top: 8px; font-size: 13px; }

/* ---------- footer (кнопки) ---------- */
.quiz__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 30px 44px;   /* снизу столько же, сколько сверху у контента */
  border-top: 1px solid var(--q-line);
}
.quiz__back {
  border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 17px; color: var(--q-muted);
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 4px;
}
.quiz__back:hover { color: var(--q-ink); }
.quiz__back[hidden] { visibility: hidden; }
.quiz__next {
  display: inline-flex; align-items: center; gap: 9px;
  height: 52px; padding: 0 28px;
  background: var(--q-orange);
  border: 0; border-radius: 10px;
  font-family: var(--font-wide, sans-serif); font-size: 17px;
  color: #fff; cursor: pointer;
  transition: background .15s, transform .1s, opacity .15s;
}
.quiz__next:hover { background: #e85620; }
.quiz__next:active { transform: translateY(1px); }
.quiz__next:disabled { opacity: .45; cursor: not-allowed; }

/* close */
.quiz__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 38px; height: 38px;
  border: 0; border-radius: 10px;
  background: rgba(255,255,255,.9);
  cursor: pointer; z-index: 5;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--q-ink);
  transition: background .15s;
}
.quiz__close:hover { background: #fff; }

/* ---------- финальный экран ---------- */
.quiz__done { text-align: center; padding: 14px 10px; max-width: 520px; margin: 0 auto; }
.quiz__done-ic {
  width: 76px; height: 76px; margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(70,210,127,.14);
  display: flex; align-items: center; justify-content: center;
  color: #2bb673;
}
.quiz__done h3 { font-family: var(--font-wide, sans-serif); font-weight: 400; font-size: 26px; margin: 0 0 12px; color: var(--q-ink); }
.quiz__done p { font-size: 15px; line-height: 1.55; color: #4a5157; margin: 0 0 18px; }
.quiz__ticket {
  display: inline-flex; flex-direction: column; gap: 4px;
  padding: 16px 28px; margin-bottom: 18px;
  background: rgba(6,88,175,.06);
  border: 1.5px dashed var(--q-blue);
  border-radius: 14px;
}
.quiz__ticket b { font-family: var(--font-wide, sans-serif); font-size: 22px; color: var(--q-blue); }
.quiz__ticket span { font-size: 13px; color: var(--q-muted); }
.quiz__badge {
  display: inline-block;
  background: var(--q-orange); color: #fff;
  font-family: var(--font-wide, sans-serif); font-size: 14px;
  padding: 7px 16px; border-radius: 999px; margin-bottom: 6px;
}

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 780px) {
  .quiz-overlay { padding: 0; }
  .quiz {
    flex-direction: column;
    width: 100%;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
  }
  .quiz__aside {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
  }
  .quiz__avatar { width: 52px; height: 52px; }
  .quiz__bubble, .quiz__status, .quiz__quick { display: none; }
  .quiz__options { grid-template-columns: 1fr; }
  .quiz__title { font-size: 20px; }
  .quiz__body { padding: 18px 18px; }
  .quiz__head { padding: 18px 18px 0; }
  .quiz__foot { padding: 14px 18px; }
}

/* неактивная кнопка «Далее/Получить» + подсветка полей при клике */
.quiz__next.is-inactive { opacity: .45; }
.quiz__field.is-error input { border-color: #e6273e; box-shadow: 0 0 0 3px rgba(230, 39, 62, .13); }
.quiz__consent.is-error .rq-box { border-color: #e6273e; box-shadow: 0 0 0 3px rgba(230, 39, 62, .13); }
.quiz__field.is-error[data-hint]::after, .quiz__consent.is-error[data-hint]::after {
  content: attr(data-hint); display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.3; color: #e6273e;
}

/* ============================================================
   Открытый (inline) квиз на странице — не модалка
   ============================================================ */
.quiz.quiz--inline {
  width: 100%;
  max-width: none;
  max-height: none;
  min-height: 500px;
  transform: none;
  box-shadow: 0 16px 50px rgba(11, 16, 32, .10);
  border: 1px solid #e8edf3;
}
@media (max-width: 780px) {
  .quiz.quiz--inline { height: auto; max-height: none; border-radius: 16px; }
}
