/* file css/quiz-style.css */

.quiz-box {
    width: 100%;
    background: #f0f7ff; /* Xanh dương nhạt */
    border: 1px solid #cce3ff;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    font-family: inherit;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Định dạng số câu hỏi */
.question-number {
    display: inline-block;
    background-color: #0066cc; /* Xanh dương đậm */
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    margin-right: 10px;
    font-weight: bold;
    font-size: 16px;
}


.question-section {
    background: #ffffff; /* Trắng sạch sẽ */
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 1em;
    border: 1px solid #e5e7eb;
}

.question-section h5 {
    color: #1f2937; /* Màu chữ chính xám đen */
    font-family: inherit;
    font-weight: normal;
    font-size: 1em;
    margin-top: 0;
    line-height: 1.6;
}

/* Định dạng khi hover để tương tác */
.question-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.option {
    background: #f8fafc;
    margin: 0;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Bố cục 2 cột cho options MCQ: A-B hàng trên, C-D hàng dưới */
/* Bố cục 1 cột cho options MCQ */
.quiz-box[data-type="single-choice"] .options-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.option input[type="radio"] {
    display: none;
}

.option label {
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
}

.option .option-letter {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #4a5568;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option.correct {
    background: #f0fdf4 !important;
    border: 1px solid #22c55e !important;
}

.option.correct .option-letter {
    background: #22c55e;
    color: white;
}

.option.incorrect {
    background: #fef2f2 !important;
    border: 1px solid #ef4444 !important;
}

.option.incorrect .option-letter {
    background: #ef4444;
    color: white;
}

.option:not(.correct):not(.incorrect):has(input[type="radio"]:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
}
.option:not(.correct):not(.incorrect):has(input[type="radio"]:checked) .option-letter {
    background: #3b82f6;
    color: white;
}

.check-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background 0.3s;
}

.check-btn:hover {
    background: #45a049;
}

.explanation {
    border: 1px solid #fde68a;
    background: #fffbeb !important;
    padding: 15px;
    border-radius: 8px;
    margin-top: 12px;
}

.explanation h5 {
    color: #374151;
    margin-top: 0;
    font-weight: bold;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.correct {
    background: #dff0d8 !important;
    border-left: 5px solid #3c763d;
}

.incorrect {
    background: #f2dede !important;
    border-left: 5px solid #a94442;
}

.quiz-score {
    background-color: #fffaf0;
    border: 12px solid #d4af37;
    padding: 40px 20px;
    border-radius: 4px;
    margin: 30px 0;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    position: relative;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(212, 175, 55, 0.05) 10px, rgba(212, 175, 55, 0.05) 20px);
}

.quiz-score::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 2px dashed #d4af37;
    pointer-events: none;
}

.quiz-score h3 {
    margin-top: 10px;
    color: #b8860b;
    font-size: 2.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: "Georgia", "Times New Roman", serif;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.quiz-score p {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #444;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.quiz-score .quiz-result-title {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 25px;
}

.quiz-score .quiz-result-title strong {
    font-size: 1.6rem;
    color: #8b0000;
}

.cert-student-name {
    font-size: 2.2rem;
    color: #d4af37;
    font-family: "Georgia", "Times New Roman", serif;
    font-style: italic;
    font-weight: bold;
    display: inline-block;
    margin-top: 10px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}

.submit-quiz,
.retry-quiz {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    margin: 10px 0;
    transition: background 0.3s;
}

.retry-quiz {
    background: #2196F3;
}

.submit-quiz:hover {
    background: #45a049;
}

.retry-quiz:hover {
    background: #1976D2;
}

/* CSS cho câu hỏi trắc nghiệm nhiều đáp án đúng sai */
.quiz-box[data-type="true-false"] {
    background: #f0fff4; /* Xanh ngọc nhạt */
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.quiz-box[data-type="true-false"] .question-number {
    background-color: #047857; /* Xanh ngọc đậm */
}

.option-tf {
    background: #ffffff;
    margin: 10px 0;
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.option-tf:hover {
    border-color: #047857;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.option-tf-label {
    cursor: pointer;
    display: block;
    width: 100%;
    color: #1f2937;
}

.tf-buttons {
    display: flex;
    align-items: center;
    margin-top: 0px;
    margin-left: 0px;
}

.tf-buttons input[type="radio"] {
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

.tf-buttons label {
    cursor: pointer;
    font-size: 1em;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-right: 10px;
    user-select: none;
    /* Ngăn chặn chọn văn bản */
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    transition: all 0.2s ease;
}

/* Định dạng màu cho nút "Đúng" */
.tf-buttons .true-label {
    background-color: transparent;
    border-color: #059669; /* Xanh ngọc */
    color: #059669;
}

/* Định dạng màu cho nút "Sai" */
.tf-buttons .false-label {
    background-color: transparent;
    border-color: #dc2626; /* Đỏ */
    color: #dc2626;
}

/* Hiệu ứng hover cho nút */
.tf-buttons label:hover {
    opacity: 0.8;
}

/* Hiển thị khi radio button được chọn */
.tf-buttons input[type="radio"]:checked+label.true-label {
    background-color: #059669;
    color: white;
}

.tf-buttons input[type="radio"]:checked+label.false-label {
    background-color: #dc2626;
    color: white;
}

.tf-buttons input[type="radio"]:checked+label {
    background-color: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.option-tf.correct {
    border-left: 5px solid #3c763d;
}

.option-tf.incorrect {
    border-left: 5px solid #a94442;
}

/* CSS cho câu hỏi trả lời ngắn */
.quiz-box[data-type="short-answer"] {
    background: #f5f3ff; /* Tím nhạt */
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.quiz-box[data-type="short-answer"] .question-number {
    background-color: #6d28d9; /* Tím đậm */
}

.quiz-box[data-type="short-answer"] .answer-section::before {
    content: "Đáp án: ";
    /* Thêm chữ "Đáp án:" */
    font-weight: bold;
    margin-right: 5px;
    color: #4c1d95;
}

.quiz-box[data-type="short-answer"] .short-answer-input {
    border: 1px solid #8b5cf6;
    border-radius: 6px;
    padding: 8px 12px;
    color: #6d28d9;
    font-weight: bold;
    width: 150px;
    text-align: center;
    outline: none;
    transition: all 0.2s;
}

.quiz-box[data-type="short-answer"] .short-answer-input:focus {
    border-color: #6d28d9;
    box-shadow: 0 0 0 2px #ddd6fe;
}

/* CSS cho câu hỏi tự luận */
.quiz-box[data-type="essay"] {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
}

.quiz-box[data-type="essay"] .question-section {
    background-color: #ffffff;
}

.quiz-box[data-type="essay"] .answer-section {
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* CSS cho phần thi online */
.quiz-student-info {
    margin-bottom: 15px;
    color: blue;
    font-weight: bold;
}

.student-name-input {
    padding: 8px;
    border: 2px solid #FF5733;
    border-radius: 6px;
    font-size: 16px;
    width: 100%;
    /* Chiếm toàn bộ chiều rộng */
    max-width: 400px;
    /* Giới hạn chiều rộng tối đa */
    box-sizing: border-box;
    /* Đảm bảo padding và border không làm thay đổi kích thước */
}

.quiz-timer {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c;
    /* Màu đỏ */
    margin-bottom: 15px;
    background-color: #f8d7da;
    /* Màu nền nhạt */
    border: 1px solid #f5c6cb;
    /* Viền */
    padding: 10px;
    border-radius: 5px;
    display: inline-block;
    /* Hiển thị trên cùng một dòng */
}

.quiz-section-title {
    margin-top: 20px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    color: #213cd1;
    border-bottom: 2px solid #ffc300;
}

.student-name-display {
    margin: 10px 0;
    color: blue;
    font-weight: bold;
}

.quiz-group {
    border: none;
    padding: 0;
    margin-bottom: 30px;
    background-color: transparent;
}

.quiz-group-title {
    font-weight: bold;
    margin-bottom: 15px;
    padding: 10px 15px;
    font-size: 1.2em;
    color: #003366; /* Màu blue đậm */
    background-color: #e5e7eb; /* Fallback */
    border-radius: 6px;
    border: none;
}

/* Nền tiêu đề trùng màu khung của phần đó */
.quiz-group:has(.quiz-box[data-type="single-choice"]) .quiz-group-title {
    background-color: #cce3ff;
}

.quiz-group:has(.quiz-box[data-type="true-false"]) .quiz-group-title {
    background-color: #bbf7d0;
}

.quiz-group:has(.quiz-box[data-type="short-answer"]) .quiz-group-title {
    background-color: #ddd6fe;
}




/* Style cho các phần I, II, III */
.quiz-parts-container {
    margin-bottom: 20px;
    /* Khoảng cách trước nút Nộp bài */
}

.quiz-part {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.quiz-part:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.quiz-section-title {
    color: #005a9c;
    /* Màu tiêu đề phần */
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* CSS cho trang kết quả bài thi */
.quiz-user-results {
    margin: 20px 0;
    font-family: inherit;
}

.quiz-user-results h2 {
    color: #0073aa;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.quiz-results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: #fff;
    border: 1px solid #ddd;
}

.quiz-results-table th,
.quiz-results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.quiz-results-table th {
    background-color: #f1f1f1;
    font-weight: bold;
    color: #333;
}

.quiz-results-table tr:hover {
    background-color: #f9f9f9;
}

.quiz-details-row {
    background-color: #f9f9f9;
}

.quiz-details-content {
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 15px 0;
}

.quiz-details-content h3 {
    margin-top: 0;
    color: #0073aa;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.quiz-details-content h4 {
    color: #333;
    margin-top: 20px;
}

.quiz-score-summary {
    background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.quiz-score-summary p {
    margin: 8px 0;
}

.total-score {
    font-size: 1.3em;
    font-weight: bold;
    color: #0073aa;
}

.quiz-answers-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background-color: #fff;
    border: 1px solid #ddd;
}

.quiz-answers-table th,
.quiz-answers-table td {
    padding: 10px;
    text-align: left;
    border: 1px solid #ddd;
}

.quiz-answers-table th {
    background-color: #f1f1f1;
    font-weight: bold;
}

.quiz-answers-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.quiz-answers-table tr:hover {
    background-color: #e6f7ff;
}

.question-content {
    max-width: 300px;
    word-wrap: break-word;
}

.correct-answer {
    color: green;
    font-weight: bold;
}

.incorrect-answer {
    color: red;
    font-weight: bold;
}

.view-quiz-details {
    color: #0073aa;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid #0073aa;
    border-radius: 3px;
    display: inline-block;
}

.view-quiz-details:hover {
    background-color: #0073aa;
    color: white;
    text-decoration: none;
}

.quiz-login-required {
    text-align: center;
    padding: 30px;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 20px 0;
}

.quiz-login-required h2 {
    color: #0073aa;
    margin-top: 0;
}

.quiz-statistics {
    text-align: right;
    font-weight: bold;
    margin-top: 10px;
    font-size: 1.1em;
    color: #0073aa;
}

/* ============================================================
   Responsive design (kế thừa từ trên)
   ============================================================ */
@media (max-width: 768px) {

    .quiz-results-table,
    .quiz-answers-table {
        font-size: 0.9em;
    }

    .quiz-results-table th,
    .quiz-results-table td,
    .quiz-answers-table th,
    .quiz-answers-table td {
        padding: 8px;
    }

    .question-content {
        max-width: 150px;
    }
}

/* ============================================================
   VIDU MODE – Flashcard / Luyện tập từng câu
   ============================================================ */
.quiz-set-vidu {
    font-family: inherit;
    max-width: 800px;
    margin: 20px auto;
}

/* Header: progress bar + text */
.vidu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.vidu-progress-bar-wrap {
    flex: 1;
    height: 10px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.vidu-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #43ea80, #1565c0);
    border-radius: 10px;
    transition: width 0.4s ease;
}

.vidu-progress-text {
    font-size: 0.95em;
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}

/* Khu hiển thị câu hỏi – animated khi đổi câu */
.vidu-question-display {
    min-height: 120px;
    animation: vidu-fadein 0.3s ease;
}

@keyframes vidu-fadein {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Khu nút điều hướng */
.vidu-nav {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Nút Tiếp theo – mờ cho đến khi đã trả lời */
.vidu-next-btn {
    background: #bbb;
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 6px;
    font-size: 1.05em;
    cursor: not-allowed;
    transition: background 0.3s, transform 0.15s;
}

/* Sáng lên sau khi chọn đáp án */
.vidu-next-btn.vidu-next-ready {
    background: linear-gradient(90deg, #1565c0, #42a5f5);
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(21, 101, 192, .35);
}

.vidu-next-btn.vidu-next-ready:hover {
    background: linear-gradient(90deg, #0d47a1, #1e88e5);
    transform: translateY(-1px);
}

/* Nút Làm lại */
.vidu-restart-btn {
    background: #ff7043;
    color: #fff;
    border: none;
    padding: 11px 24px;
    border-radius: 6px;
    font-size: 1.05em;
    cursor: pointer;
    transition: background 0.3s;
}

.vidu-restart-btn:hover {
    background: #e64a19;
}

/* Nút Kiểm tra (short-answer) */
.vidu-check-btn {
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 5px;
    font-size: 0.95em;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.3s;
}

.vidu-check-btn:hover {
    background: #388e3c;
}

.vidu-check-btn:disabled {
    background: #aaa;
    cursor: default;
}

/* Màn hình hoàn thành */
.vidu-finished {
    text-align: center;
    padding: 36px 20px;
    background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
    border-radius: 12px;
    color: #1a237e;
    animation: vidu-fadein 0.4s ease;
}

.vidu-finished h3 {
    font-size: 1.4em;
    color: #1a237e;
}

/* Bảng tổng kết kết quả vidu */
.vidu-summary-table {
    border-collapse: collapse;
    margin: 16px auto 0;
    min-width: 240px;
    font-size: 1em;
    font-weight: normal;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.vidu-summary-table td {
    padding: 10px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    text-align: left;
}

.vidu-summary-table td:first-child {
    color: #555;
    font-size: 0.95em;
}

.vidu-summary-table td:last-child {
    text-align: right;
}

.vidu-summary-table tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   BADGE KẾT QUẢ TỪNG CÂU – hiển thị sau khi Nộp bài
   ============================================================ */

/* Badge container */
.question-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.92em;
    font-weight: 600;
    margin: 8px 0 6px;
    border: 1.5px solid transparent;
    animation: badge-pop 0.25s ease;
}

@keyframes badge-pop {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

/* Điểm bên phải badge */
.badge-score-text {
    font-size: 1em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 5px;
    background: rgba(0,0,0,0.07);
    letter-spacing: 0.02em;
}

/* ── Đúng (xanh lá) */
.question-result-badge.badge-correct {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #15803d;
}
.question-result-badge.badge-correct .badge-score-text {
    background: #dcfce7;
    color: #15803d;
}

/* ── Sai (đỏ) */
.question-result-badge.badge-incorrect {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}
.question-result-badge.badge-incorrect .badge-score-text {
    background: #fee2e2;
    color: #b91c1c;
}

/* ── Chưa làm (xám) */
.question-result-badge.badge-skipped {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #64748b;
}
.question-result-badge.badge-skipped .badge-score-text {
    background: #e2e8f0;
    color: #64748b;
}

/* ── Đúng một phần (cam – dành cho phần II) */
.question-result-badge.badge-partial {
    background: #fff7ed;
    border-color: #f97316;
    color: #c2410c;
}
.question-result-badge.badge-partial .badge-score-text {
    background: #ffedd5;
    color: #c2410c;
}

/* ── Icon kết quả từng ý trong phần II (Đúng/Sai) */
.tf-result-icon {
    display: block;
    margin-top: 4px;
    font-size: 0.88em;
    font-weight: 600;
}

.tf-icon-correct {
    color: #16a34a;
    background: #dcfce7;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #86efac;
}

.tf-icon-incorrect {
    color: #dc2626;
    background: #fee2e2;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #fca5a5;
}

.tf-icon-skipped {
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}