/* ============================================================
   LearnSpace Design System
   ============================================================ */

/* CSS Custom Properties for white-label theming */
:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #818CF8;
  --secondary: #7C3AED;
  --accent: #06B6D4;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1E1B4B;
  --bg-sidebar-hover: rgba(255,255,255,0.1);

  --text: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --text-sidebar: rgba(255,255,255,0.8);
  --text-sidebar-active: #FFFFFF;

  --border: #E2E8F0;
  --border-focus: var(--primary);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
p { color: var(--text-muted); }

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand img {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.sidebar-brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logo-placeholder {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}
.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}
.nav-section-label {
  padding: 6px 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-sidebar);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav-item:hover, .nav-item.active {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}
.nav-item.active {
  background: var(--primary);
}
.nav-item svg, .nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}
.nav-item.active svg, .nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--bg-sidebar-hover); }
.sidebar-user img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.sidebar-user-info small {
  display: block;
  font-size: 0.7rem;
  opacity: 0.6;
  text-transform: capitalize;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
}
.topbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.topbar-spacer { flex: 1; }
.topbar-search {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  gap: 8px;
  max-width: 280px;
  width: 100%;
}
.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: var(--text);
  width: 100%;
}
.topbar-search svg { color: var(--text-muted); flex-shrink: 0; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  padding: 28px 24px;
  flex: 1;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb span { color: var(--text-light); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.card-body { padding: 22px; }
.card-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ============================================================
   COURSE CARDS
   ============================================================ */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}
.course-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.course-thumb {
  position: relative;
  height: 175px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  overflow: hidden;
}
.course-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.course-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255,255,255,0.6);
}
.course-status-badge {
  position: absolute;
  top: 12px; right: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.course-status-badge.open { background: var(--success); color: white; }
.course-status-badge.closed { background: var(--danger); color: white; }
.course-status-badge.draft { background: var(--warning); color: white; }
.course-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.course-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.course-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
  flex: 1;
}
.course-instructor {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.course-instructor img {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.course-stats {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.course-stats span { display: flex; align-items: center; gap: 4px; }
.course-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.course-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-wrap { margin-top: 8px; }
.progress-bar-bg {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(79,70,229,0.1); color: var(--primary); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon.blue { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 0.75rem; margin-top: 2px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #6D28D9; color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-outline-primary { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.thirds { grid-template-columns: 1fr 1fr 1fr; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.form-check label { font-size: 0.875rem; color: var(--text); cursor: pointer; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.12); color: #B45309; }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-secondary { background: var(--border); color: var(--text-muted); }
.badge-live { background: rgba(239,68,68,0.15); color: var(--danger); animation: pulse-badge 1.5s infinite; }
@keyframes pulse-badge { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
table.table tbody tr:hover { background: var(--bg); }
table.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: rgba(16,185,129,0.1); color: #065F46; border: 1px solid rgba(16,185,129,0.25); }
.alert-danger { background: rgba(239,68,68,0.08); color: #991B1B; border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: #92400E; border: 1px solid rgba(245,158,11,0.25); }
.alert-info { background: rgba(59,130,246,0.08); color: #1E40AF; border: 1px solid rgba(59,130,246,0.2); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--text); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   LESSON CONTENT TYPES
   ============================================================ */
.lesson-video-wrap {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  margin-bottom: 20px;
}
.lesson-video-wrap video,
.lesson-video-wrap iframe {
  width: 100%; height: 100%;
  border: none;
}
.lesson-text-content {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text);
}
.lesson-text-content h2, .lesson-text-content h3 { margin: 1.5em 0 0.5em; }
.lesson-text-content p { margin-bottom: 1em; color: var(--text); }
.lesson-text-content ul, .lesson-text-content ol { padding-left: 1.5em; margin-bottom: 1em; }
.lesson-text-content li { margin-bottom: 0.3em; }
.lesson-text-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1em;
  color: var(--text-muted);
  margin: 1em 0;
}
.lesson-text-content code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--secondary);
}
.lesson-text-content pre {
  background: #1E1B4B;
  color: #E2E8F0;
  padding: 1em;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1em;
}

.materials-list { display: flex; flex-direction: column; gap: 10px; }
.material-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background var(--transition);
}
.material-item:hover { background: rgba(79,70,229,0.04); }
.material-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(79,70,229,0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.material-info { flex: 1; min-width: 0; }
.material-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-size { font-size: 0.75rem; color: var(--text-muted); }

/* ============================================================
   QUIZ
   ============================================================ */
.quiz-container { max-width: 720px; }
.quiz-header { margin-bottom: 24px; }
.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1rem;
}
.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
}
.question-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.question-text { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.option-item:hover { border-color: var(--primary); background: rgba(79,70,229,0.04); }
.option-item.selected { border-color: var(--primary); background: rgba(79,70,229,0.08); }
.option-item.correct { border-color: var(--success); background: rgba(16,185,129,0.08); }
.option-item.wrong { border-color: var(--danger); background: rgba(239,68,68,0.08); }
.option-radio {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.option-item.selected .option-radio { border-color: var(--primary); }
.option-item.selected .option-radio::after {
  content: '';
  width: 9px; height: 9px;
  background: var(--primary);
  border-radius: 50%;
}

/* ============================================================
   LIVE SESSION
   ============================================================ */
.live-room {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  height: calc(100vh - var(--topbar-height));
  background: #0F0A2E;
}
.live-main { display: flex; flex-direction: column; height: 100%; }
.live-videos-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  padding: 12px;
  overflow: auto;
}
.video-tile {
  position: relative;
  background: #1A1040;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
}
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
.video-tile-name {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.live-controls {
  height: 70px;
  background: #1A1040;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
}
.live-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 1.1rem;
}
.live-btn:hover { background: rgba(255,255,255,0.2); }
.live-btn.danger { background: var(--danger); }
.live-btn.danger:hover { background: #DC2626; }
.live-btn.active { background: var(--primary); }
.live-sidebar {
  background: #140D38;
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
}
.live-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg { display: flex; gap: 8px; }
.chat-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: white;
  font-weight: 700;
}
.chat-msg-name { font-size: 0.7rem; font-weight: 700; color: rgba(255,255,255,0.9); }
.chat-msg-text { font-size: 0.8rem; color: rgba(255,255,255,0.7); margin-top: 2px; }
.live-chat-input {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 8px;
}
.live-chat-input input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: var(--radius);
  padding: 8px 12px;
  color: white;
  font-size: 0.85rem;
  outline: none;
}
.live-chat-input input::placeholder { color: rgba(255,255,255,0.3); }

/* ============================================================
   LESSON SIDEBAR OUTLINE
   ============================================================ */
.lesson-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  min-height: calc(100vh - var(--topbar-height));
}
.lesson-main { padding: 28px; overflow: auto; }
.lesson-outline {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
}
.outline-header {
  padding: 16px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.outline-topic { padding: 0; }
.outline-topic-title {
  padding: 10px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.outline-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 28px;
  font-size: 0.825rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.outline-lesson:hover { background: var(--bg); }
.outline-lesson.active { color: var(--primary); background: rgba(79,70,229,0.05); }
.outline-lesson.completed .lesson-check { color: var(--success); }
.lesson-check { font-size: 0.75rem; flex-shrink: 0; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.9rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.75rem; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.25rem; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   NOTIFICATIONS DROPDOWN
   ============================================================ */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
}
.notif-dropdown.open { display: block; }

/* ============================================================
   UPLOAD DROPZONE
   ============================================================ */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(79,70,229,0.04);
  color: var(--primary);
}
.dropzone-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
}
.landing-nav-links { display: flex; gap: 24px; flex: 1; }
.landing-nav-links a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.landing-nav-links a:hover { color: var(--primary); }
.hero {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #1E1B4B 100%);
  padding: 96px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(124,58,237,0.3) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(6,182,212,0.2) 0%, transparent 50%);
}
.hero-content { position: relative; max-width: 760px; margin: 0 auto; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.9);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.15);
}
.hero h1 {
  font-size: 3.25rem;
  font-weight: 800;
  color: white;
  line-height: 1.2;
  margin-bottom: 20px;
}
.hero h1 span { color: #A78BFA; }
.hero p {
  font-size: 1.125rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 36px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 64px;
  padding-top: 36px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.hero-stat-value { font-size: 2rem; font-weight: 800; color: white; }
.hero-stat-label { font-size: 0.8rem; color: rgba(255,255,255,0.5); margin-top: 4px; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
}
.auth-side {
  width: 50%;
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.auth-side::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(124,58,237,0.3);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.auth-side::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(6,182,212,0.2);
  border-radius: 50%;
  bottom: -80px; left: -80px;
}
.auth-side-content { position: relative; text-align: center; color: white; }
.auth-side-logo {
  width: 64px; height: 64px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  margin: 0 auto 24px;
}
.auth-side h2 { font-size: 1.75rem; color: white; margin-bottom: 12px; }
.auth-side p { color: rgba(255,255,255,0.7); font-size: 0.95rem; }
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--bg);
}
.auth-box {
  width: 100%;
  max-width: 420px;
}
.auth-box h1 { font-size: 1.75rem; margin-bottom: 6px; }
.auth-box .subtitle { color: var(--text-muted); margin-bottom: 32px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-outline { display: none; }
  .live-room { grid-template-columns: 1fr; }
  .live-sidebar { display: none; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    width: 260px;
    transform: translateX(-260px);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .topbar-search { display: none; }
  .hero h1 { font-size: 2rem; }
  .hero-stats { gap: 24px; flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.thirds { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-side { display: none; }
  .auth-wrapper { justify-content: center; }
  .page-content { padding: 18px; }
  .landing-nav { padding: 0 16px; }
  .landing-nav-links { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .hero { padding: 64px 20px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }
.rounded-full { border-radius: var(--radius-full); }
.overflow-hidden { overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.separator { height: 1px; background: var(--border); margin: 20px 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section { padding: 64px 32px; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-title { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.section-sub { color: var(--text-muted); font-size: 1rem; max-width: 560px; margin: 0 auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   SPINNER / LOADING
   ============================================================ */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================
   CERTIFICATE
   ============================================================ */
.certificate {
  background: white;
  border: 12px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 60px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}
.certificate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(79,70,229,0.04) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(124,58,237,0.04) 0%, transparent 50%);
}
.certificate-title { font-size: 2.5rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.certificate-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 32px;
}
.certificate-name { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.certificate-course { font-size: 1rem; color: var(--text-muted); margin-bottom: 32px; }

/* ============================================================
   DRAG & DROP OUTLINE BUILDER
   ============================================================ */
.sortable-item {
  cursor: grab;
  user-select: none;
}
.sortable-item.dragging { opacity: 0.4; }
.sortable-ghost {
  background: rgba(79,70,229,0.1) !important;
  border: 2px dashed var(--primary) !important;
}

/* ============================================================
   COLOR PICKER / ADMIN BRANDING
   ============================================================ */
.color-swatch {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  display: inline-block;
}

/* ============================================================
   RICH TEXT EDITOR
   ============================================================ */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg);
}
.editor-btn {
  padding: 4px 8px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all var(--transition);
}
.editor-btn:hover { background: var(--border); color: var(--text); }
.editor-content {
  border: 1.5px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 14px;
  min-height: 200px;
  outline: none;
  font-size: 0.9rem;
  line-height: 1.7;
}
.editor-content:focus { border-color: var(--border-focus); }

/* ============================================================
   ERROR PAGES
   ============================================================ */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.error-container { text-align: center; }
.error-code { font-size: 6rem; font-weight: 800; color: var(--primary); line-height: 1; }
.error-container h1 { font-size: 1.5rem; margin: 16px 0 8px; }
.error-container p { color: var(--text-muted); margin-bottom: 24px; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .certificate { border: 12px solid #4F46E5; -webkit-print-color-adjust: exact; }
}
