/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #0f172a;
  background: #f8fafc;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 32px; }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.section { padding: 48px 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ── Surface / Card ── */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 28px;
}
.card-header { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #e2e8f0; }

/* ── Typography ── */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: 0.95rem; font-weight: 600; }
p { color: #64748b; line-height: 1.7; }
.text-muted { color: #64748b; font-size: 0.875rem; }
.text-subtle { color: #94a3b8; font-size: 0.8rem; }
.text-strong { font-weight: 600; color: #0f172a; }
.label { font-size: 0.8rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: #94a3b8; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  font-size: 0.875rem; font-weight: 500; font-family: inherit;
  border-radius: 5px; border: 1px solid transparent;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap; text-decoration: none;
}
.btn-primary { background: #0f172a; color: #fff; border-color: #0f172a; }
.btn-primary:hover { background: #1e293b; border-color: #1e293b; }
.btn-secondary { background: #ffffff; color: #0f172a; border-color: #e2e8f0; }
.btn-secondary:hover { background: #f1f5f9; }
.btn-ghost { background: transparent; color: #64748b; border-color: transparent; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; }
.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.85rem; font-weight: 500; color: #0f172a; }

input, select, textarea {
  width: 100%; padding: 10px 14px;
  font-size: 0.9rem; font-family: inherit;
  color: #0f172a; background: #ffffff;
  border: 1px solid #e2e8f0; border-radius: 5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
input::placeholder { color: #94a3b8; }

/* ── Navigation ── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 60px;
  background: #ffffff; border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1rem; color: #0f172a; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.nav-brand i { color: #3b82f6; }
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 12px; border-radius: 5px; font-size: 0.875rem;
  color: #64748b; text-decoration: none; display: flex; align-items: center; gap: 6px;
}
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link.active { background: #f1f5f9; color: #0f172a; font-weight: 500; }

/* ── Alerts ── */
.alert { padding: 14px 18px; border-radius: 5px; border: 1px solid transparent; font-size: 0.875rem; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 500; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }

/* ── Auth ── */
.auth-container {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px; background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}
.auth-card {
  width: 100%; max-width: 420px; padding: 40px;
}
.auth-header {
  text-align: center; margin-bottom: 32px;
}
.auth-icon {
  font-size: 2.5rem; color: #3b82f6; margin-bottom: 16px;
}
.auth-header h1 { font-size: 1.5rem; margin-bottom: 8px; }
.auth-toggle {
  text-align: center; margin-top: 24px; font-size: 0.875rem; color: #64748b;
}
.auth-toggle a { color: #3b82f6; text-decoration: none; font-weight: 500; margin-left: 4px; }
.auth-toggle a:hover { text-decoration: underline; }

/* ── Courses Grid ── */
.courses-header { margin-bottom: 32px; }
.courses-header h1 { margin-bottom: 8px; }

.course-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  overflow: hidden; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}
.course-card-img {
  width: 100%; height: 180px; object-fit: cover;
  background: #e2e8f0;
}
.course-card-body { padding: 20px; }
.course-card-body h3 { margin-bottom: 8px; }
.course-card-body p { font-size: 0.875rem; margin-bottom: 12px; }
.course-card-meta {
  display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #94a3b8;
}

/* ── Lesson Layout ── */
.lesson-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 24px; margin-top: 20px;
}
.lesson-sidebar { padding: 0; overflow: hidden; align-self: start; position: sticky; top: 80px; }
.lesson-sidebar-header {
  padding: 20px; border-bottom: 1px solid #e2e8f0;
}
.lesson-sidebar-header h3 { font-size: 0.95rem; }
.lesson-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; font-size: 0.875rem; color: #64748b;
  cursor: pointer; transition: background 0.15s;
  border-left: 3px solid transparent;
}
.lesson-nav-item:hover { background: #f8fafc; color: #0f172a; }
.lesson-nav-item.active {
  background: #eff6ff; color: #1d4ed8;
  border-left-color: #3b82f6; font-weight: 500;
}
.lesson-nav-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: #f1f5f9; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
}
.lesson-nav-item.active .lesson-nav-num {
  background: #3b82f6; color: #fff;
}

/* ── Lesson Content ── */
.lesson-content { padding: 36px; }
.lesson-content h2 { font-size: 1.6rem; margin-bottom: 24px; }
.lesson-content h3 { margin: 24px 0 12px; font-size: 1.15rem; }
.lesson-content p { margin-bottom: 16px; color: #334155; }
.lesson-content ul, .lesson-content ol {
  margin: 12px 0 16px 24px; color: #334155;
}
.lesson-content li { margin-bottom: 6px; line-height: 1.7; }
.lesson-content strong { color: #0f172a; }
.lesson-content blockquote {
  border-left: 3px solid #3b82f6; padding: 12px 20px;
  background: #eff6ff; border-radius: 0 6px 6px 0;
  margin: 16px 0; color: #1e40af;
}

/* ── Lesson Nav Buttons ── */
.lesson-nav-buttons {
  display: flex; justify-content: space-between; margin-top: 32px;
  padding-top: 24px; border-top: 1px solid #e2e8f0;
}

/* ── Profile ── */
.profile-card { max-width: 560px; }
.profile-info { padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.profile-info:last-child { border-bottom: none; }
.profile-info .label { margin-bottom: 4px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .grid-3 { grid-template-columns: 1fr; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; }
  .nav { padding: 0 16px; gap: 8px; }
  .nav-links { gap: 0; }
  .nav-link span { display: none; }
}
