/**
 * Quick Mark OMR - Browser-based Optical Mark Recognition
 * 
 * Copyright (c) 2025 B. Moran (Teaching with Tech)
 * All Rights Reserved.
 * 
 * Website: https://www.teaching-with-tech.com
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(to right, #fff7ed, #f0f9ff);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ========================================
   HEADER - Matching Markdown Converter
   ======================================== */
header {
    background: #ffffff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-bottom: 3px solid #69b9ff;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.header-logo:hover {
    transform: scale(1.1);
}

.header-logo img {
    height: 160px;
    width: auto;
    display: block;
}

.header-title {
    text-align: center;
    flex: 1;
}

.header-title h1 {
    margin: 0;
    color: #69b9ff;
    font-size: 2rem;
    font-weight: 700;
}

.header-title .subtitle {
    margin: 0.5rem 0 0 0;
    color: #69b9ff;
    opacity: 0.85;
    font-size: 1em;
}

.config-status-box {
    margin-top: 10px;
    padding: 8px 12px;
    background: #69b9ff;
    border-radius: 8px;
    font-size: 0.85em;
    border: 1px solid #69b9ff;
    text-align: center;
}

#config-status-indicator {
    color: white;
    font-weight: 600;
}

.header-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ffb066;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(255, 176, 102, 0.3);
    width: 100%;
}

.reset-btn:hover {
    background: #ff9d4d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 176, 102, 0.4);
}

.coffee-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #69b9ff;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(105, 185, 255, 0.3);
    white-space: nowrap;
    width: 100%;
}

.coffee-btn:hover {
    background: #4da8ff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(105, 185, 255, 0.4);
}

.coffee-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.tutorial-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #FF0000;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    white-space: nowrap;
    width: 100%;
}

.tutorial-btn:hover {
    background: #cc0000;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
}

.tutorial-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ========================================
   TABS
   ======================================== */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-number {
    background: #69b9ff;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 600;
}

.tab-button:hover {
    background: #e3f2fd;
}

.tab-button.active {
    background: white;
    color: #69b9ff;
    border-bottom: 3px solid #69b9ff;
}

.tab-button.active .tab-number {
    background: #69b9ff;
    box-shadow: 0 2px 8px rgba(105, 185, 255, 0.3);
}

/* ========================================
   TAB CONTENT
   ======================================== */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

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

.tab-content h2 {
    color: #333;
    font-size: 1.75em;
    margin-bottom: 20px;
    font-weight: 600;
}

.tab-content h3 {
    color: #555;
    font-size: 1.3em;
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* ========================================
   FORMS
   ======================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #69b9ff;
    box-shadow: 0 0 0 3px rgba(105, 185, 255, 0.1);
}

.form-group small {
    color: #666;
    font-size: 0.85em;
    margin-top: 5px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #69b9ff;
    color: white;
    box-shadow: 0 2px 8px rgba(105, 185, 255, 0.2);
}

.btn-primary:hover {
    background: #4da8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(105, 185, 255, 0.3);
}

.btn-secondary {
    background: #ffb066;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 176, 102, 0.2);
}

.btn-secondary:hover {
    background: #ff9d4d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 176, 102, 0.3);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.button-group .btn {
    flex: 1;
    min-width: 180px;
    height: 60px;
    padding: 8px 12px;
    white-space: normal;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ========================================
   INFO BOXES
   ======================================== */
.info-box {
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid;
}

.info-box strong {
    display: block;
    margin-bottom: 8px;
}

.info-box ol {
    margin-left: 20px;
    margin-top: 10px;
}

.info-box p {
    line-height: 1.6;
}

/* Blue info box (general information) */
.info-blue {
    background: #e3f2fd;
    border-left-color: #69b9ff;
}

.info-blue strong {
    color: #1976d2;
}

/* Warning box (orange) */
.info-warning {
    background: #fff3cd;
    border-left-color: #ffb066;
    color: #856404;
}

.info-warning strong {
    color: #ff9d4d;
}

/* Orange instruction box */
.info-orange {
    background: #fff8f0;
    border-left-color: #ffb066;
}

.info-orange strong {
    color: #e08000;
}

.warning-text {
    color: #ff9d4d;
    font-weight: 500;
}

/* Success box (green) */
.info-success {
    background: #e8f5e9;
    border-left-color: #9fe3a1;
}

.info-success strong {
    color: #2e7d32;
}

/* ========================================
   TABLES
   ======================================== */
.markscheme-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 2px solid #ddd;
}

.markscheme-table th,
.markscheme-table td {
    padding: 12px 16px;
    text-align: center;
    border: 1px solid #ddd;
}

.markscheme-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.answer-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s;
}

.answer-select:focus {
    outline: none;
    border-color: #69b9ff;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 2px solid #333;
}

.report-table th,
.report-table td {
    padding: 12px 16px;
    text-align: center;
    border: 1px solid #333;
}

.report-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

/* Score color coding - using TwT brand colors */
.score-orange {
    background-color: #ffb066 !important;
    color: #333 !important;
}

.score-green {
    background-color: #9fe3a1 !important;
    color: #333 !important;
}

.score-blue {
    background-color: #69b9ff !important;
    color: #333 !important;
}

.absent-row {
    background-color: #f5f5f5 !important;
    color: #999 !important;
}

/* Color coding for individual answers in detailed results */
.answer-correct {
    background-color: #69b9ff !important;
    color: white !important;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

.answer-incorrect {
    background-color: #ffb066 !important;
    color: white !important;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

/* ========================================
   STATUS MESSAGES
   ======================================== */
.status-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
}

/* ========================================
   RESULTS GRID
   ======================================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.bg-blue-50 {
    background-color: #e3f2fd;
}

.border-blue-200 {
    border: 2px solid #69b9ff;
    border-radius: 8px;
    padding: 15px;
}

.bg-green-50 {
    background-color: #e8f5e9;
}

.border-green-200 {
    border: 2px solid #9fe3a1;
    border-radius: 8px;
    padding: 15px;
}

.bg-orange-50 {
    background-color: #fff3e0;
}

.border-orange-200 {
    border: 2px solid #ffb066;
    border-radius: 8px;
    padding: 15px;
}

/* ========================================
   CALIBRATION
   ======================================== */
#calibration-canvas-container {
    margin-top: 20px;
}

.calibration-prompt {
    background: linear-gradient(135deg, #ffb066 0%, #ff9d4d 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 1.1em;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 176, 102, 0.3);
}

#calibration-canvas,
#preview-canvas {
    display: block;
    margin: 20px auto;
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* ========================================
   ABSENCE LIST
   ======================================== */
#absence-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

/* ========================================
   SPINNER
   ======================================== */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(105, 185, 255, 0.2);
    border-top-color: #69b9ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   REPORT CONTAINER
   ======================================== */
.report-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.report-container h2 {
    color: #333;
    border-bottom: 3px solid #69b9ff;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.report-container h3 {
    color: #555;
    margin-top: 30px;
    margin-bottom: 15px;
}

/* ========================================
   CUSTOM FIELDS
   ======================================== */
.custom-field-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: border-color 0.3s;
}

.custom-field-item:hover {
    border-color: #69b9ff;
}

#custom-fields-list {
    margin: 15px 0;
}

#add-custom-field-btn {
    margin-top: 10px;
}

/* ========================================
   FOOTER
   ======================================== */
.app-footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
}

.app-footer a {
    color: #69b9ff;
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1200px) {
    .container {
        margin: 10px;
    }
    
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-logo img {
        height: 100px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header-logo img {
        height: 80px;
    }
    
    .header-title h1 {
        font-size: 1.5rem;
    }
    
    .header-title .subtitle {
        font-size: 0.9em;
    }
    
    header {
        padding: 1rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        padding: 12px 16px;
        justify-content: flex-start;
    }
    
    .tab-content {
        padding: 20px 15px;
    }
    
    .tab-content h2 {
        font-size: 1.4em;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        justify-content: center;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .markscheme-table,
    .report-table {
        font-size: 0.9em;
    }
    
    .markscheme-table th,
    .markscheme-table td,
    .report-table th,
    .report-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .header-logo img {
        height: 60px;
    }
    
    .header-title h1 {
        font-size: 1.3rem;
    }
    
    .header-title .subtitle {
        font-size: 0.8em;
    }
    
    header {
        padding: 0.75rem;
    }
    
    .coffee-btn,
    .tutorial-btn {
        font-size: 0.85em;
        padding: 10px 20px;
    }
    
    .tab-content {
        padding: 15px 10px;
    }
    
    .info-box {
        padding: 12px 15px;
        font-size: 0.9em;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 14px 20px; /* Larger touch targets */
    }
}

/* ========================================
   TERMS OF SERVICE MODAL
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 25px 30px;
    border-bottom: 3px solid #69b9ff;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

.modal-body {
    padding: 25px 30px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.6;
}

.modal-body h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-body ul {
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.modal-footer .btn {
    margin: 0;
    min-width: 120px;
}

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3em;
    }
    
    .modal-body {
        font-size: 0.95em;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* ========================================
   DATA PROTECTION POPUP
   ======================================== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.popup-overlay.hidden {
    display: none;
}

.popup-content {
    background-color: #ffffff;
    border: 3px solid #69b9ff;
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.popup-content h2 {
    color: #69b9ff;
    margin-bottom: 20px;
    font-size: 24px;
}

.popup-content h3 {
    color: #333;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 18px;
}

.popup-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #69b9ff;
}

.popup-section ul {
    margin-left: 20px;
    margin-top: 10px;
}

.popup-section li {
    margin-bottom: 8px;
}

.warning-box {
    border-left: 4px solid #ffb066;
    background-color: #fff8f0;
}

.popup-checkbox {
    margin: 25px 0;
    padding: 15px;
    background-color: #e8f4f8;
    border-radius: 8px;
    border: 2px solid #69b9ff;
}

.popup-checkbox label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
}

.popup-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

#close-popup-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

#close-popup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   STUDENT NAMES STYLES
   ======================================== */
.student-name-input.has-value {
    border-color: #9fe3a1 !important;
    background-color: #f0fdf4 !important;
}

.btn-outline {
    background-color: white;
    color: #69b9ff;
    border: 2px solid #69b9ff;
}

.btn-outline:hover {
    background-color: #e8f4f8;
}

/* Status message variants */
.status-message.info-blue {
    background-color: #e8f4f8;
    color: #0066cc;
    border: 2px solid #69b9ff;
}

.status-message.info-green {
    background-color: #f0fdf4;
    color: #2d5f2e;
    border: 2px solid #9fe3a1;
}

.status-message.error {
    background-color: #ffe6e6;
    color: #c92a2a;
    border: 2px solid #ff6b6b;
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    body {
        background: white;
    }
    
    .tabs,
    .button-group,
    .btn,
    header,
    .app-footer {
        display: none;
    }
    
    .container {
        box-shadow: none;
    }
}

/* ========================================
   REVIEW & EDIT TAB STYLES
   ======================================== */
.review-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.summary-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 3px solid #e0e0e0;
    transition: all 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.summary-success {
    border-color: #9fe3a1;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.summary-warning {
    border-color: #ffb066;
    background: linear-gradient(135deg, #fff8f0 0%, #ffffff 100%);
}

.summary-number {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.summary-success .summary-number {
    color: #2d5f2e;
}

.summary-warning .summary-number {
    color: #d97706;
}

.summary-absent {
    border-color: #9ca3af;
    background: linear-gradient(135deg, #f3f4f6 0%, #ffffff 100%);
}

.summary-absent .summary-number {
    color: #6b7280;
}

.summary-label {
    font-size: 1.1em;
    font-weight: 600;
    color: #555;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

/* Absent Student Grid */
.absent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.absent-student-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.absent-student-item:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.absent-student-item.is-absent {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.absent-student-item.is-absent .absent-checkbox {
    background: #6b7280;
    border-color: #6b7280;
}

.absent-student-item.is-absent .absent-checkbox::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.absent-student-item.no-scan {
    opacity: 0.6;
    border-style: dashed;
}

.absent-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.absent-student-name {
    font-size: 0.9em;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.absent-student-item.is-absent .absent-student-name {
    color: #6b7280;
    text-decoration: line-through;
}

/* Report table absent row styling */
.report-table tr.absent-row {
    background-color: #f3f4f6 !important;
    color: #9ca3af;
}

.report-table tr.absent-row td {
    color: #9ca3af !important;
}

.absent-status {
    font-style: italic;
    color: #6b7280;
}

.review-item {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.review-item:hover {
    border-color: #69b9ff;
    box-shadow: 0 4px 12px rgba(105, 185, 255, 0.2);
}

.review-item-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.review-thumbnail {
    flex-shrink: 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.review-thumbnail:hover {
    border-color: #69b9ff;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.review-thumbnail img {
    display: block;
    max-width: 100%;
    height: auto;
}

.review-info {
    flex: 1;
    min-width: 200px;
}

.review-info h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2em;
}

.review-info p {
    margin: 5px 0;
    color: #666;
}

.review-controls {
    flex-shrink: 0;
    min-width: 250px;
}

.review-controls label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.review-controls select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.review-controls select:hover {
    border-color: #69b9ff;
}

.review-controls select:focus {
    outline: none;
    border-color: #69b9ff;
    box-shadow: 0 0 0 3px rgba(105, 185, 255, 0.2);
}

.review-controls button {
    margin-top: 10px;
}

/* Question Review Styles */
.question-review {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.question-review h4 {
    margin: 0 0 15px 0;
    color: #d97706;
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.question-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.question-item.has-issue {
    border-color: #ffb066;
    background: #fff8f0;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.question-number {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

.issue-badge {
    background: #ffb066;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.bubble-row-preview {
    margin: 15px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bubble-row-preview:hover {
    border-color: #69b9ff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bubble-row-preview img {
    display: block;
    width: 100%;
    height: auto;
}

.answer-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.answer-option {
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
}

.answer-option:hover {
    border-color: #69b9ff;
    background: #f0f8ff;
}

.answer-option.selected {
    border-color: #69b9ff;
    background: #69b9ff;
    color: white;
}

.answer-option.correct-answer {
    border-color: #9fe3a1;
    background: #f0fdf4;
}

.answer-option.detected {
    border-color: #ffb066;
}

.confidence-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9em;
}

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

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b 0%, #ffb066 50%, #9fe3a1 100%);
    transition: width 0.3s ease;
}

/* Image Modal for full-size viewing */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    padding: 20px;
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-content {
    max-width: 95%;
    max-height: 95%;
    position: relative;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.image-modal-close:hover {
    background: #ffb066;
    color: white;
    transform: rotate(90deg);
}

/* Responsive design for review tab */
@media (max-width: 768px) {
    .review-summary {
        grid-template-columns: 1fr;
    }
    
    .review-item-header {
        flex-direction: column;
    }
    
    .review-thumbnail {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .answer-options {
        justify-content: center;
    }
    
    .summary-number {
        font-size: 2.5em;
    }
}

/* Manual Review Modal Styles */
#manual-review-modal .modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

#manual-review-modal .modal-header {
    position: relative;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

#manual-review-modal .modal-body {
    padding: 20px;
}

.review-student-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.review-student-info {
    font-size: 1.2em;
    font-weight: 600;
}

.review-student-score {
    font-size: 1.1em;
    color: #666;
}

.review-answer-sheet {
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.review-answer-sheet canvas {
    width: 100%;
    height: auto;
    display: block;
}

.review-answers-summary {
    background: #f0f9ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.review-answers-summary h4 {
    margin-bottom: 10px;
    color: #333;
}

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

.review-answer-item {
    background: white;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #ddd;
    font-size: 0.9em;
}

.review-answer-item.correct {
    background: #d4edda;
    border-color: #9fe3a1;
}

.review-answer-item.incorrect {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.review-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.review-buttons .btn {
    min-width: 200px;
    padding: 12px 24px;
    font-size: 1em;
}

.review-progress {
    text-align: center;
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95em;
}

/* Question-level review styles */
.question-review-container {
    max-width: 600px;
    margin: 0 auto;
}

.question-review-header {
    text-align: center;
    margin-bottom: 20px;
}

.question-snapshot {
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    text-align: center;
    background: #f8f9fa;
    padding: 10px;
}

.question-snapshot canvas {
    max-width: 100%;
    height: auto;
}

.question-answer-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.question-answer-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #ddd;
    background: white;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.question-answer-btn:hover {
    border-color: #69b9ff;
    background: #f0f9ff;
}

.question-answer-btn.selected {
    border-color: #69b9ff;
    background: #69b9ff;
    color: white;
}

.question-answer-btn.correct-answer {
    box-shadow: 0 0 0 3px #9fe3a1;
}

.question-nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.select-review-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Question Answer Popup Overlay */
.question-answer-popup {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: 15px;
    z-index: 100;
}

.question-popup-content {
    background: white;
    border: 3px solid #69b9ff;
    border-radius: 12px;
    padding: 15px 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    text-align: center;
    min-width: 300px;
}

.question-popup-header {
    margin-bottom: 12px;
    font-size: 1.1em;
}

#popup-question-label {
    font-weight: bold;
    color: #333;
}

.question-popup-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
