*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f5f6fa; color: #1e2430; line-height: 1.7; }

/* ── Top bar ── */
.topbar {
  background: #12161f;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  text-decoration: none;
}
.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #5b9cf6 0%, #7c3aed 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: .85rem;
}

/* ── Demo role switcher ── */
.role-switcher {
  display: flex;
  align-items: center;
  gap: .2rem;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: .2rem .3rem;
}
.role-btn {
  font-size: .75rem;
  padding: .25rem .8rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  background: transparent;
  color: #8a94aa;
  transition: all .2s;
  white-space: nowrap;
}
.role-btn:hover { color: #fff; }
.role-btn.active { background: #5b9cf6; color: #fff; }
.role-btn.active.admin-btn { background: #e05252; }
.role-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #555d70;
  padding-right: .4rem;
  white-space: nowrap;
}

/* ── Main wrapper ── */
.site-wrapper {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #1e2430 0%, #2c3550 100%);
  color: #fff;
  border-radius: 16px;
  padding: 3rem 2.5rem 2.5rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(91,156,246,.14) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  left: 40%;
  bottom: -60px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(124,58,237,.1) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #5b9cf6;
  font-weight: 700;
  margin-bottom: .5rem;
}
.hero h1 { font-size: 2.25rem; line-height: 1.2; font-weight: 700; }
.hero p { margin-top: .75rem; color: #a8b2c8; font-size: 1.05rem; max-width: 580px; }
.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 2.25rem;
  flex-wrap: wrap;
}
.stat-value { font-size: 2rem; font-weight: 700; color: #5b9cf6; line-height: 1; }
.stat-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6b7a99;
  margin-top: .3rem;
}

/* ── Section headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2.5rem 0 1.25rem;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e2430;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: #5b9cf6;
  border-radius: 2px;
  flex-shrink: 0;
}
.section-link { font-size: .82rem; color: #5b9cf6; text-decoration: none; }
.section-link:hover { text-decoration: underline; }

/* ── Course cards ── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.course-card {
  background: #fff;
  border: 1px solid #e0e4ef;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, border-color .2s, transform .15s;
}
.course-card:hover {
  box-shadow: 0 6px 28px rgba(0,0,0,.1);
  transform: translateY(-2px);
}
.course-card:hover.card-blue   { border-color: #5b9cf6; }
.course-card:hover.card-purple { border-color: #a855f7; }
.course-card:hover.card-cyan   { border-color: #06b6d4; }

.course-card-banner { height: 5px; }
.banner-blue   { background: linear-gradient(90deg, #5b9cf6, #2c5fad); }
.banner-purple { background: linear-gradient(90deg, #a855f7, #7c3aed); }
.banner-cyan   { background: linear-gradient(90deg, #06b6d4, #0284c7); }

.course-card-body { padding: 1.5rem 1.5rem 1rem; flex: 1; display: flex; flex-direction: column; }
.course-tag {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .4rem;
}
.tag-blue   { color: #5b9cf6; }
.tag-purple { color: #9333ea; }
.tag-cyan   { color: #0284c7; }

.course-title { font-size: 1.2rem; font-weight: 700; color: #1e2430; line-height: 1.3; margin-bottom: .5rem; }
.course-desc  { font-size: .88rem; color: #555; line-height: 1.6; flex: 1; }

.course-meta { display: flex; gap: 1.25rem; margin-top: 1rem; flex-wrap: wrap; }
.meta-item   { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: #888; }

.modules-list { margin-top: .85rem; display: flex; flex-direction: column; gap: 0; }
.module-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: #444;
  padding: .3rem 0;
  border-bottom: 1px solid #f3f4f8;
}
.module-row:last-child { border-bottom: none; }
.module-num { font-size: .68rem; font-weight: 700; color: #a8b2c8; width: 1.8rem; flex-shrink: 0; }
.module-name { flex: 1; }
.module-badge {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .1em .55em;
  border-radius: 99px;
  flex-shrink: 0;
}
.mb-exam    { background: #e6f9f0; color: #1a6b42; }
.mb-teacher { background: #f3e8ff; color: #6d28d9; }

.course-card-footer {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid #f0f2fa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.module-pills { display: flex; gap: .35rem; flex-wrap: wrap; }
.pill {
  font-size: .67rem;
  background: #f0f2fa;
  color: #666;
  padding: .15em .65em;
  border-radius: 99px;
  white-space: nowrap;
}
.btn-open {
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  padding: .38rem .9rem;
  border-radius: 8px;
  border: 1.5px solid;
  white-space: nowrap;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.btn-blue   { color: #5b9cf6; border-color: #5b9cf6; }
.btn-blue:hover   { background: #5b9cf6; color: #fff; }
.btn-purple { color: #9333ea; border-color: #9333ea; }
.btn-purple:hover { background: #9333ea; color: #fff; }
.btn-cyan   { color: #0284c7; border-color: #0284c7; }
.btn-cyan:hover   { background: #0284c7; color: #fff; }

/* ── Toggle sections ── */
.role-section { display: none; }
.role-section.visible { display: block; }

/* ── Member progress ── */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.progress-card {
  background: #fff;
  border: 1px solid #e0e4ef;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}
.progress-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .85rem;
}
.progress-card-title { font-size: .92rem; font-weight: 700; color: #1e2430; }
.progress-pct        { font-size: .82rem; font-weight: 700; }
.pct-blue   { color: #5b9cf6; }
.pct-purple { color: #9333ea; }
.pct-cyan   { color: #0284c7; }

.progress-bar-wrap {
  height: 6px;
  background: #e8eaf0;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: .85rem;
}
.progress-bar { height: 100%; border-radius: 99px; }
.pb-blue   { background: linear-gradient(90deg, #5b9cf6, #2c5fad); }
.pb-purple { background: linear-gradient(90deg, #a855f7, #7c3aed); }
.pb-cyan   { background: linear-gradient(90deg, #06b6d4, #0284c7); }

.progress-status { font-size: .78rem; color: #888; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.grade-badge {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  padding: .12em .6em;
  border-radius: 99px;
}
.grade-vg      { background: #e8f0fe; color: #2c5fad; }
.grade-g       { background: #e6f9f0; color: #1a6b42; }
.grade-pending { background: #fdf7e3; color: #92600a; }
.grade-none    { background: #f0f2fa; color: #888; }

/* ── Admin panel ── */
.admin-panel {
  background: #fff;
  border: 1.5px solid #fcdada;
  border-radius: 14px;
  padding: 1.5rem;
}
.admin-panel-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.25rem;
}
.admin-panel-header h3 { font-size: 1rem; font-weight: 700; color: #1e2430; }
.admin-role-badge {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: #fdecea;
  color: #9b1c1c;
  padding: .15em .65em;
  border-radius: 99px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .85rem;
}
.admin-action {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: #fafbfd;
  border: 1px solid #e8eaf0;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.admin-action:hover { border-color: #5b9cf6; background: #f0f4fe; }
.admin-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; margin-top: .05rem; }
.admin-action-title {
  font-size: .87rem;
  font-weight: 600;
  color: #1e2430;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.admin-action-desc { font-size: .78rem; color: #777; margin-top: .2rem; line-height: 1.45; }
.notif-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #e05252;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Teacher guides ── */
.teacher-note {
  font-size: .82rem;
  color: #888;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

/* ── User chip ── */
.user-chip {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .84rem;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .68rem;
  color: #fff;
  flex-shrink: 0;
}
.avatar-member { background: linear-gradient(135deg, #5b9cf6, #2c5fad); }
.avatar-admin  { background: linear-gradient(135deg, #e05252, #9b1c1c); }

/* ── Footer ── */
.site-footer {
  margin-top: 4rem;
  padding-top: 1.75rem;
  border-top: 1px solid #e0e4ef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .82rem;
  color: #aaa;
}
.footer-role { color: #888; }
.footer-role strong { color: #1e2430; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero { padding: 2rem 1.5rem; }
  .hero h1 { font-size: 1.65rem; }
  .hero-stats { gap: 1.5rem; }
  .courses-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 1rem; }
  .site-wrapper { padding: 1.5rem 1rem 4rem; }
}
