/* quiz.css */

/* ===== QUIZ GRID ===== */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.quiz-card {
    position: relative;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    background: var(--color-white);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.quiz-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-blue-strong);
    border-color: var(--color-blue);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
    font-size:1rem;
    font-weight:600;
}

.quiz-header h3 {
    font-size: 1.45rem;
    margin: 0;
    color: var(--color-blue);
    font-weight: 700;
}

.quiz-time {
    font-size: 0.9rem;
    background: var(--color-red);
    color: var(--color-white);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
}

.quiz-card p {
    font-size: 0.95rem;
    color: var(--color-muted);
    margin: 8px 0 16px;
    text-align: right;
}

.quiz-card .start-quiz-btn,
.quiz-card .start-practice-btn {
    background: var(--color-blue);
    color: var(--color-white);
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s ease;
}

.quiz-card .start-quiz-btn:hover,
.quiz-card .start-practice-btn:hover {
    background: var(--blue-hero-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px var(--shadow-blue-strong);
}

.quiz-card .start-practice-btn:disabled,
.quiz-card .start-practice-btn[disabled] {
    background: #9ca3af !important;
    color: #f3f4f6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.quiz-card .start-practice-btn:disabled:hover,
.quiz-card .start-practice-btn[disabled]:hover {
    background: #9ca3af !important;
    transform: none !important;
}

/* Badge trạng thái */
.quiz-card.badge-none  { border-color: var(--color-muted); }
.quiz-card.badge-pass  { border-color: var(--color-green); box-shadow: 0 0 0 4px rgba(40,167,69,0.15); }
.quiz-card.badge-fail  { border-color: var(--color-red);   box-shadow: 0 0 0 4px var(--red-glow); }

/* ===== QUIZ CONTAINER ===== */
#quiz-container {
    background: var(--color-white);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-top: 30px;
    border: 1px solid var(--color-border);
}

#quiz-title {
    font-size: 1.8rem;
    color: var(--color-blue);
    margin-bottom: 24px;
    text-align: center;
    font-weight: 700;
}

#progress {
    color: var(--color-blue);
    text-align: right;
}

#timer {
    color: var(--color-white);
    text-align: center;
    min-width: 70px;
    padding: 3px 12px;
}

/* ===== CÂU HỎI ===== */
#question-area {
    margin-bottom: 22px;
}

.question-item {
    margin-bottom: 32px;
    background: var(--color-bg);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.question-item .question-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--color-blue);
    font-weight: 600;
}

.question-title p {
    all: unset;
    display: block;
}

.question-item label {
    display: flex;
    align-items: center;
    margin: 12px 0;
    padding: 12px;
    background: var(--color-white);
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
}

.question-item input[type="radio"],
.question-item input[type="checkbox"] {
    margin-right: 16px;
}

.question-item label:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.question-item label:has(input:checked) {
    background: #e6f0ff;
    border-color: var(--color-blue);
    color: var(--color-blue);
    font-weight: 500;
}

/* ===== ĐIỀU HƯỚNG ===== */
.quiz-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.quiz-nav button {
    padding: 14px 36px;
    font-size: 1.1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
}

#back-btn   {padding: 10px 10px;}
#prev-btn   { background: var(--color-muted); color: var(--color-white); }
#next-btn   { background: var(--color-blue);  color: var(--color-white); }
#submit-btn { background: var(--color-red);   color: var(--color-white); }

.quiz-nav button:active {
    transform: scale(0.96);
}

/* ===== REVIEW KẾT QUẢ ===== */
#review-area h2 {
    text-align: center;
    color: var(--color-blue);
    margin-bottom: 40px;
}

/* Chỉ giữ modifier — base .review-item đã có trong style.css */
.review-item.correct { border-left-color: var(--color-green); }
.review-item.wrong   { border-left-color: var(--color-red); }

.review-item h4 {
    margin-bottom: 12px;
    font-size: 1.25rem;
    color: var(--color-blue);
}

.explanation {
    margin-top: 16px;
    font-style: italic;
    color: var(--color-muted);
}

/* ===== QUIZ NOTICE ===== */
.quiz-notice-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
}

.quiz-notice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: min(92vw, 540px);
    padding: 14px 40px 14px 16px;
    border-radius: 12px;
    color: #fff;
    display: flex;
    align-items: flex-start;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    animation: noticePopup 0.22s ease;
    box-sizing: border-box;
}

@keyframes noticePopup {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.93);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===== Types ===== */
.notice-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}
.notice-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 10px 36px rgba(243, 156, 18, 0.38);
}
.notice-error {
    background: linear-gradient(135deg, #BB133E, #8e0f2f);
}
.notice-info {
    background: linear-gradient(135deg, #002147, #1e3a8a);
}

/* ===== Nội dung ===== */
#quiz-notice-msg {
    flex: 1;
    min-width: 0;
    font-size: 0.93rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quiz-notice-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s, transform 0.15s;
}
.quiz-notice-close:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* ===== Action (unauthenticated / no_state) ===== */
.quiz-notice-text {
    flex: 1;
    min-width: 140px;
    line-height: 1.45;
}
.quiz-notice-text strong {
    font-size: 1rem;
    color: #fff;
    display: block;
    margin-bottom: 2px;
}
.quiz-notice-subtext {
    font-size: 0.82rem;
    opacity: 0.9;
    font-weight: 400;
}

.quiz-notice-action-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-red);
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.quiz-notice-action-btn:hover {
    background: #fff;
    transform: translateY(-1px);
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
    .quiz-notice {
        padding: 12px 36px 12px 14px;
        border-radius: 10px;
    }
    .quiz-notice-text strong {
        font-size: 0.95rem;
    }
    .quiz-notice-subtext {
        font-size: 0.8rem;
    }
    .quiz-notice-action-btn {
        width: 100%;
        text-align: center;
        padding: 10px;
        margin-top: 6px;
    }
}

/* ===== REVIEW ANSWERS ===== */
.review-answers {
    margin: 15px 0 10px;
}

/* Chỉ giữ modifier — base .answer-item đã có trong style.css */
.answer-item.correct-answer {
    background: #d4edda;
    border-color: var(--color-green);
    font-weight: 500;
}

.answer-item.correct-answer::before {
    content: "✔";
    color: var(--color-green);
    font-weight: bold;
    margin-right: 8px;
    font-size: 1.2rem;
}

.answer-item.user-wrong {
    background: #fee2e2;
    border-color: var(--color-red);
    font-weight: 500;
}

.answer-item.user-wrong::before {
    content: "✘";
    color: var(--color-red);
    font-weight: bold;
    margin-right: 8px;
    font-size: 1.2rem;
}

/* ===== MISSED STATS ===== */
.missed-stats { margin-bottom: 20px; }
.missed-stats span {
    color: var(--color-red);
    font-weight: 700;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .quiz-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .quiz-card { padding: 16px; }

    .quiz-header h3 { font-size: 1.25rem; }

    #quiz-container {
        padding: 24px;
        margin-top: 0px;
    }

    .quiz-nav {
        gap: 12px;
    }

    .quiz-nav button { width: 100%; }

    .answer-item {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .question-item label{
        margin: 10px 0;
        padding: 8px;
    }
    
    .question-item input[type="radio"],
        .question-item input[type="checkbox"] {
            margin-right: 10px;
        }
}