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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

h2 {
    color: #3498db;
    margin-bottom: 15px;
    margin-top: 25px;
    font-size: 22px;
}

h3 {
    color: #3498db;
    margin-bottom: 10px;
    font-size: 18px;
}

.card {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #e0e0e0;
}

.card-title {
    font-size: 20px;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-area {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #f0f8ff;
}

.upload-area:hover {
    background-color: #e3f2fd;
    border-color: #1976D2;
}

.upload-area.dragover {
    background-color: #bbdefb;
    border-color: #1976D2;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.upload-text {
    color: #666;
    margin-bottom: 10px;
}

.student-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 10px;
}

.student-item {
    padding: 15px 12px;
    background-color: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
}

.student-display {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.4;
    pointer-events: none;
}

.student-item:hover {
    border-color: #3498db;
    background-color: #f0f8ff;
}

.student-item.selected {
    border-color: #3498db;
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

.student-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    color: #999;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
}

.student-item:hover .student-delete-btn {
    opacity: 1;
}

.student-delete-btn:hover {
    color: #e74c3c;
    background-color: rgba(255, 255, 255, 1);
}

.selected-student {
    background-color: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.selected-student.visible {
    display: block;
}

.camera-section {
    text-align: center;
    margin: 20px 0;
}

.camera-container {
    display: none;
    margin: 15px auto;
    max-width: 640px;
}

.camera-container.active {
    display: block;
}

#cameraVideo {
    width: 100%;
    border-radius: 10px;
    border: 2px solid #3498db;
}

#capturedImage {
    max-width: 100%;
    border-radius: 10px;
    margin: 15px 0;
    display: none;
}

.image-preview {
    display: none;
    margin: 15px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 10px;
}

.image-preview.visible {
    display: block;
}

.image-preview img {
    max-width: 100%;
    border-radius: 8px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin: 5px;
    transition: all 0.3s;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: #3498db;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-success {
    background-color: #2ecc71;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-warning {
    background-color: #f39c12;
}

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

.ocr-result {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #ddd;
}

.grading-result {
    margin: 15px 0;
}

.question-item {
    background-color: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    transition: all 0.3s;
}

.question-item.correct {
    border-color: #2ecc71;
    background-color: #d4edda;
}

.question-item.incorrect {
    border-color: #e74c3c;
    background-color: #f8d7da;
}

.question-number {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.question-text {
    margin-bottom: 10px;
    color: #333;
}

.student-answer {
    color: #666;
    margin-bottom: 5px;
}

.correct-answer {
    color: #2ecc71;
    font-weight: bold;
}

.error-analysis {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
}

.feedback-text {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    line-height: 1.8;
    font-size: 15px;
    border: 1px solid #ddd;
    white-space: pre-wrap;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.stat-card {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 2px solid #e0e0e0;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #3498db;
    margin: 10px 0;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background-color: #2ecc71;
    transition: width 0.3s;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    display: none;
    z-index: 1000;
}

.toast.visible {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.history-item {
    background-color: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    border-color: #3498db;
    background-color: #f0f8ff;
}

.hidden {
    display: none !important;
}

.nav-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.nav-tab {
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    background: none;
    font-weight: bold;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.nav-tab:hover {
    color: #3498db;
}

.nav-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
}

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

.manual-edit-area {
    margin: 15px 0;
}

.manual-edit-area textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    resize: vertical;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

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

.toggle-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s;
    margin: 0;
}

.toggle-btn.mark-correct {
    background-color: #2ecc71;
    color: white;
}

.toggle-btn.mark-incorrect {
    background-color: #e74c3c;
    color: white;
}

.question-item.adjusted {
    background-color: #fff3cd !important;
    border-color: #f39c12 !important;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    margin: 3px;
}

.queue-item {
    padding: 12px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.history-item-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    margin-left: 10px;
}

.history-item-actions button {
    padding: 4px 10px;
    font-size: 12px;
    margin: 0;
    min-width: auto;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .student-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .controls {
        flex-direction: column;
    }
    
    .controls button {
        width: 100%;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
}
