/* ========================================
   QUIZ EXAM - COMPLETE FINAL VERSION
   ✅ Giữ header/footer website
   ✅ Bỏ box thừa (chỉ 1 border)
   ✅ Mobile: Sidebar trên, Questions dưới
======================================== */

/* ========================================
   GLOBAL: CHẶN HORIZONTAL SCROLL
======================================== */
html {
    overflow-x: hidden;
}
body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ========================================
   MAIN WRAPPER - KHÔNG ẨN HEADER/FOOTER
======================================== */

.quiz-exam-wrapper {
    background: #FAFBFC;
    min-height: auto;
    padding: 30px 0;
}

.quiz-exam-wrapper.is-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    padding: 0;
    margin: 0;
    overflow: auto;
}

.quiz-exam-wrapper.is-fullscreen .quiz-exam-container {
    height: auto;
    min-height: 100vh;
    max-width: none;
    padding: 20px;
}

.quiz-exam-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   HEADER - Navy gradient
======================================== */

.quiz-exam-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    padding: 28px 35px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quiz-exam-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 25% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 60%, rgba(255,255,255,0.08) 0%, transparent 50%);
}

.quiz-header-content {
    position: relative;
    z-index: 1;
}

.quiz-exam-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 15px 0;
    color: white;
    letter-spacing: -0.02em;
}

.quiz-exam-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 50px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-fullscreen-mode {
    position: relative;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.875rem;
    z-index: 10;
    flex-shrink: 0;
}

.btn-fullscreen-mode:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-2px);
}

.btn-fullscreen-mode svg {
    flex-shrink: 0;
}

/* ========================================
   MAIN BODY - DESKTOP
======================================== */

.quiz-exam-body {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

/* ========================================
   QUESTIONS AREA - CHỈ 1 BORDER
======================================== */

.quiz-questions-area {
    flex: 1;
    background: white;
    padding: 45px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    min-height: 550px;
    border: 2px solid #E5E7EB;
}

.question-slide {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-header-badge {
    display: inline-flex;
    align-items: baseline;
    background: #F97316;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    margin-bottom: 25px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.current-q {
    font-size: 1.375rem;
}

.total-q {
    font-size: 1rem;
    opacity: 0.9;
}

.question-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #000000;
    margin-bottom: 30px;
    font-weight: 700;
    text-align: justify;
}

/* ========================================
   BOOKMARK BUTTON
======================================== */

.question-actions {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #F3F4F6;
}

.btn-bookmark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    color: #6B7280;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-bookmark:hover {
    border-color: #F97316;
    background: #FFF7ED;
    color: #F97316;
}

.btn-bookmark.active {
    background: #F97316;
    border-color: #F97316;
    color: white;
}

.btn-bookmark svg {
    flex-shrink: 0;
}

/* ========================================
   OPTIONS - CHỈ 1 BORDER DUY NHẤT
======================================== */

.question-options {
    display: flex;
	font-weight: 600;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 35px;
}

.option-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.option-card:hover {
    border-color: #F97316;
    background: #FFF7ED;
    transform: translateX(4px);
}

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

.option-circle {
    width: 22px;
    height: 22px;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s;
}

.option-card:has(input:checked) {
    background: #FFF7ED;
    border-color: #F97316;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}

.option-card:has(input:checked) .option-circle {
    border-color: #F97316;
    background: #F97316;
    box-shadow: inset 0 0 0 4px white;
}

.option-content {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.option-letter {
    font-weight: 700;
    color: #1e3a8a;
    min-width: 24px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    line-height: 1.7;
    color: #1F2937;
}

.option-check {
    color: #F97316;
    font-size: 1.25rem;
    font-weight: 700;
    opacity: 0;
    transition: all 0.3s;
}

.option-card:has(input:checked) .option-check {
    opacity: 1;
}

/* ========================================
   TRUE/FALSE STATEMENTS
======================================== */

.tf-statements {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 35px;
}

.tf-statement-item {
    padding: 18px 20px;
    border-radius: 12px;
    border: 2px solid #E5E7EB;
    transition: all 0.3s;
    background: white;
}

.tf-statement-item:hover {
    border-color: #F97316;
}

.tf-statement-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.statement-text {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.6;
    max-width: calc(100% - 220px);
}

.statement-letter {
    flex-shrink: 0;
    font-weight: 700;
    color: #1e3a8a;
    font-size: 1.0625rem;
    min-width: 30px;
    margin-top: 2px;
}

.statement-text-content {
    flex: 1;
    word-break: break-word;
    color: #1F2937;
}

.tf-options {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: auto;
    min-width: 200px;
}

.tf-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 8px;
    background: white;
    border: 2px solid #E5E7EB;
    transition: all 0.3s;
    user-select: none;
    white-space: nowrap;
}

.tf-option:hover {
    border-color: #F97316;
    background: #FFF7ED;
}

.tf-option input[type="radio"] {
    margin: 0;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.tf-label {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1F2937;
}

.tf-option:has(input[type="radio"]:checked) {
    background: #F97316;
    border-color: #F97316;
}

.tf-option:has(input[type="radio"]:checked) .tf-label {
    color: white;
}

/* ========================================
   TEXT ANSWER INPUT
======================================== */

.text-answer-wrapper {
    margin-bottom: 35px;
}

.text-answer-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.0625rem;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
    color: #1F2937;
}

.text-answer-input:focus {
    outline: none;
    border-color: #F97316;
    background: #FFF7ED;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.text-answer-input::placeholder {
    color: #9CA3AF;
}

/* ========================================
   NAVIGATION BUTTONS
======================================== */

.question-nav-btns {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-top: 30px;
    border-top: 2px solid #F3F4F6;
}



.btn-nav-question {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-prev {
    background: #9CA3AF;
    color: white;
}

.btn-prev:hover {
    background: #6B7280;
    transform: translateX(-3px);
}

.btn-next {
    background: #F97316;
    color: white;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.btn-next:hover {
    background: #EA580C;
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

/* ========================================
   SIDEBAR - CHỈ 1 BORDER
======================================== */

.quiz-sidebar-panel {
    width: 400px;
    flex-shrink: 0;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 30px;
    transition: all 0.3s;
    isolation: isolate; /* tạo stacking context riêng */
}

.quiz-sidebar-panel.collapsed {
    width: 60px;
}

.sidebar-toggle {
    position: absolute;
    left: 15px;
    top: 15px;
    width: 36px;
    height: 36px;
    background: #F97316;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    z-index: 10;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: #EA580C;
    transform: scale(1.05);
}

.sidebar-content {
    padding: 60px 25px 25px 25px;
}

.quiz-sidebar-panel.collapsed .sidebar-content {
    display: none;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 20px 0;
    color: #1F2937;
}

/* ========================================
   QUESTION GRID
======================================== */

.question-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.grid-btn {
    aspect-ratio: 1;
    border: 2px solid #E5E7EB;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    color: #6B7280;
    transition: all 0.3s;
    font-size: 0.9375rem;
}

.grid-btn:hover {
    border-color: #F97316;
    background: #FFF7ED;
    transform: scale(1.05);
}

.grid-btn.answered {
    background: #10B981;
    border-color: #059669;
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.grid-btn.active {
    border-color: #F97316;
    border-width: 3px;
}

.grid-btn.bookmarked {
    position: relative;
}

.grid-btn.bookmarked::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #F97316;
    border-radius: 50%;
    border: 2px solid white;
}

/* ========================================
   TIMER
======================================== */

.sidebar-timer {
    text-align: center;
}

.timer-card {
    background: #10B981;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.timer-icon {
    color: white;
    opacity: 0.9;
}

.timer-display {
    font-family: 'Inter', monospace;
    font-size: 1.875rem;
    font-weight: 800;
    color: white;
}

/* ========================================
   BUTTONS
======================================== */

.btn-pause {
    width: 100%;
    padding: 14px;
    background: #9CA3AF;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
}

.btn-pause:hover {
    background: #6B7280;
    transform: translateY(-2px);
}

.btn-submit {
    width: 100%;
    padding: 16px;
    background: #F97316;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.0625rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.btn-submit:hover {
    background: #EA580C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.sidebar-start {
    text-align: center;
}

.btn-start {
    width: 100%;
    padding: 18px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ========================================
   RESULT MODAL
======================================== */

.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.result-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    padding: 30px;
    border-radius: 20px 20px 0 0;
    text-align: center;
}

.result-header h2 {
    margin: 0;
    color: white;
    font-size: 1.875rem;
    font-weight: 800;
}

.result-body {
    padding: 40px 30px;
}

.result-score {
    text-align: center;
    margin-bottom: 40px;
}

.score-circle {
    position: relative;
    display: inline-block;
}

.score-circle svg {
    transform: rotate(-90deg);
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    display: block;
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #10B981, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.score-label {
    display: block;
    font-size: 1.125rem;
    color: #6B7280;
    margin-top: 8px;
    font-weight: 600;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: #FAFBFC;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #E5E7EB;
}

.stat-correct {
    background: #D1FAE5;
    border-color: #10B981;
}

.stat-wrong {
    background: #FEE2E2;
    border-color: #DC2626;
}

.stat-skip {
    background: #FEF3C7;
    border-color: #F59E0B;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.stat-correct .stat-icon {
    color: #10B981;
}

.stat-wrong .stat-icon {
    color: #DC2626;
}

.stat-skip .stat-icon {
    color: #F59E0B;
}

.stat-label {
    font-size: 0.875rem;
    color: #6B7280;
    margin-bottom: 5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: #1F2937;
}

.result-actions {
    display: flex;
    gap: 15px;
}

.btn-action {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-review {
    background: #1e3a8a;
    color: white;
}

.btn-review:hover {
    background: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.3);
}

.btn-retry {
    background: #9CA3AF;
    color: white;
}

.btn-retry:hover {
    background: #6B7280;
}

/* ========================================
   PAUSE MODAL
======================================== */

.pause-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.pause-content {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.pause-content h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #1F2937;
    margin: 0 0 16px 0;
}

.pause-content p {
    font-size: 1.0625rem;
    color: #6B7280;
    margin: 0 0 32px 0;
}

.btn-resume {
    width: 100%;
    padding: 16px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.0625rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-resume:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.quiz-questions-area.blurred {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* ========================================
   CONFIRM SUBMIT MODAL
======================================== */

.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.confirm-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideUp 0.3s;
}

.confirm-icon {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 20px;
}

.confirm-content h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1F2937;
    text-align: center;
    margin: 0 0 24px 0;
}

.confirm-stats {
    background: #FAFBFC;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #E5E7EB;
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-row.stat-warning {
    background: #FEF3C7;
    margin: 0 -20px;
    padding: 12px 20px;
    border-radius: 12px;
}

.unanswered-list {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.list-title {
    font-weight: 600;
    color: #92400E;
    margin: 0 0 12px 0;
    font-size: 0.9375rem;
}

.question-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.question-numbers .q-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    background: white;
    border: 2px solid #FBBF24;
    border-radius: 8px;
    font-weight: 700;
    color: #92400E;
    cursor: pointer;
    transition: all 0.3s;
}

.question-numbers .q-number:hover {
    background: #FBBF24;
    color: white;
    transform: scale(1.1);
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel {
    background: #F3F4F6;
    color: #1F2937;
}

.btn-cancel:hover {
    background: #E5E7EB;
}

.btn-confirm {
    background: #F97316;
    color: white;
}

.btn-confirm:hover {
    background: #EA580C;
    transform: translateY(-2px);
}

/* ========================================
   AUTO SUBMIT MODAL
======================================== */

.auto-submit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.auto-submit-content {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    max-width: 400px;
}

.auto-submit-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pulse 1s infinite;
}

.auto-submit-content h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #1F2937;
    margin: 0 0 12px 0;
}

.auto-submit-content > p {
    color: #6B7280;
    font-size: 1.0625rem;
    margin: 0 0 32px 0;
}

.auto-submit-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top-color: #F97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.auto-submit-loading p {
    color: #6B7280;
    font-size: 0.9375rem;
    margin: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========================================
   TIME WARNING NOTIFICATION
======================================== */

.time-warning-notification {
    position: fixed;
    top: 100px;
    right: 30px;
    z-index: 99999;
    background: white;
    border-left: 4px solid #F59E0B;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideInRight 0.3s;
}

.time-warning-notification.fade-out {
    animation: slideOutRight 0.3s forwards;
}

.warning-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.warning-title {
    font-weight: 700;
    color: #D97706;
    font-size: 1rem;
    margin-bottom: 4px;
}

.warning-message {
    color: #6B7280;
    font-size: 0.875rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ========================================
   REVIEW MODE
======================================== */

.option-card.correct-answer {
    border-color: #10B981 !important;
    background: #D1FAE5 !important;
}

.option-card.correct-answer::after {
    content: 'Đáp án đúng';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #10B981;
    color: white;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 700;
}

.option-card.wrong-answer {
    border-color: #DC2626 !important;
    background: #FEE2E2 !important;
}

.option-card.wrong-answer::after {
    content: 'Sai';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #DC2626;
    color: white;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 700;
}

.tf-option.correct-answer {
    background: #D1FAE5 !important;
    border-color: #10B981 !important;
}

.tf-option.correct-answer .tf-label {
    color: #065F46 !important;
    font-weight: 700;
}

.tf-option.wrong-answer {
    background: #FEE2E2 !important;
    border-color: #DC2626 !important;
}

.tf-option.wrong-answer .tf-label {
    color: #991B1B !important;
    font-weight: 700;
}

.text-answer-review {
    margin-top: 16px;
    padding: 16px;
    background: #FAFBFC;
    border-radius: 12px;
    border-left: 4px solid #F97316;
}

.review-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.review-row:last-child {
    margin-bottom: 0;
}

.review-label {
    font-weight: 600;
    color: #6B7280;
    font-size: 0.9375rem;
    min-width: 120px;
}

.review-value {
    font-size: 1rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 8px;
    flex: 1;
}

.review-value.correct {
    background: #D1FAE5;
    color: #065F46;
}

.review-value.wrong {
    background: #FEE2E2;
    color: #991B1B;
    text-decoration: line-through;
}

/* ========================================
   EXPLANATION BOX
======================================== */

.explanation-box {
    background: #FFF7ED;
    border-left: 4px solid #F97316;
    padding: 20px 24px;
    border-radius: 12px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.explanation-title {
    font-weight: 700;
    color: #F97316;
    margin-bottom: 12px;
    font-size: 1.0625rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-content {
    color: #1F2937;
    line-height: 1.7;
    font-size: 0.9375rem;
}

/* ========================================
   GRID LEGEND - REVIEW MODE
======================================== */

.grid-legend {
    margin-top: 20px;
    padding: 16px;
    background: #FAFBFC;
    border-radius: 12px;
    border: 2px solid #E5E7EB;
}

.legend-title {
    font-weight: 700;
    color: #1F2937;
    font-size: 0.9375rem;
    margin-bottom: 12px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    border: 2px solid;
    flex-shrink: 0;
}

.legend-color.legend-correct {
    background: #10B981;
    border-color: #059669;
    color: white;
}

.legend-color.legend-correct::after {
    content: '✓';
}

.legend-color.legend-wrong {
    background: #EF4444;
    border-color: #DC2626;
    color: white;
}

.legend-color.legend-wrong::after {
    content: '✗';
}

.legend-color.legend-skipped {
    background: #9CA3AF;
    border-color: #6B7280;
    color: white;
}

.legend-color.legend-skipped::after {
    content: '−';
}

.legend-text {
    font-size: 0.9375rem;
    color: #1F2937;
    font-weight: 600;
}

.grid-btn.grid-correct {
    background: #10B981 !important;
    color: white !important;
    border-color: #059669 !important;
}

.grid-btn.grid-wrong {
    background: #EF4444 !important;
    color: white !important;
    border-color: #DC2626 !important;
}

.grid-btn.grid-skipped {
    background: #9CA3AF !important;
    color: white !important;
    border-color: #6B7280 !important;
}

.grid-btn.grid-correct::after,
.grid-btn.grid-wrong::after,
.grid-btn.grid-skipped::after {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    font-size: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.grid-btn.grid-correct::after {
    content: '✓';
    color: #10B981;
}

.grid-btn.grid-wrong::after {
    content: '✗';
    color: #EF4444;
}

.grid-btn.grid-skipped::after {
    content: '−';
    color: #9CA3AF;
    font-size: 0.75rem;
}

/* ========================================
   DISABLED STATE
======================================== */

input[type="radio"]:disabled + .option-circle {
    background: #E5E7EB;
    border-color: #D1D5DB;
    cursor: not-allowed;
}

input[type="radio"]:disabled:checked + .option-circle {
    background: #F97316;
    opacity: 0.6;
}

.option-card:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-card:has(input:disabled):hover {
    border-color: #E5E7EB !important;
    background: white !important;
    transform: none;
}

input[type="text"].text-answer-input:disabled {
    background-color: #F3F4F6 !important;
    cursor: not-allowed !important;
    color: #6B7280;
}

.tf-option:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.7;
}

.tf-option:has(input:disabled):hover {
    background: white !important;
    border-color: #E5E7EB !important;
}

.quiz-exam-wrapper.review-mode .option-card,
.quiz-exam-wrapper.review-mode .tf-option {
    pointer-events: auto;
    cursor: default;
}

/* ========================================
   FLOATING RETRY BUTTON
======================================== */

.floating-retry-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: #F97316;
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    transition: all 0.3s ease;
}

.floating-retry-btn:hover {
    background: #EA580C;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.5);
}

.floating-retry-btn svg {
    flex-shrink: 0;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.floating-retry-btn:hover svg {
    animation-play-state: paused;
}

/* ========================================
   IMAGES IN QUESTIONS
======================================== */

.question-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 16px 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.question-content img:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    transition: all 0.3s;
}

.option-text img,
.statement-text-content img {
    max-width: 100%;
    max-height: 300px;
    height: auto;
    display: block;
    margin: 12px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.explanation-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 16px 0;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.aligncenter {
    margin-left: auto;
    margin-right: auto;
}

.alignleft {
    float: left;
    margin: 5px 20px 15px 0;
}

.alignright {
    float: right;
    margin: 5px 0 15px 20px;
}

.question-content::after,
.option-text::after,
.statement-text-content::after,
.explanation-content::after {
    content: "";
    display: table;
    clear: both;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.875rem;
    color: #6B7280;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

/* ========================================
   RESPONSIVE - TABLET
======================================== */

@media (max-width: 1024px) and (min-width: 769px) {
    .quiz-exam-body {
        flex-direction: column;
    }

    .quiz-sidebar-panel {
        width: 100%;
        position: static;
    }

    .question-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 768px) {
    .question-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ========================================
   RESPONSIVE - MOBILE
======================================== */

@media (max-width: 768px) {
    .quiz-exam-wrapper {
        padding: 10px 0;
    }

    .quiz-exam-container {
        padding: 0 12px;
    }

    .quiz-exam-header {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        border-radius: 12px;
        margin-bottom: 14px;
    }
    
    .btn-fullscreen-mode {
        width: 100%;
        justify-content: center;
    }
    
    .quiz-exam-title {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }
    
    .meta-badge {
        font-size: 0.8125rem;
        padding: 6px 12px;
    }
    
    .quiz-exam-body {
        flex-direction: column;
        gap: 12px;
    }
    
    .quiz-sidebar-panel {
        order: 1;
        width: 100%;
        position: static;
        border-left: none;
        border-right: none;
        border-radius: 0;
        box-shadow: none;
    }

    .sidebar-content {
        padding: 56px 4px 20px 4px;
    }
    
    /* Questions area: bỏ padding ngang, dùng container padding */
    .quiz-questions-area {
        order: 2;
        padding: 20px 0;
        border-left: none;
        border-right: none;
        border-radius: 0;
        box-shadow: none;
    }

    /* Slide content có padding riêng */
    .question-slide {
        max-width: 100%;
        padding: 0 2px;
    }
    
    .question-content {
        font-size: 1rem;
    }
    
    .option-card {
        padding: 12px 14px;
    }
    
    .question-nav-btns {
        flex-direction: column;
    }
    
    .btn-next {
        margin-left: 0;
    }
    
    .question-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .tf-statement-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .statement-text {
        max-width: 100%;
    }
    
    .tf-options {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
        min-width: auto;
    }
    
    .tf-option {
        flex: 1;
        justify-content: center;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .confirm-actions {
        flex-direction: column;
    }
    
    .time-warning-notification {
        right: 20px;
        min-width: auto;
        max-width: calc(100% - 40px);
    }
    
    .floating-retry-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 20px;
        font-size: 0.9375rem;
    }
    
    .grid-legend {
        padding: 12px;
    }
    
    .legend-items {
        gap: 8px;
    }
    
    .legend-color {
        width: 28px;
        height: 28px;
    }
    
    .question-content img,
    .option-text img,
    .statement-text-content img,
    .explanation-content img {
        max-width: 100% !important;
        max-height: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        float: none !important;
    }
    
    .alignleft,
    .alignright {
        float: none !important;
        margin: 15px 0 !important;
    }
}

/* ========================================
   QUIZ INFO PAGE
======================================== */

.quiz-info-page {
    background: #FAFBFC;
    min-height: 100vh;
    padding: 60px 0;
    overflow-x: clip;
}

.quiz-info-page .container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 32px;
    width: 100%;
}

.quiz-info-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    align-items: start;
    width: 100%;
    min-width: 0;
}

.quiz-info-main {
    background: white;
    border: 1.5px solid #E5E7EB;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.quiz-info-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1F2937;
    margin: 0 0 20px 0;
    line-height: 1.3;
    letter-spacing: -0.02em;
    word-wrap: break-word;
}

.quiz-info-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F3F4F6;
}

.quiz-info-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9375rem;
    color: #6B7280;
    font-weight: 600;
}

.quiz-info-meta .meta-item svg {
    color: #F97316;
    flex-shrink: 0;
    opacity: 0.7;
}

.quiz-info-meta .meta-badge {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.quiz-info-meta .difficulty-easy   { background: #D1FAE5; color: #059669; }
.quiz-info-meta .difficulty-medium { background: #FEF3C7; color: #D97706; }
.quiz-info-meta .difficulty-hard   { background: #FED7AA; color: #EA580C; }
.quiz-info-meta .difficulty-very-hard { background: #FEE2E2; color: #DC2626; }

.quiz-info-description {
    margin-bottom: 32px;
    line-height: 1.8;
    color: #1F2937;
    font-size: 1rem;
    word-wrap: break-word;
	font-weight: 700;
}

.quiz-info-description p { margin-bottom: 16px; }
.quiz-info-description p:last-child { margin-bottom: 0; }

.quiz-info-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 28px;
}

.btn-start-exam {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 40px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.0625rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    text-decoration: none;
}

.btn-start-exam:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.btn-start-exam svg { flex-shrink: 0; }

.btn-download-exam {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1.0625rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    text-decoration: none;
}

.btn-download-exam:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    color: white;
}

.btn-download-exam svg { flex-shrink: 0; }

.quiz-questions-preview {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    overflow: visible;
    width: 100%;
    max-width: 100%;
}

.preview-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 14px 0;
    padding: 0 0 12px 0;
    background: transparent;
    border-bottom: 2px solid #E5E7EB;
}

.questions-preview-list {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.preview-question-block {
    background: white;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    padding: 14px 16px;
    transition: background 0.15s, border-color 0.15s;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.preview-question-block:hover {
    background: #FAFBFF;
    border-color: #93C5FD;
}

.preview-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E9EAEC;
}

.preview-question-number {
    font-size: 0.9375rem;
    font-weight: 800;
    color: #1e3a8a;
}

.preview-type-badge { padding: 2px 9px; border-radius: 50px; font-size: 0.6875rem; font-weight: 700; }
.badge-mc     { background: #DBEAFE; color: #1E40AF; }
.badge-tf     { background: #FEF3C7; color: #92400E; }
.badge-essay  { background: #FCE7F3; color: #9F1239; }

.preview-question-content {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #111827;
    margin-bottom: 10px;
    font-weight: 700;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.preview-options { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; width: 100%; }

.preview-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 10px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    transition: background 0.15s;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.preview-option:hover { background: #EFF6FF; border-color: #93C5FD; }
.preview-option-key { font-weight: 800; color: #1e3a8a; min-width: 20px; flex-shrink: 0; }
.preview-option-text { flex: 1; line-height: 1.55; color: #1F2937; font-size: 0.875rem; font-weight: 600; word-wrap: break-word; overflow-wrap: break-word; }

.preview-statements { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.preview-statement { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; background: white; border: 1.5px solid #E5E7EB; border-radius: 8px; width: 100%; max-width: 100%; box-sizing: border-box; }
.preview-stmt-key { font-weight: 700; color: #1e3a8a; min-width: 20px; flex-shrink: 0; }
.preview-stmt-text { flex: 1; line-height: 1.6; color: #1F2937; font-size: 0.9375rem; word-wrap: break-word; overflow-wrap: break-word; }
.preview-answer-type { padding: 10px 14px; background: white; border: 1.5px solid #E5E7EB; border-radius: 8px; color: #6B7280; font-size: 0.875rem; font-style: italic; width: 100%; max-width: 100%; box-sizing: border-box; }

.quiz-info-sidebar {
    position: sticky;
    top: 100px;
    min-width: 0;
}

.sidebar-sticky {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 100%;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: #1F2937;
    margin: 0;
    padding: 20px 24px;
    background: #FAFBFC;
    border-bottom: 2px solid #E5E7EB;
}

.related-quizzes-list { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.related-quiz-card {
    display: block;
    padding: 14px 16px;
    background: #FAFBFC;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.related-quiz-card:hover {
    border-color: #F97316;
    background: #FFF7ED;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.1);
}

.related-quiz-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

.related-quiz-card:hover .related-quiz-title { color: #F97316; }
.related-quiz-meta { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: #6B7280; font-weight: 600; }
.related-quiz-meta span { display: inline-flex; align-items: center; }
.no-related { color: #9CA3AF; font-size: 0.875rem; text-align: center; padding: 32px 20px; }

@media (max-width: 1024px) {
    .quiz-info-layout { grid-template-columns: 1fr; gap: 24px; }
    .quiz-info-sidebar { position: static; max-width: 100%; }
}

@media (max-width: 768px) {
    .quiz-info-page { padding: 24px 0 40px; }
    .quiz-info-page .container { padding: 0 14px; max-width: 100%; width: 100%; }
    .quiz-info-layout { grid-template-columns: 1fr !important; gap: 16px; width: 100%; }
    /* Main box: bỏ padding ngang — dùng container padding thay */
    .quiz-info-main { padding: 20px 0; border-radius: 0; border-left: none; border-right: none; width: 100%; max-width: 100%; margin: 0; box-shadow: none; }
    /* Các element bên trong main có padding riêng */
    .quiz-info-title { font-size: 1.375rem; word-wrap: break-word; }
    .quiz-info-meta { gap: 10px; }
    .quiz-info-meta .meta-item { font-size: 0.875rem; }
    .quiz-info-actions { flex-direction: column; width: 100%; }
    .btn-start-exam, .btn-download-exam { width: 100%; justify-content: center; padding: 14px 24px; font-size: 1rem; box-sizing: border-box; }
    /* Preview: full width, không padding ngang */
    .quiz-questions-preview { width: 100%; max-width: 100%; margin: 0; }
    .preview-title { font-size: 0.8125rem; padding: 0 0 10px 0; }
    .questions-preview-list { padding: 0; gap: 8px; width: 100%; }
    .preview-question-block { padding: 12px; width: 100%; max-width: 100%; margin: 0; border-radius: 8px; }
    .preview-question-content { font-size: 1rem; line-height: 1.6; }
    .preview-options { grid-template-columns: 1fr; gap: 5px; }
    .preview-option, .preview-statement, .preview-answer-type { padding: 9px 12px; width: 100%; max-width: 100%; margin: 0; }
    .preview-option-text, .preview-stmt-text { font-size: 0.9375rem; }
    .preview-passage-block { padding: 10px 12px; }
    .preview-passage-text { font-size: 0.9375rem; max-height: 180px; }
    .quiz-info-sidebar { position: static; width: 100%; max-width: 100%; }
    .sidebar-sticky { border-radius: 12px; width: 100%; max-width: 100%; margin: 0; }
    .sidebar-title { font-size: 1rem; padding: 16px 20px; }
    .related-quizzes-list { padding: 12px; }
    .related-quiz-card { padding: 14px; width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
    .quiz-info-page { padding: 20px 0 36px; }
    .quiz-info-page .container { padding: 0 12px; }
    .quiz-info-main { padding: 16px 0; border-radius: 0; border-left: none; border-right: none; box-shadow: none; }
    .quiz-info-title { font-size: 1.25rem; }
    .quiz-info-meta .meta-item { font-size: 0.8125rem; }
    .btn-start-exam, .btn-download-exam { padding: 12px 20px; font-size: 0.9375rem; }
    .btn-start-exam svg, .btn-download-exam svg { width: 20px; height: 20px; }
    .preview-title { font-size: 0.75rem; padding: 0 0 8px 0; }
    .questions-preview-list { padding: 0; gap: 7px; }
    .preview-question-block { padding: 10px 11px; }
    .preview-question-content { font-size: 0.9375rem; }
    .preview-option, .preview-statement, .preview-answer-type { padding: 8px 10px; }
    .preview-option-text, .preview-stmt-text { font-size: 0.9rem; }
    .sidebar-title { padding: 14px 16px; }
    .related-quizzes-list { padding: 10px; }
    .related-quiz-card { padding: 12px; }
}

.quiz-info-page * { max-width: 100%; box-sizing: border-box; }
.quiz-info-page img { max-width: 100%; height: auto; display: block; }
.quiz-info-page p, .quiz-info-page span, .quiz-info-page div { word-wrap: break-word; overflow-wrap: break-word; }
.quiz-info-page table { width: 100%; table-layout: fixed; }
.quiz-info-page pre, .quiz-info-page code { white-space: pre-wrap; word-break: break-all; }

/* ========================================
   RESULT BOX IN SIDEBAR
======================================== */

.result-box { background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%); border: 2px solid #E5E7EB; border-radius: 16px; padding: 24px 20px; margin-bottom: 20px; }
.result-score-display { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 2px solid #F3F4F6; }
.score-icon { font-size: 3rem; flex-shrink: 0; }
.score-info { flex: 1; }
.score-label { font-size: 0.875rem; font-weight: 600; color: #6B7280; margin-bottom: 6px; }
.score-value { font-size: 2.5rem; font-weight: 900; background: linear-gradient(135deg, #F97316 0%, #EA580C 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1; }
.result-stats-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-mini { background: white; border: 2px solid #E5E7EB; border-radius: 10px; padding: 12px 8px; text-align: center; transition: all 0.3s; }
.stat-mini.stat-correct { background: #D1FAE5; border-color: #10B981; }
.stat-mini.stat-wrong   { background: #FEE2E2; border-color: #EF4444; }
.stat-mini.stat-skip    { background: #FEF3C7; border-color: #F59E0B; }
.stat-mini-icon { font-size: 1.25rem; display: block; margin-bottom: 6px; font-weight: 700; }
.stat-mini.stat-correct .stat-mini-icon { color: #10B981; }
.stat-mini.stat-wrong   .stat-mini-icon { color: #EF4444; }
.stat-mini.stat-skip    .stat-mini-icon { color: #F59E0B; }
.stat-mini-value { font-size: 1.5rem; font-weight: 800; color: #1F2937; }
.btn-retry-quiz { width: 100%; padding: 14px 20px; background: #1e3a8a; color: white; border: none; border-radius: 12px; font-weight: 700; font-size: 0.9375rem; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25); }
.btn-retry-quiz:hover { background: #1e40af; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(30, 58, 138, 0.35); }
.btn-retry-quiz svg { flex-shrink: 0; }

.btn-other-quiz { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 20px; background: white; color: #374151; border: 1.5px solid #E5E7EB; border-radius: 12px; font-weight: 600; font-size: 0.9375rem; cursor: pointer; transition: all 0.3s; text-decoration: none; margin-top: 10px; }
.btn-other-quiz:hover { background: #F9FAFB; border-color: #1e3a8a; color: #1e3a8a; }
.btn-other-quiz svg { flex-shrink: 0; }

.review-explanation-btn { margin-top: 30px; padding-top: 25px; border-top: 2px solid #F3F4F6; }
.btn-view-explanation { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px 24px; background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%); color: white; border: none; border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3); }
.btn-view-explanation:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4); }
.btn-view-explanation svg { flex-shrink: 0; }

/* ========================================
   PDF VIEWER MODAL
======================================== */

.pdf-viewer-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); z-index: 100002; display: none; align-items: center; justify-content: center; animation: fadeIn 0.3s ease; }
.pdf-viewer-modal.active { display: flex; }
.pdf-viewer-container { width: 95%; height: 95vh; max-width: 1400px; background: white; border-radius: 20px; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.5); display: flex; flex-direction: column; }
.pdf-viewer-header { background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%); padding: 20px 30px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-shrink: 0; position: relative; overflow: hidden; }
.pdf-viewer-header::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 25% 50%, rgba(255,255,255,0.1) 0%, transparent 50%), radial-gradient(circle at 75% 60%, rgba(255,255,255,0.08) 0%, transparent 50%); }
.pdf-viewer-title { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; color: white; font-size: 1.25rem; font-weight: 700; }
.pdf-viewer-title svg { flex-shrink: 0; opacity: 0.9; }
.pdf-viewer-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; }
.btn-pdf-action { display: flex; align-items: center; gap: 8px; padding: 10px 18px; background: rgba(255,255,255,0.2); backdrop-filter: blur(10px); border: 1.5px solid rgba(255,255,255,0.3); border-radius: 10px; color: white; font-weight: 600; font-size: 0.9375rem; cursor: pointer; transition: all 0.3s; text-decoration: none; }
.btn-pdf-action:hover { background: rgba(255,255,255,0.3); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); color: white; }
.btn-pdf-action svg { flex-shrink: 0; }
.btn-pdf-close { background: rgba(239, 68, 68, 0.3); border-color: rgba(239, 68, 68, 0.5); }
.btn-pdf-close:hover { background: rgba(239, 68, 68, 0.5); }
.pdf-viewer-content { flex: 1; display: flex; flex-direction: column; background: #F3F4F6; position: relative; overflow: hidden; }
.pdf-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 10; }
.pdf-spinner { width: 60px; height: 60px; border: 4px solid #E5E7EB; border-top-color: #DC2626; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px; }
.pdf-loading-text { color: #6B7280; font-size: 1rem; font-weight: 600; }
.pdf-error { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; max-width: 400px; padding: 40px; background: white; border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.pdf-error-icon { font-size: 4rem; margin-bottom: 20px; }
.pdf-error-title { font-size: 1.25rem; font-weight: 800; color: #1F2937; margin-bottom: 10px; }
.pdf-error-message { color: #6B7280; margin-bottom: 20px; }
.btn-pdf-retry { padding: 12px 24px; background: #DC2626; color: white; border: none; border-radius: 10px; font-weight: 700; cursor: pointer; transition: all 0.3s; }
.btn-pdf-retry:hover { background: #991B1B; transform: translateY(-2px); }
.no-pdf-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; max-width: 500px; padding: 60px 40px; }
.no-pdf-icon { font-size: 5rem; margin-bottom: 24px; opacity: 0.5; }
.no-pdf-title { font-size: 1.5rem; font-weight: 800; color: #1F2937; margin-bottom: 12px; }
.no-pdf-message { color: #6B7280; line-height: 1.6; margin-bottom: 20px; }
.pdf-iframe-wrapper { flex: 1; overflow: auto; background: #FAFBFC; display: flex; align-items: center; justify-content: center; padding: 20px; }
.pdf-iframe { width: 100%; height: 100%; border: none; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); background: white; }

@media (max-width: 768px) {
    .result-score-display { flex-direction: column; text-align: center; }
    .score-icon { font-size: 2.5rem; }
    .score-value { font-size: 2rem; }
    .result-stats-mini { gap: 8px; }
    .stat-mini { padding: 10px 6px; }
    .stat-mini-icon { font-size: 1rem; }
    .stat-mini-value { font-size: 1.25rem; }
    .btn-retry-quiz { padding: 12px 18px; font-size: 0.875rem; }
    .btn-view-explanation { padding: 14px 20px; font-size: 0.9375rem; }
    .pdf-viewer-container { width: 100%; height: 100vh; max-width: none; border-radius: 0; }
    .pdf-viewer-header { padding: 15px 20px; flex-wrap: wrap; }
    .pdf-viewer-title { font-size: 1rem; }
    .pdf-viewer-actions { width: 100%; justify-content: space-between; order: 3; margin-top: 10px; }
    .btn-pdf-action { padding: 8px 14px; font-size: 0.875rem; flex: 1; justify-content: center; }
    .btn-pdf-action span { display: none; }
    .pdf-iframe-wrapper { padding: 10px; }
}

@media (max-width: 480px) {
    .result-box { padding: 20px 16px; }
    .score-value { font-size: 1.75rem; }
    .stat-mini-value { font-size: 1.125rem; }
}

/* ================================================================
   SECTION EXAM ADDON
================================================================ */

.question-section-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 50px;
    margin-bottom: 25px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    background: #F97316;
    color: white;
}

.question-slide[data-section="I"]   .question-section-badge { background: #1e40af; color: white; }
.question-slide[data-section="II"]  .question-section-badge { background: #92400E; color: white; }
.question-slide[data-section="III"] .question-section-badge { background: #065F46; color: white; }

.q-section-label { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; opacity: 0.9; }
.q-section-sep   { opacity: 0.5; font-size: 0.875rem; }
.q-sec-num       { font-size: 1.375rem; }
.q-sec-total     { font-size: 1rem; opacity: 0.85; }

.preview-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-radius: 8px;
    margin: 16px 0 8px 0;
}
.preview-section-header:first-child { margin-top: 0; }
.preview-section-badge { background: rgba(255,255,255,0.25); color: white; font-weight: 800; font-size: 0.8125rem; padding: 4px 12px; border-radius: 20px; flex-shrink: 0; letter-spacing: 0.05em; }
.preview-section-label { color: white; font-weight: 700; font-size: 1rem; flex: 1; }
.preview-section-count { color: rgba(255,255,255,0.8); font-size: 0.875rem; font-weight: 600; }

/* Passage block wrapper — hiện 1 lần cho cả nhóm */
.preview-passage-block {
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #FAFAFA;
}

/* Passage group: bỏ box vàng, chỉ wrap gọn */
.preview-passage-group-block {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 10px;
}

/* Instruction */
.preview-passage-instruction  { font-size: 0.875rem; font-style: italic; color: #92400E; margin-bottom: 8px; line-height: 1.6; }

/* Passage text box: giữ box trắng, không có wrapper vàng */
.preview-passage-text {
    background: #FAFAFA;
    border: 1px solid #E5E7EB;
    border-left: 3px solid #D1D5DB;
    border-radius: 0 6px 6px 0;
    padding: 10px 14px;
    font-size: 0.875rem;
    line-height: 1.75;
    color: #374151;
    max-height: 160px;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}
.preview-passage-text p { margin-bottom: 10px; }
.preview-passage-text p:last-child { margin-bottom: 0; }
.preview-passage-text > strong, .preview-passage-text > b { display: block; margin-top: 12px; margin-bottom: 4px; font-weight: 700; }
.preview-passage-text > strong:first-child, .preview-passage-text > b:first-child { margin-top: 0; }
.preview-passage-text > em, .preview-passage-text > i { display: block; margin-bottom: 8px; font-style: italic; }

/* Instruction box exam mode */
.passage-instruction-box {
    background: #EFF6FF;
    border: 1.5px solid #BFDBFE;
    border-left: 4px solid #3B82F6;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
    font-size: 0.9375rem;
    font-style: italic;
    color: #1E40AF;
    line-height: 1.7;
}
.passage-instruction-box p { margin-bottom: 6px; }
.passage-instruction-box p:last-child { margin-bottom: 0; }

/* Preview instruction block */
.preview-instruction-block {
    background: #EFF6FF;
    border-left: 3px solid #3B82F6;
    padding: 7px 12px;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
}
.preview-instruction-block .preview-passage-instruction {
    margin: 0;
    font-style: italic;
    color: #1E40AF;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ---- Passage box (exam mode) ---- */

.question-passage-box {
    background: #FFFBEB;
    border: 2px solid #F59E0B;
    border-radius: 14px;
    padding: 22px 26px;
    margin-bottom: 28px;
    max-height: 480px;
    overflow-y: auto;
}
.question-passage-box::-webkit-scrollbar { width: 6px; }
.question-passage-box::-webkit-scrollbar-track { background: #FEF3C7; border-radius: 3px; }
.question-passage-box::-webkit-scrollbar-thumb { background: #F59E0B; border-radius: 3px; }

.passage-instruction-inline {
    font-size: 0.9375rem;
    font-style: italic;
    color: #92400E;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid #FDE68A;
    line-height: 1.7;
}

.passage-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #92400E;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 14px;
}

.passage-content-inline {
    font-size: 1rem;
    line-height: 1.9;
    color: #1F2937;
    font-weight: 400;
}

.passage-content-inline p { margin-bottom: 14px; line-height: 1.9; }
.passage-content-inline p:last-child { margin-bottom: 0; }
.passage-content-inline > strong,
.passage-content-inline > b { display: block; margin-top: 16px; margin-bottom: 4px; font-weight: 700; color: #111827; }
.passage-content-inline > strong:first-child,
.passage-content-inline > b:first-child { margin-top: 0; }
.passage-content-inline > em,
.passage-content-inline > i { display: block; margin-bottom: 10px; font-style: italic; color: #374151; }
.passage-content-inline p strong,
.passage-content-inline p b  { font-weight: 700; color: #111827; }
.passage-content-inline p em,
.passage-content-inline p i  { font-style: italic; }
.passage-content-inline u    { text-decoration: underline; }
.passage-content-inline br { display: block; margin-bottom: 8px; content: ''; }
.passage-content-inline ul,
.passage-content-inline ol { margin: 10px 0 14px 20px; line-height: 1.9; }
.passage-content-inline ul { list-style: disc; }
.passage-content-inline ol { list-style: decimal; }
.passage-content-inline li { margin-bottom: 6px; }
.passage-content-inline h1,
.passage-content-inline h2,
.passage-content-inline h3,
.passage-content-inline h4 { font-weight: 700; color: #111827; margin: 14px 0 8px; line-height: 1.4; }
.passage-content-inline h1 { font-size: 1.25rem; }
.passage-content-inline h2 { font-size: 1.125rem; }
.passage-content-inline h3 { font-size: 1rem; }

/* Sidebar section grid */
.section-grid-wrapper { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.section-grid-group   { border: 1.5px solid #E5E7EB; border-radius: 12px; overflow: hidden; }
.section-grid-label   { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); }
.section-grid-label > span:first-child { color: white; font-weight: 800; font-size: 0.8125rem; letter-spacing: 0.05em; flex-shrink: 0; }
.section-grid-label-sub { color: rgba(255,255,255,0.75); font-size: 0.6875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-grid-group .question-grid { padding: 10px; background: #FAFBFC; margin-bottom: 0; }

.section-score-breakdown { background: #F9FAFB; border: 1.5px solid #E5E7EB; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.section-score-row   { display: flex; align-items: center; justify-content: space-between; font-size: 0.875rem; }
.section-score-label { color: #374151; font-weight: 600; }
.section-score-val   { font-weight: 800; font-size: 1rem; color: #9CA3AF; }
.section-score-val.all-correct { color: #10B981; }
.section-score-val.partial     { color: #F59E0B; }
.section-score-val.all-wrong   { color: #EF4444; }

@media (max-width: 768px) {
    .preview-passage-block { padding: 10px 12px; }
    .preview-passage-text { font-size: 0.9375rem; max-height: 180px; }
    .preview-instruction-block { padding: 8px 10px; }
    .quiz-info-page { padding: 24px 0 40px; }
    .question-passage-box { padding: 16px 18px; max-height: 55vh; min-height: 180px; border-radius: 12px; margin-bottom: 20px; }
    .passage-content-inline { font-size: 0.9375rem; line-height: 1.85; }
    .passage-instruction-inline { font-size: 0.875rem; }
    .section-grid-label-sub { display: none; }
    .preview-section-header { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
    .question-section-badge { padding: 8px 16px; }
    .q-sec-num { font-size: 1.125rem; }
    .preview-options { grid-template-columns: 1fr; gap: 5px; }
}

/* ========================================
   MOBILE SIDEBAR PANEL (sheet từ dưới)
======================================== */

@media (max-width: 768px) {

    /* Body: block, sidebar floating */
    .quiz-exam-body { display: block !important; }

    /* Questions area full width, chừa chỗ nút FAB */
    .quiz-questions-area {
        order: 1 !important;
        margin-bottom: 90px;
    }

    /* Sidebar KHÔNG chiếm layout space — chỉ fixed */
    .quiz-exam-body .quiz-sidebar-panel {
        display: block !important;
        width: 100% !important;
    }

    /* Panel: ẩn, fixed dưới màn hình */
    .quiz-sidebar-panel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-height: 75vh;
        border-radius: 20px 20px 0 0 !important;
        border: none !important;
        box-shadow: 0 -6px 30px rgba(0,0,0,0.2) !important;
        z-index: 9980;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        background: white;
        order: unset !important;
    }

    /* Handle bar */
    .quiz-sidebar-panel::before {
        content: '';
        display: block;
        width: 44px;
        height: 4px;
        background: #D1D5DB;
        border-radius: 2px;
        margin: 12px auto 0;
    }

    /* Khi mở */
    .quiz-sidebar-panel.mobile-open {
        transform: translateY(0) !important;
    }

    /* Sidebar content */
    .sidebar-content {
        max-height: calc(75vh - 30px);
        overflow-y: auto;
        padding: 12px 16px 40px !important;
    }

    /* Ẩn nút toggle desktop trên mobile */
    .sidebar-toggle { display: none !important; }

    /* Overlay */
    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 9970;
    }
    .mobile-sidebar-overlay.active { display: block; }
}


/* ========================================
   TOAST: CHƯA BẮT ĐẦU THI
======================================== */

.start-warning-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1F2937;
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 99999;
    opacity: 0;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    pointer-events: none;
}

.start-warning-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   FAB DANH SÁCH CÂU HỎI MOBILE
======================================== */

/* FAB mặc định ẩn */
.fab-question-list {
    display: none;
}

/* Mobile: hiện khi có data-active (JS set sau khi vào thi) */
@media (max-width: 768px) {
    .fab-question-list[data-active="1"] {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 24px;
        right: 16px;
        width: 52px;
        height: 52px;
        background: #F97316;
        color: white;
        border: none;
        border-radius: 14px;
        cursor: pointer;
        z-index: 9995;
        box-shadow: 0 4px 16px rgba(249,115,22,0.45);
        transition: transform 0.15s;
    }

    .fab-question-list[data-active="1"]:active {
        transform: scale(0.93);
    }

    .fab-question-list svg {
        flex-shrink: 0;
    }
}