/* ══════════════════════════════════════════════════════════════
   calc4.css — стили квиз-формы для /расчет4/
   Scoped to .page-calc4 — НЕ затрагивает /расчет/, /расчет2/, /расчет3/.
   Тело страницы имеет ОБА класса: .page-calc4 .page-calc3 — это
   позволяет наследовать базовые стили формы из calc3.css (form-card,
   form-input, btn-calculate и т.д.) и переопределять только то, что
   нужно для квиза.
   ══════════════════════════════════════════════════════════════ */

/* ── Hero / заголовок страницы ── */
.page-calc4 .page-title-block {
    text-align: center;
    margin-bottom: 1.4rem;
}
.page-calc4 .page-eyebrow {
    display: inline-block;
    padding: .35rem .9rem;
    background: rgba(212, 165, 74, .08);
    border: 1px solid rgba(212, 165, 74, .25);
    border-radius: 999px;
    color: var(--gold, #d4a54a);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 1rem;
    /* Сбрасываем градиентный clip из базового .page-eyebrow в style.css,
       иначе текст рендерится прозрачным поверх пилюли. */
    -webkit-background-clip: border-box;
            background-clip: border-box;
    -webkit-text-fill-color: var(--gold, #d4a54a);
}
.page-calc4 .page-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 400;
    line-height: 1.1;
    color: rgba(255, 255, 255, .95);
    margin: 0 0 .8rem;
}
.page-calc4 .page-title em {
    font-style: italic;
    color: var(--gold, #d4a54a);
}
.page-calc4 .page-desc {
    font-size: .98rem;
    color: rgba(255, 255, 255, .65);
    line-height: 1.55;
    max-width: 540px;
    margin: 0 auto;
}

/* ── Прячем дефолтный steps-indicator во время квиза ── */
.page-calc4 .steps-indicator {
    opacity: 0;
    pointer-events: none;
    height: 0;
    overflow: hidden;
    margin: 0;
}
.page-calc4 .steps-indicator.calc-mode {
    opacity: 1;
    pointer-events: auto;
    height: auto;
    margin: 1.2rem 0 1.6rem;
    transition: opacity .4s ease;
}

/* ══ Прогресс квиза ══ */
.quiz-progress {
    max-width: 520px;
    margin: 0 auto 1.6rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.quiz-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Nunito Sans', sans-serif;
    font-size: .76rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
}
.quiz-progress-meta strong {
    color: var(--gold, #d4a54a);
    font-weight: 600;
}
.quiz-progress-bar {
    height: 4px;
    background: rgba(212, 165, 74, .12);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.quiz-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 25%;
    background: linear-gradient(90deg, var(--gold, #d4a54a), var(--orchid, #b07acb));
    border-radius: 999px;
    transition: width .55s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 0 16px rgba(212, 165, 74, .4);
}
/* progress dots удалены — оставлена только тонкая полоса прогресса */

/* ══ Карточка квиза ══ */
.page-calc4 .quiz-card {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
    padding: 2.2rem 2.2rem 2rem;
    background: linear-gradient(180deg, rgb(28, 22, 46), rgb(20, 16, 36));
    border: 1px solid rgba(212, 165, 74, .22);
    border-radius: 22px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, .55),
        inset 0 1px 0 rgba(255, 255, 255, .04);
    /* БЕЗ overflow:hidden и БЕЗ backdrop-filter —
       оба свойства создают painting/clipping-контекст в WebKit
       и удерживают абсолютные потомки (city-suggestions) внутри
       визуальных границ карточки. */
}
.page-calc4 .quiz-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 0% 0%, rgba(212, 165, 74, .18), transparent 38%),
        radial-gradient(circle at 100% 100%, rgba(176, 122, 203, .14), transparent 40%);
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}

/* Каждый шаг — поверх остальных, переключаются JS-логикой */
.quiz-step {
    display: none;
    position: relative;
    z-index: 1;
    animation: quizStepIn .5s cubic-bezier(.32, .72, .35, 1);
}
.quiz-step.active { display: block; }
.quiz-step.back-anim { animation: quizStepInBack .5s cubic-bezier(.32, .72, .35, 1); }

@keyframes quizStepIn {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes quizStepInBack {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Иконка-символ шага ── */
.quiz-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 165, 74, .22), rgba(212, 165, 74, .04) 70%);
    border: 1px solid rgba(212, 165, 74, .35);
    color: var(--gold, #d4a54a);
    font-size: 1.6rem;
    line-height: 1;
    box-shadow: 0 0 28px rgba(212, 165, 74, .18);
}

.quiz-step-num {
    text-align: center;
    font-family: 'Nunito Sans', sans-serif;
    font-size: .7rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .42);
    margin-bottom: .4rem;
}
.quiz-step-num strong {
    color: var(--gold, #d4a54a);
    font-weight: 600;
    margin: 0 .25rem;
}

.quiz-question {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.6rem, 3.4vw, 2rem);
    font-weight: 400;
    text-align: center;
    color: rgba(255, 255, 255, .96);
    line-height: 1.2;
    margin: 0 0 .6rem;
}
.quiz-question em {
    font-style: italic;
    color: var(--gold, #d4a54a);
}
.quiz-helper {
    text-align: center;
    color: rgba(255, 255, 255, .55);
    font-size: .9rem;
    line-height: 1.5;
    margin: 0 auto 1.6rem;
    max-width: 420px;
}

/* ══ Поля внутри квиза (override styles to be vertical, full-width) ══ */
.page-calc4 .quiz-field {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin: 0 auto 1.4rem;
    max-width: 380px;
    position: relative;
}
.page-calc4 .quiz-field .form-label {
    font-family: 'Nunito Sans', sans-serif;
    font-size: .7rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
    font-weight: 500;
}
.page-calc4 .quiz-field .form-label span {
    color: rgba(255, 255, 255, .35);
    font-size: .62rem;
    letter-spacing: .1em;
    text-transform: none;
    font-weight: 300;
    margin-left: .4rem;
}

.page-calc4 .quiz-field .form-input {
    width: 100%;
    padding: .95rem 1.1rem;
    background: rgba(8, 5, 16, .55);
    border: 1px solid rgba(212, 165, 74, .25);
    border-radius: 12px;
    color: rgba(255, 255, 255, .95);
    font-family: 'Nunito Sans', sans-serif;
    font-size: 1rem;
    text-align: center;
    letter-spacing: .04em;
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.page-calc4 .quiz-field .form-input:focus {
    outline: none;
    border-color: rgba(212, 165, 74, .65);
    background: rgba(8, 5, 16, .8);
    box-shadow: 0 0 0 4px rgba(212, 165, 74, .12);
}
.page-calc4 .quiz-field .form-input::placeholder {
    color: rgba(255, 255, 255, .3);
    text-align: center;
}
.page-calc4 .quiz-field.has-error .form-input {
    border-color: rgba(224, 96, 128, .6);
    box-shadow: 0 0 0 4px rgba(224, 96, 128, .1);
}
.page-calc4 .quiz-field .form-error {
    display: none;
    color: rgba(224, 96, 128, .9);
    font-size: .78rem;
    text-align: center;
    margin-top: .2rem;
}
.page-calc4 .quiz-field.has-error .form-error { display: block; }

/* ── Иконки calendar/clock в полях даты/времени (только на мобильных) ── */
.page-calc4 .quiz-field .input-with-icon { position: relative; }
.page-calc4 .quiz-field .input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(212, 165, 74, .65);
    pointer-events: none;
    width: 18px;
    height: 18px;
}
.page-calc4 .quiz-field .input-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Стилизованный «toggle-pill» для «не знаю точное время» ── */
.quiz-checkbox-wrap {
    text-align: center;
    margin: -.4rem 0 1.2rem;
}
.quiz-checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem 1.1rem .5rem .9rem;
    font-family: 'Nunito Sans', sans-serif;
    font-size: .82rem;
    color: rgba(255, 255, 255, .65);
    background: rgba(212, 165, 74, .04);
    border: 1px solid rgba(212, 165, 74, .22);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    transition: background .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}
.quiz-checkbox-row:hover {
    background: rgba(212, 165, 74, .09);
    border-color: rgba(212, 165, 74, .4);
    color: rgba(255, 255, 255, .92);
}
/* Кастомный «квадратик» вместо нативного чекбокса — стиль сайта */
.quiz-checkbox-row input {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid rgba(212, 165, 74, .55);
    background: transparent;
    cursor: pointer;
    margin: 0;
    position: relative;
    transition: background .2s ease, border-color .2s ease;
    flex-shrink: 0;
}
.quiz-checkbox-row input:checked {
    background: var(--gold, #d4a54a);
    border-color: var(--gold, #d4a54a);
}
.quiz-checkbox-row input:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: solid #14101f;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.quiz-checkbox-row:has(input:checked) {
    background: rgba(212, 165, 74, .14);
    border-color: rgba(212, 165, 74, .55);
    color: var(--gold, #d4a54a);
    box-shadow: 0 0 0 4px rgba(212, 165, 74, .08);
}

/* ── Подсказки/трасты под полем ── */
/* Иконка идёт inline вместе с текстом — при wrap не уезжает влево */
.quiz-trust {
    display: block;
    text-align: center;
    font-family: 'Nunito Sans', sans-serif;
    font-size: .78rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, .48);
    margin: -.2rem auto 1.4rem;
    max-width: 420px;
}
.quiz-trust .trust-icon {
    color: var(--gold, #d4a54a);
    margin-right: .35rem;
    font-size: .85em;
    vertical-align: baseline;
}

/* ══ Городские саджесты (переопределяем для квиза) ══ */
.page-calc4 .quiz-field .city-wrapper { position: relative; }
.page-calc4 .quiz-field .city-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(60vh, 360px);
    overflow-y: auto;
    background: #14101f;
    border: 1px solid rgba(212, 165, 74, .45);
    border-radius: 14px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, .7),
        0 0 0 1px rgba(0, 0, 0, .4),
        0 0 32px rgba(212, 165, 74, .08);
    z-index: 200;
    display: none;
}
.page-calc4 .quiz-field .city-suggestions.above {
    top: auto;
    bottom: calc(100% + 4px);
}
.page-calc4 .quiz-field .city-suggestion {
    padding: .7rem 1rem;
    color: rgba(255, 255, 255, .85);
    font-size: .9rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    text-align: left;
    transition: background .15s ease;
}
.page-calc4 .quiz-field .city-suggestion:last-child { border-bottom: 0; }
.page-calc4 .quiz-field .city-suggestion:hover { background: rgba(212, 165, 74, .1); }
.page-calc4 .quiz-field .city-country {
    display: block;
    font-size: .72rem;
    color: rgba(255, 255, 255, .42);
    margin-top: .15rem;
}

/* ══ Финальный шаг — сводка перед запуском расчёта ══ */
.quiz-summary {
    background: rgba(8, 5, 16, .45);
    border: 1px solid rgba(212, 165, 74, .18);
    border-radius: 14px;
    padding: 1.2rem 1.3rem;
    margin: 0 auto 1.4rem;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: .65rem;
}
.quiz-summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    font-family: 'Nunito Sans', sans-serif;
    font-size: .92rem;
    color: rgba(255, 255, 255, .85);
}
.quiz-summary-row .quiz-summary-label {
    color: rgba(255, 255, 255, .5);
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.quiz-summary-row .quiz-summary-val {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    color: var(--gold, #d4a54a);
    text-align: right;
    word-break: break-word;
}
.quiz-summary-row .quiz-summary-edit {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, .35);
    cursor: pointer;
    font-size: .72rem;
    margin-left: .4rem;
    padding: .15rem .35rem;
    border-radius: 6px;
    transition: color .2s ease, background .2s ease;
}
.quiz-summary-row .quiz-summary-edit:hover {
    color: var(--gold, #d4a54a);
    background: rgba(212, 165, 74, .08);
}

/* ══ Навигация: назад / далее / submit ══ */
.quiz-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .4rem;
    position: relative;
    z-index: 1;
}
.quiz-back {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, .5);
    font-family: 'Nunito Sans', sans-serif;
    font-size: .85rem;
    padding: .6rem .8rem;
    cursor: pointer;
    transition: color .2s ease;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.quiz-back:hover { color: var(--gold, #d4a54a); }
.quiz-back[disabled] {
    visibility: hidden;
    pointer-events: none;
}

/* Шаг 1: «Назад» отсутствует, «Далее» центрируем */
.quiz-step[data-step="1"] .quiz-nav { justify-content: center; }
.quiz-step[data-step="1"] .quiz-back { display: none; }

.quiz-next {
    flex: 1 1 auto;
    max-width: 280px;
    padding: 1rem 1.6rem;
    background: linear-gradient(135deg, var(--gold, #d4a54a) 0%, #f0cd7a 100%);
    color: var(--deep, #1a0f2e);
    border: 0;
    border-radius: 12px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: .92rem;
    font-weight: 600;
    letter-spacing: .06em;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease, opacity .25s ease;
    box-shadow: 0 8px 28px rgba(212, 165, 74, .28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}
.quiz-next:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(212, 165, 74, .42);
}
.quiz-next:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}
.quiz-next .quiz-arrow {
    font-size: 1.05rem;
    line-height: 1;
    margin-left: .15rem;
}
.quiz-next.quiz-submit {
    background: linear-gradient(135deg, var(--gold, #d4a54a) 0%, var(--orchid, #b07acb) 100%);
    box-shadow: 0 12px 40px rgba(176, 122, 203, .35);
    max-width: 320px;
    font-size: .95rem;
}
.quiz-next.quiz-submit:hover:not(:disabled) {
    box-shadow: 0 18px 56px rgba(176, 122, 203, .5);
}

.quiz-next .quiz-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(8, 5, 16, .25);
    border-top-color: var(--deep, #1a0f2e);
    border-radius: 50%;
    animation: quizSpin .8s linear infinite;
}
.quiz-next.loading .quiz-spinner { display: inline-block; }
.quiz-next.loading .quiz-next-text { opacity: .7; }
@keyframes quizSpin { to { transform: rotate(360deg); } }

/* ══ Подвал-социалка под карточкой ══ */
.quiz-footnote {
    text-align: center;
    margin-top: 1.4rem;
    font-family: 'Nunito Sans', sans-serif;
    font-size: .78rem;
    color: rgba(255, 255, 255, .42);
    line-height: 1.6;
}
.quiz-footnote .quiz-foot-stars {
    color: var(--gold, #d4a54a);
    letter-spacing: .08em;
}
.quiz-foot-row {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
    justify-content: center;
}
.quiz-foot-people {
    display: inline-flex;
    align-items: center;
}
.qfp-bubble {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #14101f;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
    background: #14101f;
    flex-shrink: 0;
    /* Заставляем браузер создать слой композитинга — гарантирует, что
       overflow:hidden корректно клипает дочерний <img> по радиусу
       (фикс для Safari/iOS, где inline-block иногда не обрезает). */
    transform: translateZ(0);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}
.qfp-bubble + .qfp-bubble { margin-left: -10px; }
.qfp-bubble img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%; /* двойная гарантия круглой формы */
}
@media (max-width: 600px){
    .qfp-bubble { width: 26px; height: 26px; }
    .qfp-bubble + .qfp-bubble { margin-left: -8px; }
}

/* ══ Прячем дефолтные элементы расчет3, не нужные на квизе ══ */
.page-calc4 .calc-tabs,
.page-calc4 .form-card,
.page-calc4 #compatResultBlock,
.page-calc4 .seo-blocks {
    display: none !important;
}
/* После расчёта — показываем стандартный resultBlock и upgradeBlock как обычно */
.page-calc4 .form-compact { /* совместимость со старыми скриптами */ display: none; }

/* ══ После запуска расчёта — карточка квиза прячется, дальше идёт обычный результат ══ */
.page-calc4.calc-running .quiz-card,
.page-calc4.calc-running .quiz-progress,
.page-calc4.calc-running .quiz-footnote {
    display: none;
}
.page-calc4.calc-running .page-title-block { display: none; }

/* ══ Mobile ══ */
@media (max-width: 600px) {
    .page-calc4 .main { padding-top: 4.5rem; padding-left: 1rem; padding-right: 1rem; }
    .page-calc4 .quiz-card { padding: 1.6rem 1.2rem 1.4rem; border-radius: 18px; }
    .quiz-step-icon { width: 54px; height: 54px; font-size: 1.4rem; }
    .quiz-question { font-size: 1.45rem; }
    .quiz-helper { font-size: .85rem; }
    .page-calc4 .quiz-field .form-input { font-size: .95rem; padding: .85rem 1rem; }
    .quiz-next { padding: .9rem 1.2rem; font-size: .88rem; max-width: none; }
    .quiz-summary { padding: 1rem 1rem; }
    .quiz-summary-row { flex-direction: column; align-items: flex-start; gap: .15rem; }
    .quiz-summary-row .quiz-summary-val { text-align: left; font-size: 1rem; }
    .quiz-progress { margin-bottom: 1.2rem; }
    .page-calc4 .quiz-field .input-icon { display: block; }
}

/* На ПК — иконки calendar/clock скрываем (нативные picker'ы только на мобильных) */
@media (min-width: 601px) {
    .page-calc4 .quiz-field .input-icon { display: none; }
}
