*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6c47ff;
  --primary-dark: #5535e0;
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222f;
  --border: #2e2e40;
  --text: #e8e8f0;
  --text-muted: #8888a8;
  --error: #ff4d4d;
  --success: #22c55e;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── AUTH PAGES ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at 60% 20%, #1e1040 0%, var(--bg) 70%);
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.auth-logo h1 { font-size: 1.4rem; font-weight: 700; }
.logo-icon { font-size: 1.6rem; }

.auth-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.75rem; }

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--text-muted); }

.auth-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.auth-link a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }

/* ── ALERTS ── */
.alert {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  border: 1px solid transparent;
}

.alert-error {
  background: rgba(255,77,77,0.12);
  border-color: rgba(255,77,77,0.3);
  color: #ff8080;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface2); }
.btn-full { width: 100%; margin-top: 0.5rem; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }

/* ── NAVBAR ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,15,19,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-user { font-size: 0.88rem; color: var(--text-muted); }

/* ── MAIN CONTENT ── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: 0.3rem; }

/* ── COURSE GRID ── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  max-width: 1100px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.course-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 32px rgba(108,71,255,0.15);
}

.course-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  align-self: flex-start;
}

.badge-red { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-green  { background: rgba(34,197,94,0.15);  color: #4ade80; }
.badge-purple { background: rgba(108,71,255,0.15); color: #9c7eff; }

.course-info { flex: 1; }
.course-number { font-size: 0.75rem; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 0.25rem; }
.course-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.5rem; line-height: 1.4; }
.course-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }
.course-meta { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }
.meta-tag { font-size: 0.75rem; color: var(--text-muted); background: var(--surface2); padding: 0.2rem 0.6rem; border-radius: 4px; }
.course-arrow { font-size: 1.2rem; color: var(--primary); align-self: center; opacity: 0; transition: opacity 0.2s, transform 0.2s; }
.course-card:hover .course-arrow { opacity: 1; transform: translateX(4px); }

/* ── COURSE PAGE ── */
.course-page { padding-top: 1.5rem; }

.course-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

.video-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-meta { margin-top: 1.25rem; }
.video-meta h1 { font-size: 1.4rem; font-weight: 700; }
.video-meta p { color: var(--text-muted); margin-top: 0.5rem; font-size: 0.9rem; }

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 76px;
}

.sidebar h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.9rem; }

.lesson-list { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }

.lesson-list li a {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.87rem;
  transition: background 0.15s;
}

.lesson-list li a:hover { background: var(--surface2); }
.lesson-list li.active a { background: rgba(108,71,255,0.15); color: var(--primary); }

.lesson-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.lesson-list li.active .lesson-num { color: var(--primary); }

.lesson-title { font-weight: 500; line-height: 1.3; }
.lesson-dur { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .course-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

@media (max-width: 480px) {
  .auth-card { padding: 2rem 1.25rem; }
  .main-content { padding: 1.25rem 1rem 3rem; }
}

/* ── PROGRESS BAR ── */
.course-progress { margin-top: 0.9rem; }
.progress-bar-wrap { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; margin-bottom: 0.35rem; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.3s; }
.progress-label { font-size: 0.72rem; color: var(--text-muted); }
.continue-label { margin-top: 0.5rem; font-size: 0.75rem; color: #7070a0; }
.continue-label em { color: #9090c0; font-style: normal; }
