/* Exam Warning Modal Styles */
.exam-warning-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exam-warning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.exam-warning-content {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    margin: 1rem;
    display: flex;
    flex-direction: column;
}

.exam-warning-content h2 {
    color: #d32f2f;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
    border-bottom: 2px solid #f5f5f5;
    padding-bottom: 1rem;
}

.warning-text p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #333;
}

.warning-text strong {
    color: #d32f2f;
    font-weight: 600;
}

.warning-text ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.warning-text li {
    margin-bottom: 0.5rem;
    color: #555;
}

.final-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
    font-size: 1.1rem;
}

.warning-text {
    flex-grow: 1;
    overflow-y: auto;
}

.warning-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #f5f5f5;
    flex-shrink: 0;
    background: white;
}

.exam-cancel-btn,
.exam-accept-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.exam-cancel-btn {
    background: #6c757d;
    color: white;
}

.exam-cancel-btn:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.exam-accept-btn {
    background: #d32f2f;
    color: white;
}

.exam-accept-btn:hover {
    background: #b71c1c;
    transform: translateY(-1px);
}

/* Exam Interface Styles */
#exam-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid #e0e0e0;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 2rem;
    border-left: 4px solid #007bff;
}

.timer-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#exam-timer {
    font-size: 1.2rem;
    font-weight: 600;
    color: #d32f2f;
    font-family: 'Courier New', monospace;
}

.question-timer {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    color: #28a745;
    transition: all 0.3s ease;
}

.question-timer.time-warning {
    color: #ffc107;
    animation: pulse-warning 1s ease-in-out infinite alternate;
}

.question-timer.time-critical {
    color: #dc3545 !important;
    animation: pulse-critical 0.5s ease-in-out infinite alternate;
}

@keyframes pulse-warning {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0.7; transform: scale(1.05); }
}

@keyframes pulse-critical {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0.5; transform: scale(1.1); }
}

.question-content {
    padding: 1.5rem;
}

.question-text {
    margin-bottom: 2rem;
}

.question-text p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
}

.answer-options {
    margin: 2rem 0;
}

.question-progress {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #007bff;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
    min-width: fit-content;
}

/* Timeout Message Styling */
.timeout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.timeout-message {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
    margin: 1rem;
}

.timeout-message h3 {
    color: #dc3545;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.timeout-message p {
    margin-bottom: 0.5rem;
    color: #333;
}

.timeout-message small {
    color: #666;
    font-style: italic;
}

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

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

#answer-select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

#answer-select:focus {
    outline: none;
    border-color: #007bff;
}

#submit-answer {
    background: #28a745;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    margin-bottom: 2rem;
    display: block;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

#submit-answer:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

#submit-answer:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Results and Termination Styles */
.exam-results,
.exam-terminated {
    text-align: center;
    padding: 3rem 2rem;
}

.exam-results h2 {
    color: #28a745;
    margin-bottom: 2rem;
}

.exam-terminated h2 {
    color: #d32f2f;
    margin-bottom: 2rem;
}

.exam-results p,
.exam-terminated p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #555;
}

.exam-results button,
.exam-terminated button {
    background: #007bff;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s ease;
}

.exam-results button:hover,
.exam-terminated button:hover {
    background: #0056b3;
}

/* Security Overlay (when exam is active) */
body.exam-active {
    overflow: hidden;
}

body.exam-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.1);
    z-index: -1;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .exam-warning-content {
        margin: 0.5rem;
        padding: 1.5rem;
        max-height: 95vh;
    }
    
    .warning-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .exam-cancel-btn,
    .exam-accept-btn {
        width: 100%;
    }
    
    #exam-container {
        margin: 1rem;
        padding: 1rem;
        min-height: 70vh;
        overflow-y: auto;
    }
    
    #submit-answer {
        margin-bottom: 3rem;
        width: 100%;
        max-width: none;
    }
    
    .exam-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* Exam Dashboard Styles */
.exam-warning-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.exam-warning-notice p {
    margin: 0;
    color: #856404;
}

#exam-dashboard {
    max-width: 800px;
    margin: 0 auto;
}

.exam-list h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
}

.exam-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.exam-card h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.2rem;
}

.exam-card p {
    margin: 0.5rem 0;
    color: #666;
    font-size: 0.95rem;
}

.start-exam-btn {
    background: #d32f2f;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    display: block;
    width: fit-content;
}

.start-exam-btn:hover {
    background: #b71c1c;
    transform: translateY(-1px);
}

.hidden {
    display: none !important;
}

/* ========================================
   EXAM ACTIVE MODE - Full page takeover
   When body has .exam-active, only the exam is visible
   ======================================== */
body.exam-active {
    overflow: auto;
    background: #f0f2f5;
}

body.exam-active #auth-gate,
body.exam-active .auth-bar {
    display: none !important;
}

body.exam-active #protected-content {
    display: block !important;
    padding: 0;
    margin: 0;
}

body.exam-active #protected-content > header,
body.exam-active #protected-content > nav,
body.exam-active #protected-content > section:not(#exams),
body.exam-active #protected-content > .main-nav,
body.exam-active #exam-dashboard,
body.exam-active .exam-warning-notice {
    display: none !important;
}

body.exam-active #exams {
    padding: 0;
    margin: 0;
}

body.exam-active #exams > h2 {
    display: none;
}

body.exam-active #exam-container {
    display: flex !important;
    max-width: 900px;
    margin: 2rem auto;
    min-height: 80vh;
}

/* ========================================
   EXAM QUESTION CARD STYLES
   ======================================== */

.exam-question-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.exam-header-bar {
    background: linear-gradient(135deg, #1a237e 0%, #3949ab 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timer-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timer-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.timer-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffeb3b;
}

.question-counter {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
}

.question-timer-bar {
    background: #fff3e0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid #ffcc80;
}

.question-timer-label {
    color: #e65100;
    font-weight: 600;
}

.question-timer-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #d32f2f;
}

.question-content-area {
    padding: 2rem;
}

.question-text {
    font-size: 1.25rem;
    color: #1a237e;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.answer-option:hover {
    background: #e3f2fd;
    border-color: #1976d2;
}

.answer-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    accent-color: #1976d2;
}

.answer-option input[type="radio"]:checked + .option-letter {
    background: #1976d2;
    color: white;
}

.option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #e0e0e0;
    color: #333;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 1rem;
    transition: all 0.2s ease;
}

.option-text {
    font-size: 1.05rem;
    color: #333;
}

.submit-answer-btn {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    margin: 0 auto;
}

.submit-answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.4);
}

/* Results styling */
.exam-results-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.exam-results-card h2 {
    color: #1a237e;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.score-display {
    font-size: 3rem;
    font-weight: bold;
    color: #43a047;
    margin: 1rem 0;
}

.score-details {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.return-dashboard-btn {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.return-dashboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .exam-header-bar {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .question-content-area {
        padding: 1.5rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .answer-option {
        padding: 0.75rem 1rem;
    }
}