/* ==================== Reset & Base ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== Header ==================== */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.5px; }

.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.nav-tab:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-tab.active { color: white; background: rgba(255,255,255,0.15); font-weight: 600; }

/* ==================== Container ==================== */
.container { max-width: 860px; margin: 24px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }

/* ==================== Cards ==================== */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e8ecf0;
}
.card h2 { font-size: 1.1rem; margin-bottom: 16px; color: #1a1a2e; }
.card h3 { font-size: 0.95rem; margin: 12px 0 8px; }

.card-inner {
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

/* ==================== Filter Bar ==================== */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; }

/* ==================== Question List ==================== */
.question-list { display: flex; flex-direction: column; gap: 10px; }
.question-item {
    padding: 14px 16px;
    border: 2px solid #e8ecf0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.question-item:hover { border-color: #4a90d9; background: #f8faff; }
.question-item.selected { border-color: #4a90d9; background: #eef4ff; }

.question-type-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}
.question-type-badge.writing { background: #e3f2fd; color: #1565c0; }
.question-type-badge.speaking { background: #fce4ec; color: #c62828; }

.question-content { font-weight: 500; margin-bottom: 4px; }
.question-rubric { font-size: 0.82rem; color: #6b7280; }

/* ==================== Forms ==================== */
textarea, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fafbfc;
}
textarea:focus, input:focus { outline: none; border-color: #4a90d9; background: white; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.88rem; }
.form-group { margin-bottom: 14px; }

/* ==================== Buttons ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #4a90d9; color: white; }
.btn-primary:hover:not(:disabled) { background: #3a7bc8; }
.btn-success { background: #22c55e; color: white; }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-ghost { background: transparent; color: #6b7280; }
.btn-ghost:hover { background: #f3f4f6; color: #1a1a2e; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-filter {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}
.btn-filter:hover { background: #e5e7eb; }
.btn-filter.active { background: #4a90d9; color: white; border-color: #4a90d9; }

.step-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ==================== Grading Progress ==================== */
.grading-progress { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 0; }

.spinner {
    width: 40px; height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.status-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #f9fafb; border-radius: 8px; }
.status-icon { font-size: 1.1rem; }
.status-label { flex: 1; font-size: 0.88rem; }
.status-score { font-weight: 700; color: #4a90d9; }

/* ==================== Results ==================== */
.result-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.result-header h3 { margin: 0; flex: 1; }

.total-score { text-align: center; min-width: 70px; }
.score-number { font-size: 2rem; font-weight: 800; color: #22c55e; line-height: 1; }
.score-max { font-size: 0.85rem; color: #6b7280; }
.total-score.overridden .score-number { color: #f59e0b; }
.override-badge {
    display: block;
    font-size: 0.65rem;
    background: #fef3c7;
    color: #92400e;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

.student-answer-box {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid #4a90d9;
}
.student-answer-box p { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }

.ai-model-badge {
    display: inline-block;
    font-size: 0.72rem;
    background: #ede9fe;
    color: #7c3aed;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.overall-comment { margin-bottom: 12px; font-style: italic; color: #374151; }

/* ==================== Criteria Table ==================== */
.criteria-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.85rem; }
.criteria-table th, .criteria-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}
.criteria-table th { font-weight: 600; color: #6b7280; font-size: 0.78rem; text-transform: uppercase; }
.criteria-table tfoot td { border-top: 2px solid #e5e7eb; }

.mini-bar { width: 80px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.mini-bar-fill { height: 100%; background: #4a90d9; border-radius: 3px; transition: width 0.5s ease; }

/* ==================== Feedback ==================== */
.feedback-list { margin: 10px 0; }
.feedback-list ul { list-style: none; padding-left: 0; }
.feedback-list li { padding: 3px 0; font-size: 0.88rem; }
.feedback-list li::before { content: '• '; }
.strengths li::before { content: '✓ '; color: #22c55e; }
.weaknesses li::before { content: '! '; color: #f59e0b; }

.corrections { margin: 10px 0; }
.correction-item {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    padding: 6px 10px; margin: 4px 0;
    background: #fef2f2; border-radius: 6px; font-size: 0.84rem;
}
.corr-error { color: #dc2626; text-decoration: line-through; }
.corr-correct { color: #16a34a; font-weight: 600; }
.corr-explanation { color: #6b7280; font-size: 0.78rem; width: 100%; }

.instructor-feedback-box {
    margin-top: 12px;
    padding: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

/* ==================== Review Page ==================== */
.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    transition: background 0.2s;
}
.review-item:hover { background: #f9fafb; }
.review-item-info { display: flex; gap: 16px; font-size: 0.88rem; }
.review-uuid { font-family: monospace; color: #4a90d9; }
.review-date { color: #6b7280; }
.review-count { color: #6b7280; }

.review-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e8ecf0;
}
.review-actions h3 { margin-bottom: 12px; }

/* ==================== Utilities ==================== */
.hidden { display: none !important; }
.hint { color: #9ca3af; font-size: 0.85rem; margin-top: 8px; }
.loading-text { color: #9ca3af; text-align: center; padding: 20px; }
.empty-text { color: #9ca3af; text-align: center; padding: 16px; }
.error-text { color: #dc2626; padding: 12px; background: #fef2f2; border-radius: 6px; }
.error-box { color: #dc2626; padding: 12px; background: #fef2f2; border-radius: 6px; margin: 8px 0; }
.empty-state { text-align: center; padding: 32px 16px; }

/* ==================== File Input ==================== */
input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    font-family: inherit;
}
input[type="file"]:hover { border-color: #4a90d9; background: #f8faff; }
