/* Exam Page Specific Styles */
.exam-body {
    background: #f8fafc;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

.exam-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Exam Header */
.exam-header {
    background: white;
    border-bottom: 2px solid #e2e8f0;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.header-left .exam-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left .exam-title i {
    color: #2563eb;
    font-size: 20px;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef3c7;
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #fbbf24;
}

.timer-container i {
    color: #d97706;
}

#timer {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    color: #92400e;
}

.timer-container.warning {
    background: #fecaca;
    border-color: #f87171;
}

.timer-container.warning i,
.timer-container.warning #timer {
    color: #dc2626;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-weight: 500;
}

.student-info i {
    color: #2563eb;
}

/* Main Exam Layout */
.exam-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.exam-sidebar {
    width: 300px;
    background: white;
    border-right: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h3 i {
    color: #2563eb;
}

/* Progress Info */
.progress-info {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* Sections */
.sections {
    flex: 1;
    padding: 20px;
}

.section-group {
    margin-bottom: 30px;
}

.section-group h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
}

.question-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-btn:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.question-btn.current {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.question-btn.answered {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.question-btn.flagged {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.question-btn.selected {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

/* Sidebar Actions */
.sidebar-actions {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-actions .btn {
    width: 100%;
    justify-content: center;
}

/* Question Area */
.question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.question-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.question-number {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.question-marks {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.section-badge {
    background: #2563eb;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.btn-outline {
    background: transparent;
    border: 2px solid #e2e8f0;
    color: #64748b;
}

.btn-outline:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

.btn-outline.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}

/* Question Content */
.question-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: white;
}

.question-text {
    font-size: 16px;
    line-height: 1.6;
    color: #1e293b;
    margin-bottom: 24px;
}

.question-text strong {
    font-weight: 600;
}

/* Multiple Choice Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.option-item.selected {
    border-color: #2563eb;
    background: #eff6ff;
}

.option-item input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

.option-text {
    flex: 1;
    font-size: 15px;
    color: #374151;
}

/* Fill in the Blank */
.blank-input {
    display: inline-block;
    min-width: 120px;
    padding: 4px 8px;
    border: none;
    border-bottom: 2px solid #2563eb;
    background: transparent;
    font-size: 16px;
    font-weight: 500;
    color: #1e293b;
    margin: 0 4px;
}

.blank-input:focus {
    outline: none;
    border-bottom-color: #1d4ed8;
}

/* Text Areas */
.answer-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.answer-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.essay-textarea {
    min-height: 200px;
}

/* Matching Questions */
.matching-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.column-header {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    text-align: center;
}

.matching-item {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
}

.matching-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

/* Question Navigation */
.question-navigation {
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-info {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.submission-summary {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .exam-sidebar {
        width: 280px;
    }
    
    .exam-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .header-left .exam-title {
        font-size: 16px;
    }
    
    .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .matching-container {
        grid-template-columns: 1fr;
    }
    
    .question-navigation {
        flex-direction: column;
        gap: 16px;
    }
    
    .modal-content {
        margin: 20px;
    }
}

@media (max-width: 640px) {
    .exam-main {
        flex-direction: column;
    }
    
    .exam-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
    }
    
    .sections {
        padding: 12px;
    }
    
    .section-group {
        margin-bottom: 16px;
    }
    
    .question-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 6px;
    }
    
    .question-btn {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
}



/* Detailed Results Styles */
.detailed-results-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.detailed-results-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.score-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.score-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #ddd;
}

.score-card.correct {
    border-left-color: #4CAF50;
}

.score-card.incorrect {
    border-left-color: #f44336;
}

.score-card.unanswered {
    border-left-color: #ff9800;
}

.score-card h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #666;
}

.score-number {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
}

.questions-review {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.question-review-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    border-left: 4px solid #ddd;
}

.question-review-item:last-child {
    border-bottom: none;
}

.question-review-item.correct {
    border-left-color: #4CAF50;
    background: #f8fff8;
}

.question-review-item.incorrect {
    border-left-color: #f44336;
    background: #fff8f8;
}

.question-review-item.unanswered {
    border-left-color: #ff9800;
    background: #fffaf0;
}

.question-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: bold;
}

.status-icon {
    font-size: 1.2rem;
}

.question-id {
    color: #2c3e50;
    font-size: 0.9rem;
}

.score-display {
    margin-left: auto;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #495057;
}

.question-text {
    margin-bottom: 15px;
    color: #495057;
    line-height: 1.5;
}

.answer-comparison {
    display: grid;
    gap: 8px;
}

.user-answer, .correct-answer {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.user-answer {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.user-answer.correct {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.user-answer.incorrect {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.user-answer.unanswered {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.correct-answer {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* PDF Download Button */
#downloadPDFBtn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

#downloadPDFBtn:hover {
    background: #c82333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .score-summary {
        grid-template-columns: 1fr;
    }
    
    .question-header {
        flex-wrap: wrap;
    }
    
    .answer-comparison {
        grid-template-columns: 1fr;
    }
    
    .questions-review {
        max-height: 400px;
    }
}

