/* ── LESSON PAGE STYLES ─────────────────────────────────────────── */

/* Course Container */
.course-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  padding: 2rem;
  min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - 2rem);
  overflow-y: auto;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--brand-lighter);
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brand-dark);
  margin-bottom: 0.25rem;
}

.sidebar-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sidebar-content {
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

/* Course Sections */
.section {
  border: none;
  border-bottom: 1px solid var(--border-light);
}

.section:last-child {
  border-bottom: none;
}

.section > summary {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  user-select: none;
}

.section > summary:hover {
  background: var(--brand-lighter);
  color: var(--brand-dark);
}

.section[open] > summary {
  background: var(--brand-lighter);
  color: var(--brand-dark);
  border-bottom: 1px solid var(--border-light);
}

.section summary::-webkit-details-marker {
  display: none;
}

.section-icon {
  width: 16px;
  height: 16px;
  transform: rotate(-90deg);
  transition: var(--transition);
  color: var(--text-light);
}

.section[open] .section-icon {
  transform: rotate(0deg);
  color: var(--brand);
}

/* Lessons */
.lessons {
  background: var(--panel);
}

.lesson {
  padding: 1rem 1.5rem 1rem 2.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lesson::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-light);
  flex-shrink: 0;
  transition: var(--transition);
}

.lesson:hover {
  background: var(--brand-lighter);
  color: var(--brand-dark);
  border-left-color: var(--brand);
}

.lesson:hover::before {
  background: var(--brand);
  transform: scale(1.2);
}

.lesson.active {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-left-color: var(--brand);
  font-weight: 600;
}

.lesson.active::before {
  background: var(--brand);
  transform: scale(1.2);
}

.lesson-number {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
}

.lesson.active .lesson-number {
  color: var(--brand);
}

/* Progress Indicators */
.lesson.completed {
  background: var(--success-light);
  color: var(--success);
  border-left-color: var(--success);
}

.lesson.completed::before {
  background: var(--success);
}

.completion-check {
  margin-left: auto;
  color: var(--success);
  font-weight: bold;
  font-size: 0.9rem;
}

/* Content Area */
.content {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  height: fit-content;
}

.content-header {
  padding: 2rem 2.5rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, var(--brand-lighter) 0%, var(--panel) 100%);
}

.content-title {
  font-weight: 700;
  color: var(--brand-dark);
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.content-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.content-description {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.content-body {
  padding: 2rem 2.5rem;
}

.content-placeholder {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.content-placeholder-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.5;
}

/* Lesson Content */
.lesson-content {
  animation: fadeIn 0.3s ease-out;
}

.lesson-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--text);
}

.lesson-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.lesson-content p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Lesson Actions */
.lesson-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.complete-lesson-btn.completed {
  background: var(--success);
  color: white;
  opacity: 0.8;
}

.course-complete {
  color: var(--success);
  font-weight: 600;
  font-size: 1.1rem;
}

/* Welcome Back Section */
.welcome-back {
  text-align: center;
  padding: 3rem 2rem;
}

.welcome-back h2 {
  font-size: 2rem;
  color: var(--brand-dark);
  margin-bottom: 1rem;
}

.welcome-back p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.last-lesson-card {
  background: var(--brand-lighter);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 2rem 0;
}

.last-lesson-card h3 {
  color: var(--brand-dark);
  margin-bottom: 1rem;
}

.continue-lesson-btn {
  margin-top: 1rem;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
}

/* Video Wrapper */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 2rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
}

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

/* Suggestion Button */
.suggestion-button {
  width: 100%;
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  background: var(--brand-lighter);
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.suggestion-button:hover {
  background: var(--brand);
  color: white;
}

.suggestion-button svg {
  width: 18px;
  height: 18px;
}

/* Markdown Content Styles */
.markdown-body {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.markdown-body h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1.5rem 0;
}

.markdown-body h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 1rem 0;
}

.markdown-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.75rem 0;
}

.markdown-body p {
  margin: 0 0 1.25rem 0;
}

.markdown-body ul {
  margin: 0 0 2rem 0;
  padding-left: 1.5rem;
  list-style: disc;
}

.markdown-body ol {
  margin: 0 0 2rem 0;
  padding-left: 1.5rem;
  list-style: decimal;
}

.markdown-body li {
  margin: 0.4rem 0;
  padding-left: 0.25rem;
}

.markdown-body strong {
  font-weight: 600;
  color: var(--text);
}

.markdown-body code {
  background: var(--border-light);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
}

/* Video Styles */
.markdown-body iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 8px;
  margin: 1.5rem 0;
}

/* For older browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16/9) {
  .markdown-body iframe {
    width: 100%;
    height: 315px;
  }
}

.markdown-body pre {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: 'SF Mono', Monaco, 'Inconsolata', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.markdown-body code {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2em 0.4em;
  font-family: 'SF Mono', Monaco, 'Inconsolata', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 85%;
  color: var(--text);
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #24292f;
}

/* Markdown Links Styling */
.markdown-body a {
  color: #0066cc;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.markdown-body a:hover {
  color: #004499;
  text-decoration: underline;
}

/* Course Header Section */
.course-header-section {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 2rem 2rem 0;
}

.course-header-section .hero {
  margin-bottom: 2rem;
}

/* ── HERO (matches course landing page) ───────────────────────── */
.hero {
  background: linear-gradient(
    135deg,
    var(--brand-lighter) 0%,
    var(--panel) 50%,
    var(--brand-lighter) 100%
  );
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  margin: 0 auto 2rem;
  text-align: center;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(67, 97, 238, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(67, 97, 238, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--text);
  margin: 0 0 1rem;
  letter-spacing: -0.025em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text) 0%, var(--brand-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
          background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.5;
  font-weight: 500;
}

.hero-content {
  width: 100%;
  max-width: 900px;
  z-index: 2;
  position: relative;
}

/* ── ENROLLMENT PROMPT FOR PAID COURSE VIDEOS ──────────────────── */
.enrollment-prompt {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--brand-lighter) 0%, var(--panel) 100%);
  border: 2px solid var(--brand);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  margin: 1.5rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.enrollment-prompt::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 70%, rgba(67, 97, 238, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 30%, rgba(67, 97, 238, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.enrollment-prompt-icon {
  width: 48px;
  height: 48px;
  color: var(--brand);
  margin-bottom: 1rem;
  z-index: 2;
  position: relative;
}

.enrollment-prompt-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  text-align: center;
  z-index: 2;
  position: relative;
}

.enrollment-prompt-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  text-align: center;
  max-width: 300px;
  z-index: 2;
  position: relative;
}

.enrollment-prompt-btn {
  background: var(--brand);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  z-index: 2;
  position: relative;
}

.enrollment-prompt-btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* For older browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16/9) {
  .enrollment-prompt {
    width: 100%;
    height: 315px;
  }
}

/* ── VIDEO PLACEHOLDER AND LOADING SPINNER ──────────────────── */
.video-placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
  position: relative;
}

.video-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* For older browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16/9) {
  .video-placeholder {
    width: 100%;
    height: 315px;
  }
}