/* ==========================================================================
   FRONTEND STYLE - AK EXAM (GIAO DIỆN HIỆN ĐẠI & CHUYÊN NGHIỆP)
   ========================================================================== */

:root {
    --exam-primary-color: #2563eb;       /* Xanh dương hiện đại */
    --exam-primary-hover: #1d4ed8;
    --exam-secondary-color: #3b82f6;
    --exam-light-bg: #f8fafc;            /* Nền xám nhạt dịu mắt */
    --exam-border-color: #e2e8f0;
    --exam-text-main: #1e293b;
    --exam-text-muted: #64748b;
    --exam-success-color: #10b981;       /* Xanh lá success */
    --exam-error-color: #ef4444;         /* Đỏ error */
    --exam-warning-color: #f59e0b;       /* Vàng cảnh báo */
    --exam-answered-bg: #ecfdf5;
    --exam-radius-lg: 12px;
    --exam-radius-md: 8px;
    --exam-radius-sm: 6px;
    --exam-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --exam-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --exam-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* ==========================================================================
   GLOBAL WRAPPER
   ========================================================================== */
.ak-exam-wrapper, .ak-lookup-wrapper, .ak-grading-center-wrapper, .ak-live-tracking-wrapper {
    font-family: var(--font-family);
    color: var(--exam-text-main);
    background-color: #ffffff;
    line-height: 1.6;
    box-sizing: border-box;
    border: 1px solid var(--exam-border-color);
    border-radius: var(--exam-radius-lg);
    box-shadow: var(--exam-shadow-md);
    padding: 30px;
    margin-bottom: 30px;
}

.ak-exam-wrapper *, .ak-live-tracking-wrapper *, .ak-grading-center-wrapper * {
    box-sizing: inherit;
}

/* ==========================================================================
   LOGIN & CONFIRMATION SCREENS
   ========================================================================== */
#ak-exam-login, #ak-exam-confirmation-content { 
    max-width: 450px; 
    margin: 60px auto; 
    padding: 40px; 
    border-radius: var(--exam-radius-lg);
    background: #ffffff;
    box-shadow: var(--exam-shadow-lg);
    border: 1px solid var(--exam-border-color);
    text-align: center; 
}

#ak-exam-login .exam-title, #ak-exam-confirmation-content h2 { 
    font-size: 1.75em; 
    font-weight: 700;
    color: var(--exam-primary-color);
    margin-top: 0; 
    margin-bottom: 15px; 
}

#ak-exam-login p, #ak-exam-confirmation-content p { 
    font-size: 1.05em; 
    color: var(--exam-text-muted); 
    margin-bottom: 25px;
}

.form-group-stack { text-align: left; margin-bottom: 20px; }
.form-group-stack label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 600; 
    color: var(--exam-text-main);
}
.form-group-stack input, .form-group-stack select { 
    width: 100%; 
    padding: 14px; 
    border: 2px solid var(--exam-border-color); 
    border-radius: var(--exam-radius-md); 
    font-size: 1em; 
    transition: all 0.2s ease;
    outline: none;
    background-color: #fff;
}
.form-group-stack input:focus, .form-group-stack select:focus {
    border-color: var(--exam-primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ak-btn-primary, #start-exam-btn, #confirm-and-start-btn { 
    width: 100%; 
    padding: 14px 25px; 
    border: none; 
    background-color: var(--exam-primary-color); 
    color: white; 
    font-size: 1.1em; 
    font-weight: 600; 
    cursor: pointer; 
    border-radius: var(--exam-radius-md); 
    transition: all 0.2s ease; 
    margin-top: 10px; 
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.ak-btn-primary:hover, #start-exam-btn:hover { 
    background-color: var(--exam-primary-hover); 
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}
#confirm-and-start-btn {
    background-color: var(--exam-success-color);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}
#confirm-and-start-btn:hover {
    background-color: #059669;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

#start-exam-btn:disabled, #confirm-and-start-btn:disabled { 
    background-color: #cbd5e1; 
    color: #94a3b8;
    cursor: not-allowed; 
    box-shadow: none;
    transform: none;
}
.error-message { color: var(--exam-error-color); margin-top: 15px; font-weight: 500; font-size: 0.95em; }

#ak-exam-confirmation-content .info-box {
    background: var(--exam-light-bg);
    border: 1px solid var(--exam-border-color);
    border-radius: var(--exam-radius-md);
    padding: 25px;
    margin: 25px 0;
    text-align: left;
}
#ak-exam-confirmation-content .info-box p {
    margin: 12px 0;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    color: var(--exam-text-main);
}
#ak-exam-confirmation-content .info-box p strong {
    display: inline-block;
    width: 140px;
    flex-shrink: 0;
    color: var(--exam-text-muted);
}

/* ==========================================================================
   MAIN EXAM INTERFACE (MCQ & ESSAY)
   ========================================================================== */
#ak-exam-main { display: none; flex-direction: column; min-height: 600px; margin: -30px; }

.ak-exam-header { 
    padding: 15px 30px; 
    background: #ffffff; 
    border-bottom: 1px solid var(--exam-border-color); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-radius: var(--exam-radius-lg) var(--exam-radius-lg) 0 0;
}
.ak-exam-header-info {
    font-size: 1.05em;
    color: var(--exam-text-muted);
}
.ak-exam-header-info span { 
    font-weight: 700; 
    color: var(--exam-text-main);
    background: var(--exam-light-bg);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--exam-border-color);
    margin-left: 8px;
}

/* Nút Toggle trên Desktop và Mobile */
.mobile-nav-toggle {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--exam-light-bg);
    color: var(--exam-text-main);
    border: 1px solid var(--exam-border-color);
    border-radius: var(--exam-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.mobile-nav-toggle:hover {
    background-color: #e2e8f0;
}

#ak-exam-content-area { display: flex; flex-grow: 1; background: var(--exam-light-bg); border-radius: 0 0 var(--exam-radius-lg) var(--exam-radius-lg); overflow: hidden; }

/* Left Panel - Navigation */
.ak-exam-left-panel {
    width: 320px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--exam-border-color);
    padding: 25px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}
/* Trạng thái thu gọn trên Desktop */
.ak-exam-left-panel.is-collapsed {
    display: none !important;
}

.ak-exam-left-panel h3 { 
    margin-top: 0; 
    font-size: 1.1em;
    color: var(--exam-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}
.question-navigation { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr)); 
    gap: 12px; 
    margin-bottom: 30px; 
    flex-grow: 1; 
    align-content: flex-start; 
}
.nav-button { 
    height: 45px; 
    border: 2px solid var(--exam-border-color); 
    background: #ffffff; 
    cursor: pointer; 
    border-radius: var(--exam-radius-sm); 
    font-size: 15px; 
    font-weight: 600;
    color: var(--exam-text-muted);
    transition: all 0.2s;
}
.nav-button:hover {
    border-color: var(--exam-secondary-color);
    color: var(--exam-primary-color);
}
.nav-button.active { 
    background: var(--exam-primary-color); 
    color: white; 
    border-color: var(--exam-primary-color); 
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.nav-button.answered { 
    background: var(--exam-answered-bg); 
    color: var(--exam-success-color);
    border-color: var(--exam-success-color); 
}
.nav-button.answered.active {
    background: var(--exam-success-color);
    color: white;
}

.exam-timer { 
    text-align: center; 
    font-size: 1.8em; 
    font-weight: 700; 
    color: var(--exam-error-color);
    padding: 20px; 
    background: #fef2f2; 
    border-radius: var(--exam-radius-md); 
    margin-bottom: 20px; 
    border: 1px solid #fca5a5; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

#submit-mcq-btn, #submit-essay-btn { 
    width: 100%; 
    padding: 16px; 
    font-size: 1.1em; 
    font-weight: bold;
    background: var(--exam-warning-color); 
    color: white; 
    border: none; 
    border-radius: var(--exam-radius-md); 
    cursor: pointer; 
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
}
#submit-mcq-btn:hover { background: #d97706; transform: translateY(-1px); }
#submit-essay-btn { display: block; margin: 40px auto 0; max-width: 300px; background-color: var(--exam-success-color); box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2); }
#submit-essay-btn:hover { background-color: #059669; }

/* Right Panel - Question Content */
.ak-exam-right-panel { 
    flex-grow: 1; 
    padding: 40px; 
    display: flex; 
    flex-direction: column; 
    background: #ffffff;
}
.ak-exam-warning { 
    padding: 12px 20px; 
    background-color: #fffbeb; 
    border-left: 4px solid var(--exam-warning-color); 
    color: #92400e; 
    border-radius: 0 var(--exam-radius-md) var(--exam-radius-md) 0; 
    margin-bottom: 30px; 
    font-size: 0.95em;
}

.question-title { 
    font-size: 1.3em; 
    font-weight: 600;
    line-height: 1.6;
    margin-top: 0; 
    color: var(--exam-text-main);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--exam-border-color);
}
.answers-list { margin: 25px 0; }
.answer-item { 
    margin-bottom: 15px; 
    padding: 18px 20px; 
    border: 2px solid var(--exam-border-color); 
    border-radius: var(--exam-radius-md); 
    display: flex; 
    align-items: center; 
    cursor: pointer; 
    transition: all 0.2s ease;
    background: #ffffff;
}
.answer-item:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.answer-item input[type="radio"] { 
    margin-right: 20px; 
    width: 22px; 
    height: 22px; 
    flex-shrink: 0; 
    cursor: pointer;
    accent-color: var(--exam-primary-color);
}
.answer-item label {
    cursor: pointer;
    font-size: 1.1em;
    width: 100%;
}
.answer-item.selected {
    border-color: var(--exam-primary-color);
    background: #eff6ff;
}

.question-pagination { 
    margin-top: auto; 
    padding-top: 25px; 
    border-top: 1px solid var(--exam-border-color); 
    display: flex; 
    justify-content: space-between; 
}
.question-pagination button { 
    padding: 12px 25px; 
    border: 1px solid var(--exam-border-color); 
    background: #ffffff; 
    color: var(--exam-text-main);
    border-radius: var(--exam-radius-md); 
    cursor: pointer; 
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: var(--exam-shadow-sm);
}
.question-pagination button:hover:not(:disabled) {
    background: var(--exam-light-bg);
    border-color: #cbd5e1;
}
.question-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   ESSAY SECTION
   ========================================================================== */
#essay-panel {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px;
    box-sizing: border-box;
    background: #ffffff;
}
#essay-panel > h3 {
    font-size: 1.6em;
    color: var(--exam-primary-color);
    border-bottom: 2px solid var(--exam-primary-color);
    padding-bottom: 10px;
    display: inline-block;
    margin-top: 0;
}
.essay-item { 
    margin-bottom: 40px; 
    background: #ffffff;
    border: 1px solid var(--exam-border-color);
    border-radius: var(--exam-radius-md);
    padding: 25px;
    box-shadow: var(--exam-shadow-sm);
}
.essay-item h4 {
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--exam-text-main);
    line-height: 1.5;
}
.essay-editor-container {
    border-radius: var(--exam-radius-md);
    overflow: hidden;
    border: 1px solid var(--exam-border-color);
}

/* ==========================================================================
   TRANSITION & FINISHED VIEWS
   ========================================================================== */
.exam-result, .exam-finished-notice {
    text-align: center;
    padding: 50px 30px;
    width: 100%;
    max-width: 600px;
    margin: 40px auto;
    border: none;
    background-color: #ffffff;
    border-radius: var(--exam-radius-lg);
    box-shadow: var(--exam-shadow-lg);
}
.exam-result .icon-success, .exam-finished-notice .icon-success {
    font-size: 40px;
    color: white;
    background-color: var(--exam-success-color);
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    margin: 0 auto 25px auto;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}
.exam-result h2, .exam-finished-notice h2 {
    font-size: 1.8em;
    color: var(--exam-text-main);
    margin: 0 0 20px 0;
}
.exam-result p, .exam-finished-notice p {
    font-size: 1.15em;
    margin: 10px 0;
    color: var(--exam-text-muted);
}
.exam-result .score-details {
    font-size: 1.5em;
    font-weight: 800;
    color: var(--exam-primary-color);
    background: #eff6ff;
    padding: 5px 15px;
    border-radius: 8px;
    display: inline-block;
    margin-left: 10px;
}
#start-essay-btn, #start-attempt-2-btn {
    margin-top: 30px;
    padding: 14px 30px;
    font-size: 1.1em;
    font-weight: bold;
    background-color: var(--exam-primary-color);
    border: none;
    border-radius: var(--exam-radius-md);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}
#start-essay-btn:hover, #start-attempt-2-btn:hover {
    background-color: var(--exam-primary-hover);
    transform: translateY(-1px);
}

/* HIỆU ỨNG NHẤP NHÁY VIỀN CHO HỘP CẢNH BÁO AUTO SUBMIT */
.auto-submit-warning {
    margin-top: 25px;
    padding: 20px;
    background-color: #fff1f2;
    border: 2px dashed var(--exam-error-color);
    border-radius: var(--exam-radius-md);
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0% { border-color: #fca5a5; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { border-color: #ef4444; box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { border-color: #fca5a5; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.exam-finished-notice .candidate-name { font-size: 1.6em; font-weight: 800; color: var(--exam-primary-color); margin: 10px 0; }
.exam-finished-notice .candidate-code { font-size: 1.3em; font-weight: bold; background: var(--exam-light-bg); padding: 5px 15px; border-radius: 8px; display: inline-block; }
.exam-finished-notice .proof-instruction { margin-top: 30px; font-style: italic; color: #92400e; background-color: #fef3c7; padding: 15px; border-radius: var(--exam-radius-md); border: 1px dashed #f59e0b; }

/* ==========================================================================
   TRUNG TÂM CHẤM THI (FRONTEND) - GIAO DIỆN MỚI
   ========================================================================== */
.examiner-selector-block {
    background: var(--exam-light-bg);
    padding: 25px;
    border-radius: var(--exam-radius-md);
    margin-bottom: 30px;
    border: 1px solid var(--exam-border-color);
}

.grading-main-title { margin: 0 0 20px 0; color: var(--exam-primary-color); font-size: 1.8em; }

.examiner-field { display: flex; align-items: center; gap: 15px; }
.examiner-select { flex-grow: 1; padding: 12px; border-radius: var(--exam-radius-md); border: 1px solid var(--exam-border-color); outline: none; background: #fff;}
.examiner-select:focus { border-color: var(--exam-primary-color); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

/* Workspace Layout */
.grading-center-layout {
    display: flex;
    gap: 0;
    height: 700px;
    border: 1px solid var(--exam-border-color);
    border-radius: var(--exam-radius-md);
    overflow: hidden;
    background: #fff;
}

/* Sidebar danh sách */
.grading-sidebar {
    width: 350px;
    border-right: 1px solid var(--exam-border-color);
    display: flex;
    flex-direction: column;
    background: #fcfcfc;
}

.search-box-wrapper { padding: 15px; border-bottom: 1px solid var(--exam-border-color); }
#submission_search { width: 100%; padding: 10px; border-radius: var(--exam-radius-sm); border: 1px solid var(--exam-border-color); outline:none; }
#submission_search:focus { border-color: var(--exam-primary-color); }

.grading-tabs { display: flex; border-bottom: 1px solid var(--exam-border-color); }
.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f1f5f9;
    cursor: pointer;
    font-weight: 600;
    color: var(--exam-text-muted);
    transition: all 0.2s;
    outline: none;
}
.tab-btn.active { background: #fff; color: var(--exam-primary-color); border-bottom: 2px solid var(--exam-primary-color); }

.submission-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex-grow: 1; }
.submission-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--exam-border-color);
    cursor: pointer;
    transition: background 0.2s;
}
.submission-item:hover { background: #f8fafc; }
.submission-item.active { background: #eff6ff; border-left: 4px solid var(--exam-primary-color); padding-left: 11px; }

.sub-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--exam-primary-color);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: bold; margin-right: 12px; flex-shrink: 0;
}
.sub-info { flex-grow: 1; overflow: hidden; }
.sub-info strong { display: block; color: var(--exam-text-main); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-info span { font-size: 12px; color: var(--exam-text-muted); }

/* Content hiển thị bài làm */
.grading-content { flex-grow: 1; padding: 30px; overflow-y: auto; background: #fff; }

.grading-header { border-bottom: 2px solid var(--exam-light-bg); padding-bottom: 20px; margin-bottom: 20px; }
.grading-header h3 { margin: 0 0 10px 0; color: var(--exam-text-main); }
.exam-badge { background: var(--exam-primary-color); color: #fff; padding: 4px 10px; border-radius: 4px; font-size: 12px; display: inline-block;}

.empty-state { text-align: center; padding: 60px 20px; color: var(--exam-text-muted); }
.empty-state .empty-icon { width: 64px; height: 64px; color: #cbd5e1; margin: 0 auto 20px auto; }

.grading-body { margin-bottom: 40px; }
.grading-item-container { margin-bottom: 30px; }
.grading-question-content { background: var(--exam-light-bg); padding: 15px; border-radius: var(--exam-radius-sm); margin-bottom: 10px; border: 1px solid var(--exam-border-color); }
.grading-essay-answer { border-left: 4px solid var(--exam-secondary-color); padding: 15px; background: #f0f9ff; white-space: pre-wrap; line-height: 1.7; font-size: 1.05em; border-radius: 0 var(--exam-radius-sm) var(--exam-radius-sm) 0;}

/* Panel chấm điểm */
.grading-action-panel {
    background: #f8fafc;
    padding: 25px;
    border-radius: var(--exam-radius-md);
    border: 1px solid var(--exam-border-color);
}
.grading-action-panel h4 { margin-top: 0; color: var(--exam-text-main); }
.score-input-group { display: flex; align-items: center; gap: 15px; margin-top: 15px; flex-wrap: wrap; }
#examiner_score { width: 120px; padding: 12px; border: 1px solid var(--exam-border-color); border-radius: var(--exam-radius-sm); outline: none; font-size: 1.1em;}
#examiner_score:focus { border-color: var(--exam-primary-color); }
#submit-grade-btn { margin: 0; width: auto; padding: 12px 25px; }

/* ==========================================================================
   GIÁM SÁT KỲ THI (LIVE TRACKING) - GIAO DIỆN MỚI
   ========================================================================== */
.ak-live-tracking-wrapper {
    max-width: 100%;
    margin: 20px auto;
}
.ak-live-tracking-wrapper h1 {
    font-size: 1.8em;
    color: var(--exam-text-main);
    margin-top: 0;
    margin-bottom: 20px;
}
.tracking-controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--exam-radius-md);
    border: 1px solid var(--exam-border-color);
    margin-bottom: 25px;
}
.tracking-search-box {
    width: 350px;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: var(--exam-radius-md);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.tracking-search-box:focus {
    border-color: var(--exam-primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.live-tracking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #ffffff;
    border-radius: var(--exam-radius-md);
    overflow: hidden;
    box-shadow: var(--exam-shadow-sm);
    border: 1px solid var(--exam-border-color);
}
.live-tracking-table th, .live-tracking-table td {
    padding: 15px;
    border-bottom: 1px solid var(--exam-border-color);
    text-align: left;
}
.live-tracking-table thead th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}
.live-tracking-table tbody tr {
    transition: background-color 0.2s;
}
.live-tracking-table tbody tr:hover {
    background-color: #f8fafc;
}
.live-tracking-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badge Trạng Thái cho Giám Sát */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}
.status-chua-thi { background-color: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.status-dang-thi { background-color: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }
.status-truot-l1 { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.status-dat { background-color: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }
.status-truot { background-color: #fef2f2; color: #991b1b; border: 1px solid #ef4444; }
.status-cho-cham { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ==========================================================================
   KIỂU DÁNG CHO TRANG TRA CỨU KẾT QUẢ
   ========================================================================== */
.ak-lookup-wrapper { max-width: 500px; margin: 40px auto; }
.ak-lookup-wrapper h3 { font-size: 1.5em; color: var(--exam-primary-color); border-bottom: 2px solid var(--exam-primary-color); padding-bottom: 10px; margin-top: 0;}
.ak-result-box { margin-top: 25px; padding: 20px; border-radius: var(--exam-radius-md); box-shadow: var(--exam-shadow-sm); }
.ak-result-box.success { background-color: #ecfdf5; border: 1px solid #a7f3d0; }
.ak-result-box.success h4 { color: #065f46; margin-top: 0; font-size: 1.2em;}
.ak-result-box.error { background-color: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-weight: 500;}

/* ==========================================================================
   CUSTOM MODAL SYSTEM
   ========================================================================== */
.ak-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.ak-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.ak-modal-box {
    background: #ffffff;
    width: 90%;
    max-width: 400px;
    border-radius: var(--exam-radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-30px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ak-modal-overlay.active .ak-modal-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ak-modal-header {
    padding: 20px 25px;
    background: #f8fafc;
    border-bottom: 1px solid var(--exam-border-color);
    font-size: 1.2em;
    font-weight: 700;
    color: var(--exam-text-main);
    display: flex;
    align-items: center;
}
.ak-modal-header.warning { color: var(--exam-warning-color); }
.ak-modal-header.danger { color: var(--exam-error-color); }
.ak-modal-header.info { color: var(--exam-primary-color); }

.ak-modal-body {
    padding: 25px;
    font-size: 1.05em;
    color: var(--exam-text-muted);
    line-height: 1.5;
}

.ak-modal-footer {
    padding: 15px 25px;
    background: #f8fafc;
    border-top: 1px solid var(--exam-border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.ak-btn-modal {
    padding: 10px 20px;
    border-radius: var(--exam-radius-sm);
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.ak-btn-cancel {
    background: #ffffff;
    color: var(--exam-text-main);
    border: 1px solid var(--exam-border-color);
}
.ak-btn-cancel:hover { background: var(--exam-light-bg); border-color: #cbd5e1; }

.ak-btn-confirm {
    background: var(--exam-primary-color);
    color: white;
}
.ak-btn-confirm:hover { background: var(--exam-primary-hover); }

.ak-btn-danger {
    background: var(--exam-error-color);
    color: white;
}
.ak-btn-danger:hover { background: #dc2626; }

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE)
   ========================================================================== */
@media (max-width: 782px) {
    .ak-exam-wrapper, .ak-live-tracking-wrapper, .ak-grading-center-wrapper { border: none; box-shadow: none; padding: 15px; }
    #ak-exam-login, #ak-exam-confirmation-content { padding: 25px 20px; margin: 20px auto; }
    
    #ak-exam-main { margin: 0; }
    .ak-exam-header { flex-direction: column; gap: 10px; align-items: flex-start; border-radius: var(--exam-radius-md); padding: 15px;}
    
    #ak-exam-content-area { flex-direction: column; padding-bottom: 80px; background: transparent;}
    
    .ak-exam-left-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--exam-border-color);
        display: none; 
        border-radius: var(--exam-radius-md);
        margin-top: 15px;
        box-shadow: var(--exam-shadow-sm);
    }
    .ak-exam-left-panel.is-active-mobile { display: flex !important; }
    
    .ak-exam-left-panel .exam-timer, .ak-exam-left-panel #submit-mcq-btn { display: none; }
    
    .mobile-nav-toggle { width: 100%; text-align: center; margin-top: 10px; }
    
    .mcq-mobile-controls, .essay-mobile-controls {
        display: flex; justify-content: space-between; align-items: center;
        position: fixed; bottom: 0; left: 0; right: 0;
        background: #ffffff; padding: 12px 20px; 
        border-top: 1px solid var(--exam-border-color); 
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
        z-index: 1000;
    }
    .mcq-mobile-controls .exam-timer, .essay-mobile-controls .exam-timer { 
        margin: 0; padding: 0; border: none; background: none; box-shadow: none; font-size: 1.3em; color: var(--exam-error-color); 
    }
    .mcq-mobile-controls #submit-mcq-btn, .essay-mobile-controls #submit-essay-btn { 
        display: block; margin: 0; padding: 12px 25px; width: auto; 
    }

    .ak-exam-right-panel { padding: 20px 10px; border-radius: var(--exam-radius-md); margin-top: 15px; box-shadow: var(--exam-shadow-sm);}
    .question-title { font-size: 1.15em; }
    .answer-item { padding: 15px; margin-bottom: 12px;}
    .answer-item label { font-size: 1em; }
    
    #essay-panel { padding: 20px 10px 80px 10px; }
    #essay-panel > h3 { font-size: 1.3em; }
    .essay-item { padding: 15px; }
    .essay-item h4 { font-size: 1.1em; }
    
    /* Live tracking mobile */
    .tracking-controls-container { flex-direction: column; align-items: stretch; gap: 15px; }
    .tracking-search-box { width: 100%; }
    .live-tracking-table { display: block; overflow-x: auto; white-space: nowrap; }

    /* Grading mobile */
    .examiner-field { flex-direction: column; align-items: stretch; }
    #confirm-examiner-btn { width: 100% !important; margin-left: 0 !important; margin-top: 10px !important; }
    .grading-center-layout { flex-direction: column; height: auto; }
    .grading-sidebar { width: 100%; height: 400px; border-right: none; border-bottom: 1px solid var(--exam-border-color); }
    .grading-content { padding: 15px; }
    .score-input-group { flex-direction: column; align-items: stretch; }
    #examiner_score { width: 100%; }
}