/* =========================================================
   Кнопка запуска квиза
========================================================= */

.tm-quiz-launch {
    margin: 25px 0;
    text-align: left;
}

.tm-quiz-launch__btn {
    background: #D12C24;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .18);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.tm-quiz-launch__btn:hover {
    background: #b42520;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .22);
}

.tm-quiz-launch__btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}

.tm-quiz-launch__hint {
    margin-top: 6px;
    font-size: 13px;
    color: #666;
}

/* =========================================================
   Модалка
========================================================= */

.tm-quiz-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
    font-family: inherit;
}

.tm-quiz-modal.is-open {
    display: block;
}

.tm-quiz-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

.tm-quiz-modal__dialog {
    position: relative;
    max-width: 720px;
    margin: 40px auto;
    background: #fff;
    border-radius: 18px;
    padding: 22px 22px 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
}

.tm-quiz-modal__close {
    position: absolute;
    right: 14px;
    top: 10px;
    border: none;
    background: transparent;
    font-size: 26px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}

.tm-quiz-modal__close:hover {
    color: #666;
}

/* =========================================================
   Хедер
========================================================= */

.tm-quiz-header__title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.tm-quiz-header__subtitle {
    font-size: 13px;
    color: #777;
    margin-bottom: 14px;
}

/* =========================================================
   Тело квиза
========================================================= */

.tm-quiz-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 4px;
}

.tm-quiz-step {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tm-quiz-step--error {
    animation: quiz-shake .2s linear 0s 2;
}

@keyframes quiz-shake {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-4px); }
    50%  { transform: translateX(4px); }
    75%  { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

.tm-quiz-question {
    font-size: 18px;
    font-weight: 600;
}

/* =========================================================
   Варианты ответов
========================================================= */

.tm-quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tm-quiz-option {
    position: relative;
    display: block;
}

.tm-quiz-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tm-quiz-option__label {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #dde1ea;
    background: #fafbff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, transform .1s ease;
}

/* Hover */
.tm-quiz-option:hover .tm-quiz-option__label {
    border-color: #D12C24;
    box-shadow: 0 4px 10px rgba(209,44,36, .18);
    transform: translateY(-1px);
}

/* Checked */
.tm-quiz-option input:checked + .tm-quiz-option__label {
    border-color: #D12C24;
    background: #ffeae8;
}

/* =========================================================
   Кнопки шага
========================================================= */

.tm-quiz-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.tm-quiz-btn {
    border-radius: 999px;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    min-width: 110px;
}

.tm-quiz-btn--ghost {
    background: #f5f6fa;
    color: #555;
}

.tm-quiz-btn--primary {
    background: #D12C24;
    color: #fff;
}

.tm-quiz-btn:disabled {
    opacity: .5;
}

/* =========================================================
   Финальная карточка товара
========================================================= */

.quiz-result-card {
    text-align: center;
    padding: 10px 20px 30px;
}

.quiz-result-card__img img {
    max-width: 380px;
    max-height: 300px;
    object-fit: contain;
    margin: 0 auto 20px;
}

.quiz-result-card__title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

.quiz-result-card__title a {
    color: #D12C24;
    text-decoration: none;
}

.quiz-result-card__title a:hover {
    text-decoration: underline;
}

.quiz-result-card__btns {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

.quiz-btn--secondary {
    background: #f3f3f3;
    border: 1px solid #ccc;
}

/* =========================================================
   Форма подбора
========================================================= */

.quiz-form-block {
    margin-top: 30px;
    text-align: center;
}

.quiz-form-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

.quiz-form input {
    width: 280px;
    display: block;
    margin: 0 auto 10px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 15px;
}

.quiz-form-success {
    font-size: 17px;
    color: #1a8f2f;
    font-weight: 600;
    margin-top: 15px;
}

/* =========================================================
   Адаптив
========================================================= */

@media (max-width: 767px) {
    .tm-quiz-modal__dialog {
        margin: 18px 10px;
        padding: 18px 14px 14px;
        max-height: calc(100vh - 36px);
    }

    .tm-quiz-options {
        grid-template-columns: 1fr;
    }

    .tm-quiz-launch__btn {
        width: 100%;
        text-align: center;
    }
}
/* =========================================================
   Правки для кнопок и заголовка результата внутри модалки
========================================================= */

/* Заголовок товара — красный, без синих ссылок */
.tm-quiz-modal .quiz-result-card__title a {
    color: #D12C24 !important;
    text-decoration: none;
}

.tm-quiz-modal .quiz-result-card__title a:hover {
    text-decoration: underline;
}

/* Кнопки "Смотреть товар" / "Пройти заново" */
.tm-quiz-modal .quiz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 15px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.tm-quiz-modal .quiz-btn--primary {
    background: #D12C24;
    color: #fff;
}

.tm-quiz-modal .quiz-btn--primary:hover {
    background: #b42520;
}

.tm-quiz-modal .quiz-btn--secondary {
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    color: #333;
}

.tm-quiz-modal .quiz-btn--secondary:hover {
    background: #ececec;
}
