:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --surface: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --teacher: #db2777;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text); height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* Auth Screen */
.screen { height: 100vh; width: 100vw; display: flex; justify-content: center; align-items: center; }
.card { background: var(--surface); padding: 2rem; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }
.card h1 { margin-bottom: 0.5rem; color: var(--primary); }
.card p { margin-bottom: 1.5rem; color: var(--text-light); }
.card input[type="email"], .card input[type="password"] { width: 100%; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 4px; }
.role-selector { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1.5rem; }
.auth-buttons { display: flex; gap: 1rem; }
.error-text { color: red; margin-top: 1rem; font-size: 0.9rem; }

/* Buttons & Badges */
button { background: var(--primary); color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 4px; cursor: pointer; font-weight: bold; transition: background 0.2s; }
button:hover { background: var(--primary-hover); }
button.secondary { background: white; color: var(--primary); border: 1px solid var(--primary); }
button.secondary:hover { background: var(--bg-color); }
.badge { font-size: 0.8rem; background: var(--bg-color); padding: 0.2rem 0.5rem; border-radius: 12px; vertical-align: middle; margin-left: 0.5rem; }
.teacher-badge { background: var(--teacher); color: white; }

/* App Layout */
#student-screen, #teacher-screen { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; height: 100vh; }
.navbar { background: var(--surface); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.teacher-nav { border-bottom: 3px solid var(--teacher); }
.nav-controls { display: flex; align-items: center; gap: 1rem; }
.nav-controls span { font-weight: bold; }

.main-layout { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
.sidebar { width: 250px; background: var(--surface); border-right: 1px solid var(--border); padding: 1rem; display: flex; flex-direction: column; overflow-y: auto; }
#lesson-list { list-style: none; margin-top: 1rem; }
#lesson-list li { padding: 0.75rem; cursor: pointer; border-radius: 4px; margin-bottom: 0.5rem; transition: background 0.2s; }
#lesson-list li:hover { background: var(--bg-color); }
#lesson-list li.completed { border-left: 4px solid var(--success); }
#lesson-list li.active { background: var(--primary); color: white; }

/* Workspace */
.workspace { flex: 1; padding: 2rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
.lesson-content, .editor-section, .ai-feedback { background: var(--surface); padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.theory-box { margin: 1rem 0; padding: 1rem; background: var(--bg-color); border-left: 4px solid var(--primary); border-radius: 4px; line-height: 1.5; }
.instruction-text { font-weight: bold; font-size: 1.1rem; }
#feedback-output { margin-top: 1rem; padding: 1rem; background: var(--bg-color); border-radius: 4px; min-height: 50px; white-space: pre-wrap; }

/* CodeMirror Override */
.CodeMirror { height: 300px; border-radius: 4px; font-family: 'Courier New', Courier, monospace; font-size: 14px; margin: 1rem 0; }

/* Teacher Layout */
.teacher-layout { padding: 2rem; max-width: 1000px; margin: 0 auto; width: 100%; }
.teacher-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.student-table { width: 100%; border-collapse: collapse; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-radius: 8px; overflow: hidden; }
.student-table th, .student-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.student-table th { background: var(--bg-color); font-weight: bold; }