/* Simple Exam Screen Styles */
#exam-screen {
    display: none;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

#exam-screen.active {
    display: block;
}

.exam-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.exam-main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    margin-top: 20px;
}

.question-navigator {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    height: fit-content;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.question-navigator h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.question-number {
    width: 40px;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    color: #495057;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-number:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.question-number.current {
    background: #007bff !important;
    border-color: #007bff !important;
    color: white !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25) !important;
}

.question-number.answered {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Màu xanh lá cho câu đúng - độ ưu tiên cao nhất */
.question-number.answered.correct {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    box-shadow: 0 0 5px rgba(40, 167, 69, 0.5) !important;
}

/* Màu đỏ cho câu sai - độ ưu tiên cao nhất */
.question-number.answered.incorrect {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
    box-shadow: 0 0 5px rgba(220, 53, 69, 0.5) !important;
}

.question-number.correct {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.question-number.incorrect {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.question-number.unanswered {
    background: white;
    border-color: #dee2e6;
    color: #6c757d;
}

.navigator-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.legend-color.current {
    background: #007bff;
    border-color: #007bff;
}

.legend-color.answered {
    background: #28a745;
    border-color: #28a745;
}

.legend-color.correct {
    background: #28a745;
    border-color: #28a745;
}

.legend-color.incorrect {
    background: #dc3545;
    border-color: #dc3545;
}

.legend-color.unanswered {
    background: white;
    border-color: #dee2e6;
}

.question-content {
    flex: 1;
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.exam-header h2 {
    color: #2c3e50;
    margin: 0;
}

.exam-info {
    display: flex;
    gap: 20px;
    font-weight: bold;
}

#exam-progress {
    color: #3498db;
}

#exam-timer {
    color: #e74c3c;
}

.question-container {
    margin-bottom: 30px;
}

.question-number {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 18px;
}

.question-content {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #34495e;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

.option input[type="radio"] {
    margin-right: 10px;
}

.option label {
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.exam-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.exam-navigation button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.exam-navigation button:not(.submit-btn) {
    background-color: #3498db;
    color: white;
}

.exam-navigation button:not(.submit-btn):hover {
    background-color: #2980b9;
}

.submit-btn {
    background-color: #27ae60;
    color: white;
}

.submit-btn:hover {
    background-color: #229954;
}

/* Responsive */
@media (max-width: 768px) {
    #exam-screen {
        padding: 10px;
    }
    
    .exam-main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .question-navigator {
        order: 2;
        margin-top: 20px;
    }
    
    .question-content {
        order: 1;
    }
    
    .question-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 6px;
    }
    
    .question-number {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .navigator-legend {
        flex-direction: row;
        justify-content: space-around;
        flex-wrap: wrap;
    }
    
    .exam-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .exam-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .exam-navigation button {
        width: 100%;
    }
}

/* Instant Feedback Styles for Immediate Answer Display */
.instant-feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease-out;
    animation: slideInFeedback 0.4s ease-out forwards;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes slideInFeedback {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.instant-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.instant-feedback.correct {
    background: linear-gradient(135deg, #d4f6d4, #c8f7c5);
    border-color: #28a745;
    color: #155724;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.instant-feedback.wrong {
    background: linear-gradient(135deg, #f8d7da, #f5c2c7);
    border-color: #dc3545;
    color: #721c24;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.instant-feedback.critical {
    border-width: 3px;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.4);
    animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
    0%, 100% { box-shadow: 0 0 15px rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 25px rgba(220, 53, 69, 0.6); }
}

.feedback-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
}

.feedback-icon {
    font-size: 22px;
    animation: iconBounce 0.6s ease-out;
}

@keyframes iconBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.critical-badge {
    background: #dc3545;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    margin-left: auto;
    animation: badgePulse 1s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.feedback-answer {
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    font-weight: bold;
    border-left: 4px solid currentColor;
}

.feedback-explanation {
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    font-style: italic;
    line-height: 1.5;
}

/* Enhanced Option States for Instant Scoring */
.option {
    position: relative;
    transition: all 0.3s ease-out;
    cursor: pointer;
    border: 2px solid transparent;
    margin: 8px 0;
    padding: 12px;
    border-radius: 8px;
    background: #f8f9fa;
}

.option:hover {
    background: #e9ecef;
    transform: translateX(2px);
}

.option.correct-answer {
    background: linear-gradient(135deg, #d4f6d4, #c8f7c5) !important;
    border: 3px solid #28a745 !important;
    color: #155724 !important;
    transform: scale(1.02) !important;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3) !important;
    animation: correctPulse 0.6s ease-out !important;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1.02); }
}

.option.wrong-answer {
    background: linear-gradient(135deg, #f8d7da, #f5c2c7) !important;
    border: 3px solid #dc3545 !important;
    color: #721c24 !important;
    transform: scale(1.02) !important;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3) !important;
    animation: wrongShake 0.6s ease-out !important;
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0) scale(1.02); }
    25% { transform: translateX(-3px) scale(1.02); }
    75% { transform: translateX(3px) scale(1.02); }
}

.option.user-selected {
    border-width: 4px !important;
    font-weight: bold !important;
    position: relative;
}

.option.user-selected::before {
    content: "👆";
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    animation: pointingHand 1s ease-in-out infinite;
}

@keyframes pointingHand {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(3px); }
}

.option.correct-answer::after {
    content: "✅";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    animation: checkmarkBounce 0.6s ease-out;
}

.option.wrong-answer::after {
    content: "❌";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    animation: crossShake 0.6s ease-out;
}

@keyframes checkmarkBounce {
    0% { transform: translateY(-50%) scale(0) rotate(-180deg); opacity: 0; }
    50% { transform: translateY(-50%) scale(1.3) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-50%) scale(1) rotate(0deg); opacity: 1; }
}

@keyframes crossShake {
    0% { transform: translateY(-50%) scale(0) rotate(0deg); opacity: 0; }
    50% { transform: translateY(-50%) scale(1.3) rotate(10deg); opacity: 1; }
    100% { transform: translateY(-50%) scale(1) rotate(0deg); opacity: 1; }
}

/* Disabled state for options after selection */
.option.disabled {
    pointer-events: none !important;
    position: relative;
    overflow: hidden;
}

.option.disabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

/* Submit actions styling */
.submit-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    justify-content: center;
    align-items: center;
}

.btn-submit, .btn-review {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-submit {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-review {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
    color: white;
}

.btn-submit:hover, .btn-review:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-submit:active, .btn-review:active {
    transform: translateY(0);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .instant-feedback {
        margin: 15px 0;
        padding: 12px;
    }
    
    .feedback-header {
        font-size: 14px;
    }
    
    .submit-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-submit, .btn-review {
        width: 100%;
        padding: 12px;
    }
    
    .option.correct-answer::after,
    .option.wrong-answer::after {
        font-size: 16px;
        right: 10px;
    }
}
