@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2dd4a0;
  --primary-dim: rgba(45, 212, 160, 0.15);
  --accent: #facc15;
  --bg: #0f172a;
  --bg-2: #0a0f1a;
  --sidebar: #0b1224;
  --card: rgba(30, 41, 59, 0.6);
  --card-solid: #1e293b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --border: rgba(45, 212, 160, 0.25);
  --border-soft: rgba(255, 255, 255, 0.06);
  --danger: #f87171;
  --warn: #fb923c;
  --info: #60a5fa;
  --success: #2dd4a0;
  --radius: 14px;
  --sidebar-w: 250px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: radial-gradient(ellipse at top, #1e293b 0%, var(--bg) 50%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.55;
}

button { font-family: inherit; }

/* ───── LOGIN ───── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
}

.login-back {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: var(--card-solid);
  border: 1.5px solid var(--border);
  color: var(--primary);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.login-back:hover { background: var(--primary-dim); transform: translateX(-3px); }

.login-card {
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: floatUp 0.5s ease;
}

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

.brand-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }

.login-brand h1 {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-brand p { color: var(--text-dim); margin: 0.2rem 0 2rem; }

.login-prompt { color: var(--text); font-weight: 500; margin-bottom: 1.5rem; }

.demo-tag {
  background: var(--accent);
  color: #0f172a;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  margin-left: 0.4rem;
  letter-spacing: 0.5px;
}

.role-grid {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.role-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text);
  font-family: inherit;
  transition: all 0.2s;
}

.role-card:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
  transform: translateX(4px);
}

.role-emoji {
  font-size: 2.2rem;
  width: 56px;
  height: 56px;
  background: var(--primary-dim);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.1rem; }
.role-desc { color: var(--text-dim); font-size: 0.85rem; }

.login-foot { color: var(--text-faint); font-size: 0.85rem; margin: 0; }
.login-foot a { color: var(--primary); text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

/* ───── APP ───── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ───── SIDEBAR ───── */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sb-top { padding: 0 1.4rem 1.3rem; border-bottom: 1px solid var(--border-soft); margin-bottom: 0.5rem; }

.sb-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-mark { font-size: 1.6rem; }

.brand-text span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sb-nav {
  flex: 1;
  padding: 0.5rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sb-link {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: all 0.15s;
}

.sb-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.sb-link.active { background: var(--primary-dim); color: var(--primary); }

.sb-icon { font-size: 1.15rem; flex-shrink: 0; }

.sb-count {
  background: var(--accent);
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  margin-left: auto;
}

.sb-bottom { padding: 1rem 1.2rem 0; border-top: 1px solid var(--border-soft); margin-top: 1rem; }

.back-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 0.8rem;
  transition: all 0.2s;
}

.back-link:hover { background: var(--primary-dim); transform: translateX(-3px); }

.sb-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
}

.sb-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sb-userinfo { flex: 1; min-width: 0; }
.sb-username { font-weight: 600; color: var(--text); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-userrole { font-size: 0.76rem; color: var(--text-dim); text-transform: capitalize; }

.sb-logout {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.05rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sb-logout:hover { color: var(--danger); border-color: var(--danger); }

/* ───── MAIN ───── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-menu {
  display: none;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.page-title { margin: 0; font-size: 1.3rem; flex: 1; }

.enrollment-badge {
  background: var(--primary-dim);
  color: var(--primary);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

/* ───── PAGE ───── */
.page { padding: 2rem; animation: fadeIn 0.3s ease; }
.page[hidden] { display: none !important; }

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

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.section-title { margin: 0 0 0.2rem; font-size: 1.5rem; }
.section-sub { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

.search-input {
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text);
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 240px;
}

.search-input:focus { outline: none; border-color: var(--primary); }

/* ───── BUTTONS ───── */
.btn-primary, .btn-ghost {
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #22b387);
  color: #0f172a;
  padding: 0.7rem 1.4rem;
  box-shadow: 0 6px 20px rgba(45, 212, 160, 0.25);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(45, 212, 160, 0.4); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--border);
  padding: 0.55rem 1.1rem;
}

.btn-ghost:hover { background: var(--primary-dim); }

/* ───── DASHBOARD ───── */
.welcome {
  background: linear-gradient(135deg, rgba(45, 212, 160, 0.1), rgba(250, 204, 21, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
}

.welcome-text { flex: 1; }
.welcome-text h2 { margin: 0 0 0.3rem; font-size: 1.5rem; }
.welcome-text p { margin: 0; color: var(--text-dim); }

.streak-card {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--border);
}

.streak-emoji { font-size: 2rem; }
.streak-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); line-height: 1; }
.streak-label { color: var(--text-dim); font-size: 0.78rem; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.kpi-card:hover { transform: translateY(-2px); border-color: var(--border); }

.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.kpi-value { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 0.2rem; }
.kpi-label { color: var(--text-dim); font-size: 0.82rem; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel h3 { margin: 0; font-size: 1.1rem; }

.continue-list, .deadline-list { display: flex; flex-direction: column; gap: 0.7rem; }

.continue-item {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.continue-item:hover { background: rgba(15, 23, 42, 0.8); }

.cont-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.cont-info { flex: 1; min-width: 0; }
.cont-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.2rem; }
.cont-meta { color: var(--text-dim); font-size: 0.78rem; }

.cont-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.cont-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
}

.deadline-item {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
  padding: 0.8rem;
  display: flex;
  gap: 0.8rem;
  align-items: center;
  border-left: 3px solid var(--primary);
}

.deadline-item.urgent { border-left-color: var(--danger); }
.deadline-item.soon { border-left-color: var(--warn); }

.dl-info { flex: 1; min-width: 0; }
.dl-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.1rem; }
.dl-meta { color: var(--text-dim); font-size: 0.78rem; }

.dl-date {
  background: var(--primary-dim);
  color: var(--primary);
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.deadline-item.urgent .dl-date { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.deadline-item.soon .dl-date { background: rgba(251, 146, 60, 0.15); color: var(--warn); }

/* ───── COURSES GRID ───── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.course-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.3s;
}

.course-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.course-img {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  position: relative;
  overflow: hidden;
}

.course-img-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1), transparent 60%);
}

.course-body { padding: 1.2rem; }

.course-cat {
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.course-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.4rem; line-height: 1.3; }
.course-instructor { color: var(--text-dim); font-size: 0.82rem; margin-bottom: 0.7rem; }

.course-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.course-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.course-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.5s;
}

.course-pct-label {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: right;
}

/* ───── COURSE DETAIL ───── */
.course-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1.5rem;
  align-items: center;
  backdrop-filter: blur(10px);
}

.ch-icon {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.ch-info h2 { margin: 0 0 0.3rem; font-size: 1.6rem; }
.ch-info p { color: var(--text-dim); margin: 0 0 1rem; }
.ch-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 0.85rem; }
.ch-stat { color: var(--text-dim); }
.ch-stat strong { color: var(--text); margin-right: 0.3rem; }

.lesson-list { display: flex; flex-direction: column; gap: 0.6rem; }

.lesson-item {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.lesson-item:hover { border-color: var(--border); transform: translateX(3px); }
.lesson-item.completed { background: rgba(45, 212, 160, 0.05); }

.lesson-check {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.lesson-item.completed .lesson-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #0f172a;
}

.lesson-info { flex: 1; min-width: 0; }
.lesson-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2rem; }
.lesson-meta { color: var(--text-dim); font-size: 0.78rem; }

.lesson-type {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.lesson-type.video { background: rgba(96, 165, 250, 0.15); color: var(--info); }
.lesson-type.reading { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.lesson-type.quiz { background: rgba(250, 204, 21, 0.15); color: var(--accent); }

/* ───── LESSON VIEWER ───── */
.lesson-viewer {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.video-mock {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.video-mock::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(45,212,160,0.1), transparent 60%);
}

.video-play-btn {
  width: 80px;
  height: 80px;
  background: rgba(45, 212, 160, 0.9);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  color: #0f172a;
  transition: all 0.2s;
  z-index: 1;
  box-shadow: 0 10px 40px rgba(45, 212, 160, 0.4);
}

.video-play-btn:hover { transform: scale(1.1); }
.video-mock.playing .video-play-btn { background: rgba(45, 212, 160, 0.3); }

.video-title-overlay {
  z-index: 1;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.lesson-h1 { margin: 0 0 0.5rem; font-size: 1.6rem; }
.lesson-instructor { color: var(--text-dim); margin: 0 0 1rem; font-size: 0.9rem; }

.lesson-content {
  color: var(--text-dim);
  line-height: 1.7;
  font-size: 0.95rem;
}

.lesson-content p { margin: 0 0 1rem; }
.lesson-content h3 { color: var(--text); margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }

.lesson-controls {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

/* ───── QUIZ LIST ───── */
.quizzes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.quiz-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.4rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.quiz-card:hover { transform: translateY(-2px); border-color: var(--border); }

.quiz-card-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.quiz-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.quiz-card-title { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.quiz-card-course { color: var(--text-dim); font-size: 0.78rem; }

.quiz-info-row {
  display: flex;
  gap: 1rem;
  margin: 0.8rem 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.quiz-info-row strong { color: var(--text); margin-right: 0.2rem; }

.quiz-card-actions { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; }

.quiz-status {
  font-size: 0.78rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
}

.quiz-status.available { background: var(--primary-dim); color: var(--primary); }
.quiz-status.completed { background: rgba(96, 165, 250, 0.15); color: var(--info); }
.quiz-status.locked { background: rgba(100, 116, 139, 0.15); color: var(--text-faint); }

/* ───── QUIZ MODE ───── */
.quiz-mode { padding: 0; }

.quiz-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.quiz-bar {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-soft);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  backdrop-filter: blur(12px);
}

.qb-info { display: flex; align-items: center; gap: 1rem; }
.qb-title { font-weight: 700; font-size: 1.05rem; }
.qb-progress-text { color: var(--text-dim); font-size: 0.85rem; }

.qb-timer {
  background: var(--primary-dim);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.qb-timer.warn { background: rgba(251, 146, 60, 0.15); color: var(--warn); }
.qb-timer.danger { background: rgba(248, 113, 113, 0.15); color: var(--danger); animation: blink 0.8s infinite; }

@keyframes blink { 50% { opacity: 0.5; } }

.qb-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
}

.qb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s;
}

.quiz-body {
  flex: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  width: 100%;
}

.q-number { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 0.5rem; }

.q-text {
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 1.5rem;
  color: var(--text);
}

.q-choices { display: flex; flex-direction: column; gap: 0.7rem; }

.q-choice {
  background: var(--card);
  border: 2px solid var(--border-soft);
  border-radius: 12px;
  padding: 1rem 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: left;
  width: 100%;
}

.q-choice:hover { border-color: var(--border); transform: translateX(4px); }
.q-choice.selected { background: var(--primary-dim); border-color: var(--primary); }

.q-choice-letter {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.q-choice.selected .q-choice-letter {
  background: var(--primary);
  border-color: var(--primary);
  color: #0f172a;
}

.q-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

/* Quiz results */
.quiz-results {
  text-align: center;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.result-score-ring {
  width: 200px;
  height: 200px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.result-score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.result-bg { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 14; }
.result-fg { fill: none; stroke: var(--primary); stroke-width: 14; stroke-linecap: round; stroke-dasharray: 534; transition: stroke-dashoffset 1.5s cubic-bezier(0.4,0,0.2,1); }

.result-num-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.result-num { font-size: 3rem; font-weight: 800; line-height: 1; }
.result-max { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.3rem; }

.result-verdict { font-size: 1.4rem; font-weight: 600; margin-bottom: 0.4rem; }
.result-sub { color: var(--text-dim); margin-bottom: 2rem; }

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-stat {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 1rem;
}

.result-stat .num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.result-stat .num.correct { color: var(--success); }
.result-stat .num.wrong { color: var(--danger); }
.result-stat .num.skip { color: var(--text-faint); }
.result-stat .lbl { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.3rem; }

.review-list { text-align: left; margin-top: 2rem; }
.review-list h3 { font-size: 1rem; margin-bottom: 1rem; }

.review-q {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--danger);
  padding: 1rem;
  margin-bottom: 0.7rem;
  border-radius: 8px;
}

.review-q.correct { border-left-color: var(--success); }
.review-q .q-text-r { font-weight: 500; margin-bottom: 0.6rem; font-size: 0.95rem; }
.review-q .user-ans, .review-q .correct-ans { font-size: 0.85rem; padding: 0.3rem 0.7rem; border-radius: 6px; display: inline-block; margin-right: 0.5rem; }
.review-q .user-ans { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.review-q.correct .user-ans { background: var(--primary-dim); color: var(--primary); }
.review-q .correct-ans { background: var(--primary-dim); color: var(--primary); }

/* Anti-cheat modal */
.anti-cheat-modal .modal-content { border-color: var(--warn); max-width: 460px; }
.anti-cheat-content { text-align: center; }
.anti-cheat-emoji { font-size: 4rem; margin-bottom: 0.5rem; animation: shake 0.5s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.anti-cheat-content h2 { color: var(--warn) !important; margin: 0 0 0.6rem !important; text-align: center; }
.anti-cheat-content p { color: var(--text-dim); margin: 0.4rem 0; }
.warn-count { color: var(--text); font-weight: 600; font-size: 1.1rem; }
.warn-count strong { color: var(--danger); }
.warn-info { font-size: 0.82rem; margin-bottom: 1.5rem !important; }

/* ───── ASSIGNMENTS ───── */
.assignments-list { display: flex; flex-direction: column; gap: 0.8rem; }

.assignment-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  backdrop-filter: blur(10px);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.assignment-card.urgent { border-left: 3px solid var(--danger); }
.assignment-card.soon { border-left: 3px solid var(--warn); }

.assignment-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: var(--primary-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.assignment-info { flex: 1; min-width: 0; }
.assignment-title { font-weight: 700; font-size: 1.02rem; margin-bottom: 0.2rem; }
.assignment-course { color: var(--text-dim); font-size: 0.82rem; margin-bottom: 0.4rem; }
.assignment-desc { color: var(--text-dim); font-size: 0.85rem; }

.assignment-due {
  text-align: right;
  flex-shrink: 0;
}

.assignment-due-date { font-weight: 600; }
.assignment-due-label { font-size: 0.78rem; color: var(--text-dim); }

/* ───── GRADEBOOK ───── */
.gradebook-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.gb-stat {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  text-align: center;
  backdrop-filter: blur(10px);
}

.gb-stat .num { font-size: 1.8rem; font-weight: 800; }
.gb-stat .num.green { color: var(--success); }
.gb-stat .num.yellow { color: var(--accent); }
.gb-stat .num.red { color: var(--danger); }
.gb-stat .lbl { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.3rem; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  backdrop-filter: blur(10px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.data-table thead { background: rgba(0, 0, 0, 0.3); }
.data-table th { text-align: left; padding: 0.9rem 1.1rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); font-weight: 600; }
.data-table td { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border-soft); font-size: 0.9rem; }
.data-table tr:last-child td { border-bottom: none; }

.grade-letter {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  text-align: center;
  line-height: 28px;
  font-weight: 800;
  font-size: 0.85rem;
}

.grade-A { background: rgba(45, 212, 160, 0.2); color: var(--success); }
.grade-B { background: rgba(96, 165, 250, 0.2); color: var(--info); }
.grade-C { background: rgba(250, 204, 21, 0.2); color: var(--accent); }
.grade-D { background: rgba(251, 146, 60, 0.2); color: var(--warn); }
.grade-F { background: rgba(248, 113, 113, 0.2); color: var(--danger); }

/* ───── FORUM ───── */
.forum-list { display: flex; flex-direction: column; gap: 0.8rem; }

.post-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
  cursor: pointer;
}

.post-card:hover { border-color: var(--border); }

.post-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; gap: 0.5rem; }

.post-author {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.post-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
}

.post-author-name { font-weight: 600; font-size: 0.92rem; }
.post-meta-author { color: var(--text-dim); font-size: 0.78rem; }
.post-course-tag {
  background: var(--primary-dim);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.post-title { font-weight: 700; font-size: 1.1rem; margin: 0.4rem 0; }
.post-body { color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; margin-bottom: 0.6rem; }
.post-stats { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--text-faint); }

/* ───── REPORTS / CHARTS ───── */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .reports-grid { grid-template-columns: 1fr; } }

.chart-wrap { position: relative; height: 280px; margin-top: 1rem; }

/* ───── MODAL ───── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal[hidden] { display: none; }

.modal-content {
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  position: relative;
  animation: slideUp 0.3s ease;
  max-height: 92vh;
  overflow-y: auto;
}

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

.modal-content h2 { margin: 0 0 1.2rem; color: var(--primary); }

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.form-row { margin-bottom: 1.1rem; }

.form-row label {
  display: block;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.form-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 1.3rem;
}

/* ───── TOAST ───── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card-solid);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 0.9rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  animation: toastIn 0.3s ease;
  font-weight: 500;
}

.toast[hidden] { display: none; }

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

/* ───── RESPONSIVE ───── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    width: 260px;
    z-index: 200;
    transition: left 0.3s;
  }
  .sidebar.mobile-open { left: 0; box-shadow: 10px 0 30px rgba(0,0,0,0.4); }
  .mobile-menu { display: block; }
  .welcome { flex-direction: column; text-align: center; }
}

@media (max-width: 600px) {
  .page { padding: 1.2rem; }
  .topbar { padding: 0.8rem 1.2rem; }
  .enrollment-badge { display: none; }
  .course-hero { grid-template-columns: 1fr; text-align: center; }
  .ch-icon { width: 80px; height: 80px; font-size: 2.5rem; margin: 0 auto; }
  .q-text { font-size: 1.15rem; }
  .quiz-body { padding: 1.5rem 1rem; }
  .toast { left: 1rem; right: 1rem; }
}
