/*
 * Квиз-расчёт: модалка на страницах и встроенный вариант на /calc.
 * Разметка: resources/views/common/_quiz.blade.php, логика: public/js/redesign/quiz.js.
 * Общие элементы формы (.lf-form__btn, .lf-form__note, .lf-form__success)
 * берутся из cta.css — он подключён в layout выше.
 */

.lf-quiz {
    position: fixed;
    inset: 0;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lf-quiz[hidden] {
    display: none;
}

.lf-quiz__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 8, 0.76);
    opacity: 0;
    transition: opacity .25s ease;
}

.lf-quiz__card {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 40px;
    border-radius: 20px;
    background: #FFF;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .25s ease, transform .25s ease;
}

.lf-quiz.is-visible .lf-quiz__backdrop {
    opacity: 1;
}

.lf-quiz.is-visible .lf-quiz__card {
    opacity: 1;
    transform: translateY(0);
}

/* Встроенный вариант на странице /calc */
.lf-quiz--inline {
    position: static;
    padding: 0;
    display: block;
}

.lf-quiz--inline .lf-quiz__card {
    max-width: none;
    max-height: none;
    overflow: visible;
    opacity: 1;
    transform: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.lf-quiz__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F1EFEE;
    color: #6E6866;
}

.lf-quiz__close:hover {
    background: #E4E1E0;
    color: #332F2E;
}

/* ─── Прогресс ───────────────────────────────────────────────────────────── */

.lf-quiz__progress {
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

.lf-quiz__progress-bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: #0CB4CE;
    transition: width .3s ease;
}

.lf-quiz__counter {
    margin-top: 10px;
    color: #A8A3A1;
    font-size: 13px;
    font-weight: 500;
}

/* ─── Шаг ────────────────────────────────────────────────────────────────── */

.lf-quiz__question {
    margin-top: 14px;
    color: #332F2E;
    font-size: 26px;
    font-weight: 600;
    line-height: 118%;
    letter-spacing: -0.5px;
    padding-right: 40px;
}

.lf-quiz__hint {
    margin-top: 10px;
    color: #7A7472;
    font-size: 15px;
    line-height: 140%;
}

.lf-quiz__options {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lf-quiz__option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px 18px;
    border: 1px solid #DEDBD9;
    border-radius: 12px;
    background: #FFF;
    color: #332F2E;
    font-size: 16px;
    line-height: 130%;
    text-align: left;
    transition: border-color .15s ease, background .15s ease;
}

.lf-quiz__option:hover {
    border-color: #0CB4CE;
    background: rgba(12, 180, 206, 0.04);
}

.lf-quiz__option-mark {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 2px solid #D4D4D4;
    border-radius: 50%;
    transition: border-color .15s ease, background .15s ease;
}

.lf-quiz__option.is-selected {
    border-color: #0CB4CE;
    background: rgba(12, 180, 206, 0.07);
}

.lf-quiz__option.is-selected .lf-quiz__option-mark {
    border-color: #0CB4CE;
    background: #0CB4CE url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8' fill='none'%3E%3Cpath d='M1 4L3.5 6.5L9 1' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat;
}

.lf-quiz__nav {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lf-quiz__back {
    color: #A8A3A1;
    font-size: 15px;
    font-weight: 500;
}

.lf-quiz__back:hover {
    color: #332F2E;
}

.lf-quiz__next {
    margin-left: auto;
    height: 48px;
    padding: 0 28px;
    border-radius: 10px;
    background: #0CB4CE;
    color: #FFF;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
}

.lf-quiz__next:hover:not(:disabled) {
    background: #20C8E2;
}

.lf-quiz__next:disabled {
    background: #D9D6D4;
    cursor: not-allowed;
}

/* ─── Результат ──────────────────────────────────────────────────────────── */

.lf-quiz__result-label {
    margin-top: 18px;
    color: #A8A3A1;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lf-quiz__items {
    margin-top: 12px;
    list-style: none;
    border: 1px solid #E7E4E2;
    border-radius: 12px;
    overflow: hidden;
}

.lf-quiz__items li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #F0EEEC;
    color: #332F2E;
    font-size: 15px;
    line-height: 130%;
}

.lf-quiz__items li:last-child {
    border-bottom: none;
}

.lf-quiz__items b {
    flex: 0 0 auto;
    color: #0CB4CE;
    white-space: nowrap;
}

.lf-quiz__weeks {
    margin-top: 14px;
    color: #5F5A58;
    font-size: 15px;
}

.lf-quiz__weeks strong {
    color: #332F2E;
}

.lf-quiz__bonus {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(12, 180, 206, 0.35);
    border-radius: 12px;
    background: rgba(12, 180, 206, 0.06);
    color: #5F5A58;
    font-size: 14px;
    line-height: 145%;
}

.lf-quiz__bonus strong {
    color: #332F2E;
    font-size: 15px;
}

.lf-quiz__bonus-icon {
    flex: 0 0 auto;
    font-size: 20px;
    line-height: 1.2;
}

.lf-quiz__form {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid #EFEDEB;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lf-quiz__form-title {
    color: #332F2E;
    font-size: 17px;
    font-weight: 600;
}

.lf-quiz__form input[type="text"],
.lf-quiz__form input[type="tel"] {
    height: 56px;
    padding: 0 16px;
    border: 1px solid #D4D4D4;
    border-radius: 8px;
    background: #FFF;
    color: #332F2E;
    font-size: 17px;
    transition: border-color .15s ease;
}

.lf-quiz__form input::placeholder {
    color: #B5B5B5;
}

.lf-quiz__form input:focus {
    border-color: #0CB4CE;
}

.lf-quiz__form input.has-error {
    border-color: #E5484D;
}

/* ─── Плавающая кнопка расчёта ───────────────────────────────────────────── */

/*
 * Стоит над телеграм-плашкой из футера (.telegram-tag, bottom: 50px):
 * та же геометрия, но заливка акцентом — иначе две плашки сливаются в одну.
 */
.lf-quiz-fab {
    position: fixed;
    right: 24px;
    bottom: 104px;
    z-index: 11;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border: 1px solid rgba(12, 180, 206, 0.9);
    border-radius: 4px;
    background: #0CB4CE;
    color: #FFF;
    font-size: 16px;
    line-height: 100%;
    box-shadow: 0 8px 24px rgba(12, 180, 206, 0.28);
    transition: right .3s ease-in-out, bottom .25s ease, background .15s ease, opacity .2s ease;
}

.lf-quiz-fab:hover {
    background: #20C8E2;
}

/* Пока открыта модалка — кнопка не мозолит глаза поверх подложки */
body.lf-popup-open .lf-quiz-fab {
    opacity: 0;
    pointer-events: none;
}

/* Телеграм-плашка прячется вместе с шапкой при просмотре панорам — уводим и кнопку */
.telegram-tag.hidden ~ .lf-quiz-fab,
.header-block.hidden ~ .lf-quiz-fab {
    right: -280px;
}

/* ─── Страница /calc ─────────────────────────────────────────────────────── */

.lf-quiz-page {
    padding: 70px 30px 90px;
    background: #1D1918;
}

.lf-quiz-page__content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 620px);
    gap: 60px;
    align-items: start;
}

.lf-quiz-page__title {
    margin-top: 18px;
    color: #FFF;
    font-size: 42px;
    font-weight: 500;
    line-height: 110%;
    letter-spacing: -1px;
}

.lf-quiz-page__text {
    margin-top: 18px;
    color: #B5B0AE;
    font-size: 18px;
    line-height: 150%;
}

/* ─── Адаптив ────────────────────────────────────────────────────────────── */

@media (min-width: 990px) and (max-width: 1439px) {
    .lf-quiz-page__content {
        gap: 40px;
    }

    .lf-quiz-page__title {
        font-size: 34px;
    }
}

@media (max-width: 989px) {
    .lf-quiz {
        padding: 12px;
    }

    .lf-quiz__card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .lf-quiz__question {
        font-size: 21px;
    }

    .lf-quiz__hint {
        font-size: 14px;
    }

    .lf-quiz__option {
        padding: 14px 14px;
        font-size: 15px;
    }

    .lf-quiz__form input[type="text"],
    .lf-quiz__form input[type="tel"] {
        height: 52px;
        font-size: 16px;
    }

    .lf-quiz-page {
        padding: 40px 15px 60px;
    }

    .lf-quiz-page__content {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .lf-quiz-page__title {
        font-size: 26px;
        letter-spacing: -0.5px;
    }

    .lf-quiz-page__text {
        font-size: 16px;
    }

    /*
     * На мобильных внизу и так тесно: телеграм-плашка + липкая панель.
     * Кнопка сжимается до кружка, а когда появляется липкая панель со своим CTA —
     * убирается совсем, чтобы не спорить с ней за один и тот же клик.
     */
    .lf-quiz-fab {
        right: 16px;
        bottom: 96px;
        padding: 12px;
        border-radius: 50%;
    }

    .lf-quiz-fab span {
        display: none;
    }

    body.lf-has-sticky .lf-quiz-fab {
        opacity: 0;
        pointer-events: none;
    }
}
