:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: rgba(255,255,255,0.05);
    --text-main: #f8fafc;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* Light Theme */
[data-theme="light"] {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-dark: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: rgba(0,0,0,0.04);
    --text-main: #1e293b;
    --text-light: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: #ffffff;
    border-color: #d1d5db;
    color: #1e293b;
}

[data-theme="light"] .btn-secondary {
    background-color: #f1f5f9;
    border: 1px solid #d1d5db;
    color: #1e293b;
}

[data-theme="light"] .btn-secondary:hover {
    background-color: #e2e8f0;
}

[data-theme="light"] .system-note {
    background: rgba(79, 70, 229, 0.05);
    color: #4338ca;
}

[data-theme="light"] .source-option {
    border-color: #d1d5db;
}

[data-theme="light"] .source-option.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

[data-theme="light"] .open-ended-input {
    background: #ffffff;
    color: #1e293b;
}

[data-theme="light"] nav {
    border-bottom-color: #e2e8f0;
}

[data-theme="light"] .q-nav-btn {
    color: #1e293b;
    border-color: #d1d5db;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Glassmorphism Card */
.card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

input[type="email"],
input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--border);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-graded {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Review Page Layout */
.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: calc(100vh - 100px);
}

.pdf-viewer {
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    height: 100%;
}

.grading-panel {
    overflow-y: auto;
    padding-right: 1rem;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.grade-input {
    width: 80px !important;
    text-align: right;
    font-weight: bold;
}

.system-note {
    background: rgba(79, 70, 229, 0.1);
    border-left: 3px solid var(--primary);
    padding: 0.75rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #c7d2fe;
}

.teacher-note {
    margin-top: 1rem;
}

/* Language Toggle Button */
.lang-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 0.375rem;
    cursor: pointer;
    border: none;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    min-width: 40px;
    text-align: center;
}
.lang-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Number input styling */
input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.2s;
}
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .review-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Badge for reviewed status */
.badge-reviewed {
    background: rgba(79, 70, 229, 0.2);
    color: #818cf8;
}

.badge-processing {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

/* Question navigation buttons */
.q-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.q-nav-btn:hover {
    border-color: var(--primary);
}

.q-nav-btn.current {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.q-nav-btn.answered {
    background: rgba(16, 185, 129, 0.3);
    border-color: var(--success);
}

.q-nav-btn.flagged {
    background: rgba(245, 158, 11, 0.3);
    border-color: var(--warning);
}

/* Open-ended answer textarea */
.open-ended-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-main);
    font-size: 1rem;
    resize: vertical;
    min-height: 120px;
    font-family: 'Inter', sans-serif;
}

.open-ended-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Print styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .no-print {
        display: none !important;
    }
    .card {
        background: white !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* Institution settings in print */
.institution-header {
    text-align: center;
    margin-bottom: 1rem;
}

.institution-logo {
    max-height: 80px;
    margin-bottom: 0.5rem;
}

.institution-name {
    font-size: 14pt;
    font-weight: bold;
}