﻿/* Базовые стили анимации для JS */
.quiz {
    transition: opacity 0.3s ease-in-out;
    opacity: 1;
}
.quiz.fade-out {
    opacity: 0;
}

.status {
    padding: 15px;
    margin-bottom: 15px; 
    border-radius: 4px;
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

/* =========================================
   ИЗОЛИРОВАННАЯ ВЫДВИЖНАЯ ПАНЕЛЬ (МОДАЛКА)
   ========================================= */
/* Затемняющий оверлей. По умолчанию прозрачный и выключен из потока кликов */
.quiz-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    z-index: 9990;
    background: rgba(0, 0, 0, 0.6);
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    /* Анимация исчезновения: фон пропадает сразу, но блок остается в DOM 0.4s */
    transition: opacity 0.3s ease, visibility 0.3s ease, right 0s linear 0.4s;
}

/* Оверлей при активации */
.quiz-overlay.active {
    right: 0;
    opacity: 1;
    visibility: visible;
    /* Возвращаем в поток кликов моментально */
    transition: opacity 0.3s ease, visibility 0.3s ease, right 0s linear 0s;
}

/* Сама выезжающая панель */
.quiz-slide-panel {
    position: fixed;
    top: 0;
    height: 100%;
    width: 100%;
    background: #f7f9fc;
    z-index: 9995;
    right: -100%;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

.quiz-overlay.active .quiz-slide-panel {
    right: 0;
}

@media (min-width: 992px) {
    .quiz-slide-panel { max-width: 1000px; }
}
@media (min-width: 1400px) {
    .quiz-slide-panel { max-width: 1140px; }
}

.quiz-panel-inner {
    padding: 60px 50px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);  
    width: 100%;
    box-sizing: border-box;
    max-height: 100vh;
    overflow-y: auto;
}

/* Очистка стилей квиза внутри модалки */
.quiz-slide-panel .quiz {
    box-shadow: none;
    border-top: none;
    padding: 0;
    background: transparent;
}

img.quiz-close-btn {
    position: absolute;
    right: 35px;
    top: 35px;
    cursor: pointer;
    transition: transform 0.4s ease;
    z-index: 10100;
    max-width: 31px;
}

img.quiz-close-btn:hover {
    transform: rotate(180deg);
}

/* =========================================
   КЛАССИЧЕСКИЕ СТИЛИ КВИЗА (СТАТИКА)
   ========================================= */
.quiz-static-wrap .quiz {
    border-top: 5px solid #eaeaea; 
    margin: 0 auto;
    padding: 40px 30px; 
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.quiz__questions {
    text-align: center;
    margin-bottom: 15px;
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
}

.quiz-question__title {
    font-size: 24px;
    margin-bottom: 25px;
    margin-top: 0;
    color: #222;
}

.quiz-question__answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-question__label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #444;
    font-size: 16px;
}

.quiz select, 
.quiz-question__answers input[type="text"], 
.quiz-question__answers input[type="tel"] {
    height: 45px;
    padding: 0 15px;
    cursor: pointer;
    width: 100%;
    color: #333;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.quiz select:focus, 
.quiz-question__answers input[type="text"]:focus, 
.quiz-question__answers input[type="tel"]:focus {
    border-color: #007bff;
    outline: none;
}

.quiz-question__answers input[type="radio"],
.quiz-question__answers input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.quiz-question__btn {
    color: #fff;
    background-color: #007bff;
    border: none;
    padding: 12px 25px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    transition: background-color 0.2s;
}

.quiz-question__btn:hover { background-color: #0056b3; }
[data-send].quiz-question__btn { width: 100%; background-color: #28a745; }
[data-send].quiz-question__btn:hover { background-color: #218838; }

.error { border-color: #dc3545 !important; box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25); }

.quiz-layout {
    display: grid;
    grid-template-columns: 5fr 3fr; 
    gap: 40px;
}

.quiz-question__label--custom {
    position: relative;
    padding: 15px 15px 15px 45px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.quiz-question__label--custom:hover { border-color: #007bff; }
.quiz-question__label--custom input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.quiz-question__indicator {
    position: absolute; top: 50%; left: 15px; transform: translateY(-50%);
    height: 20px; width: 20px; background-color: #fff; border: 1px solid #ccc; transition: all 0.2s;
}
.quiz-question__answer[type="radio"] ~ .quiz-question__indicator { border-radius: 50%; }
.quiz-question__answer[type="checkbox"] ~ .quiz-question__indicator { border-radius: 4px; }
.quiz-question__answer:checked ~ .quiz-question__indicator { background-color: #007bff; border-color: #007bff; }
.quiz-question__label--custom:has(input:checked) { border-color: #007bff; background-color: #f0f8ff; }

.quiz-question__indicator::after { content: ""; position: absolute; display: none; }
.quiz-question__answer:checked ~ .quiz-question__indicator::after { display: block; }
.quiz-question__answer[type="radio"] ~ .quiz-question__indicator::after { top: 6px; left: 6px; width: 6px; height: 6px; border-radius: 50%; background: white; }
.quiz-question__answer[type="checkbox"] ~ .quiz-question__indicator::after { left: 6px; top: 2px; width: 5px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.quiz-steps { display: flex; gap: 10px; align-items: center; margin-bottom: 30px; }
.quiz-step { width: 35px; height: 35px; background-color: #f0f0f0; color: #666; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 14px; font-weight: 600; }
.quiz-step.active { background-color: #8cc04f; color: #fff; width: auto; padding: 0 20px; border-radius: 20px; }

.quiz-sidebar__inner { background: #f9f9f9; padding: 25px; border-radius: 8px; height: 100%; border: 1px solid #eee; }
.quiz-sidebar__title { margin-top: 0; font-size: 18px; color: #333; border-bottom: 2px solid #eaeaea; padding-bottom: 10px; margin-bottom: 15px; }
.quiz-summary-empty { font-size: 14px; color: #999; }
.quiz-summary-list { list-style: none; padding: 0; margin: 0; }
.quiz-summary-list li { font-size: 14px; margin-bottom: 12px; color: #555; line-height: 1.4; }
.quiz-summary-list li span { display: block; font-size: 12px; color: #888; margin-bottom: 2px; }
.quiz-summary-list li b { color: #222; }

@media (max-width: 768px) {
    .quiz-layout { grid-template-columns: 1fr; }
    .quiz-panel-inner { padding: 40px 20px; }
    img.quiz-close-btn { right: 20px; top: 20px; max-width: 25px; }
}
