/* Квиз — пошаговый опрос со сбором заявки. */

.quiz {
    --quiz-blue: #0e55b1;
    --quiz-blue-dark: #0c4590;
    --quiz-ink: #161616;
    --quiz-muted: #5a6270;
    --quiz-card: #e5ecf3;
    --quiz-aside: #c2d6f2;
    --quiz-line: #cdd8e8;
    --quiz-green: #16b00e;
    --quiz-danger: #d23b3b;
    padding: 60px 0;
    font-family: "Montserrat", sans-serif;
}

.quiz__card {
    background: var(--quiz-card);
    border-radius: 32px;
    padding: 48px 48px 52px;
}

.quiz__card:has(.quiz__step--final.is-active) {
    padding-bottom: 48px;
}

/* Прогресс */
.quiz__progress {
    height: 6px;
    width: 100%;
    background: rgba(14, 85, 177, 0.12);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 36px;
}

.quiz__progress-bar {
    display: block;
    height: 100%;
    width: 12.5%;
    background: var(--quiz-blue);
    border-radius: 999px;
    transition: width 0.35s ease;
}

/* Шаг */
.quiz__step {
    display: none;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.quiz__step.is-active {
    display: grid;
}

.quiz__main {
    min-width: 0;
}

.quiz__title {
    margin: 0 0 26px;
    color: var(--quiz-ink);
    font-size: 38px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

/* Варианты ответов */
.quiz__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.quiz__option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quiz__option:hover {
    box-shadow: 0 6px 18px rgba(14, 85, 177, 0.08);
}

.quiz__option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.quiz__option-mark {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid #c3d0e0;
    border-radius: 50%;
    position: relative;
    transition: border-color 0.2s ease;
}

.quiz__option-mark::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--quiz-blue);
    transform: scale(0);
    transition: transform 0.18s ease;
}

.quiz__option input:checked + .quiz__option-mark {
    border-color: var(--quiz-blue);
}

.quiz__option input:checked + .quiz__option-mark::after {
    transform: scale(1);
}

.quiz__option.is-selected,
.quiz__option:has(input:checked) {
    border-color: var(--quiz-blue);
}

.quiz__option-text {
    color: var(--quiz-ink);
    font-size: 16px;
    line-height: 1.35;
}

/* Навигация */
.quiz__nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: center;
    margin-top: 34px;
}

.quiz__back {
    grid-column: 1;
    justify-self: center;
    background: none;
    border: none;
    padding: 12px 8px;
    color: var(--quiz-blue);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.quiz__back:hover {
    color: var(--quiz-blue-dark);
}

.quiz__next,
.quiz__submit {
    background: var(--quiz-blue);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.quiz__next {
    grid-column: 2;
    width: 100%;
    min-width: 0;
    padding: 19px 40px;
    font-size: 17px;
}

.quiz__next:hover,
.quiz__submit:hover {
    background: var(--quiz-blue-dark);
}

.quiz__error {
    margin-top: 20px;
    color: var(--quiz-danger);
    font-size: 15px;
    font-weight: 600;
}

/* Сайдбар со специалистом */
.quiz__aside {
    background: var(--quiz-aside);
    border-radius: 24px;
    padding: 26px 24px;
}

.quiz__specialist {
    display: flex;
    align-items: center;
    gap: 14px;
}

.quiz__specialist-photo {
    flex-shrink: 0;
    width: 58px;
    height: 58px;
    border-radius: 14px;
    overflow: hidden;
}

.quiz__specialist-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    -webkit-transform: scale(1.5) translate(-3%, 14%);
    transform: scale(1.5) translate(-3%, 14%);
    display: block;
}

.quiz__specialist-name {
    color: var(--quiz-ink);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.15;
}

.quiz__specialist-role {
    margin-top: 4px;
    color: var(--quiz-muted);
    font-size: 13px;
    line-height: 1.3;
}

.quiz__note {
    margin-top: 20px;
    background: #ffffff;
    border-radius: 16px;
    padding: 18px 20px;
}

.quiz__note p {
    margin: 0;
    color: var(--quiz-ink);
    font-size: 15px;
    line-height: 1.5;
}

.quiz__note p + p {
    margin-top: 14px;
}

/* Финальный шаг */
.quiz__title--final {
    margin-bottom: 20px;
}

.quiz__lead {
    margin: 0 0 14px;
    color: var(--quiz-ink);
    font-size: 18px;
    line-height: 1.4;
}

.quiz__subtext {
    margin: 0 0 26px;
    color: var(--quiz-muted);
    font-size: 15px;
    line-height: 1.45;
}

.quiz__field-label {
    color: var(--quiz-muted);
    font-size: 14px;
    margin-bottom: 12px;
}

.quiz__contact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.quiz__option--inline {
    padding: 16px 18px;
}

.quiz__inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.quiz__input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--quiz-line);
    border-radius: 12px;
    padding: 17px 18px;
    font-family: inherit;
    font-size: 16px;
    color: var(--quiz-ink);
}

.quiz__input::placeholder {
    color: #9ea2ae;
}

.quiz__input:focus {
    outline: none;
    border-color: var(--quiz-blue);
}

.quiz__submit {
    width: 100%;
    margin-top: 16px;
    padding: 19px;
    font-size: 17px;
}

.quiz__nav--final {
    display: flex;
    justify-content: flex-start;
    margin-top: 18px;
}

.quiz__nav--final .quiz__back {
    position: static;
}

.quiz__agree {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    cursor: pointer;
}

.quiz__agree input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.quiz__agree-mark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #b6c6dd;
    border-radius: 6px;
    background: #ffffff;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.quiz__agree-mark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.18s ease;
}

.quiz__agree input:checked + .quiz__agree-mark {
    background: var(--quiz-blue);
    border-color: var(--quiz-blue);
}

.quiz__agree input:checked + .quiz__agree-mark::after {
    transform: rotate(45deg) scale(1);
}

.quiz__agree-text {
    color: var(--quiz-muted);
    font-size: 13px;
    line-height: 1.4;
}

.quiz__agree-text a {
    color: var(--quiz-blue);
    text-decoration: underline;
}

.quiz__status {
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.4;
    min-height: 1em;
}

.quiz__step--final .quiz__status:empty {
    display: none;
}

.quiz__status--error {
    color: var(--quiz-danger);
    font-weight: 600;
}

.quiz__status--success {
    color: var(--quiz-green);
    font-weight: 600;
}

/* Сайдбар-фото на финале */
.quiz__aside--photo {
    padding: 0;
    overflow: hidden;
    align-self: stretch;
}

.quiz__aside--photo img {
    width: 100%;
    height: calc(100% - 31px);
    object-fit: cover;
    display: block;
}

/* Планшет */
@media (max-width: 1024px) {
    .quiz__title {
        font-size: 32px;
    }

    .quiz__card {
        padding: 36px 32px 40px;
    }
}

/* Мобайл — одна колонка */
@media (max-width: 768px) {
    .quiz {
        padding: 32px 0;
    }

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

    .quiz__step.is-active {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .quiz__title {
        font-size: 25px;
        margin-bottom: 20px;
    }

    .quiz__options {
        grid-template-columns: 1fr;
    }

    .quiz__contact,
    .quiz__inputs {
        grid-template-columns: 1fr;
    }

    .quiz__nav {
        display: flex;
        flex-direction: column-reverse;
        gap: 14px;
        margin-top: 26px;
    }

    .quiz__back {
        position: static;
    }

    .quiz__next {
        width: 100%;
        min-width: 0;
    }

    .quiz__aside--photo img {
        min-height: 260px;
    }
}

/* --- Квиз-модалка (открывается кнопкой на главной) --- */
.quiz__modal {
    /* Переменные квиза заданы на .quiz (страница /kviz/); в модалке обёртки .quiz нет —
       дублируем, иначе фон карточки и цвета пустые (страница просвечивает). */
    --quiz-blue: #0e55b1;
    --quiz-blue-dark: #0c4590;
    --quiz-ink: #161616;
    --quiz-muted: #5a6270;
    --quiz-card: #e5ecf3;
    --quiz-aside: #c2d6f2;
    --quiz-line: #cdd8e8;
    --quiz-green: #16b00e;
    --quiz-danger: #d23b3b;
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 56px 16px 40px;
    overflow-y: auto;
    background: rgba(11, 22, 42, 0.72);
}

.quiz__modal.is-open {
    display: flex;
}

.quiz__modal-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
}

.quiz__modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1352px;
    margin: auto;
}

.quiz__modal-inner .quiz__card {
    margin: 0;
}

.quiz__modal-close {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #161616;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease;
}

.quiz__modal-close:hover {
    transform: scale(1.06);
}

@media (max-width: 768px) {
    .quiz__modal {
        padding: 48px 8px 20px;
    }

    .quiz__modal-close {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
        font-size: 26px;
    }
}
