/* ==========================================================================
   Design System Tokens — SPR-2.0.1
   ========================================================================== */
:root {
  /* Color palette (dark theme) */
  --bg-primary: #0f1117;
  --bg-surface: #1a1d27;
  --bg-elevated: #252836;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-warm: #f59e0b;
  --accent-success: #10b981;
  --accent-cta: #16a34a;
  --border: #2d3149;

  /* Spacing */
  --space-section: 4rem;
  --space-card: 1.5rem;
  --max-content-width: 1200px;

  /* Typography */
  --font-heading: 'Heebo', Arial, sans-serif;
  --font-body: 'Inter', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   Base styles
   ========================================================================== */
body {
    font-family: var(--font-body), Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-family: var(--font-heading);
}

/* Ensure text-muted is visible on dark backgrounds */
.text-muted {
    color: var(--text-secondary) !important;
}

/* ==========================================================================
   Component: .card-surface
   ========================================================================== */
.card-surface {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-card);
}

/* ==========================================================================
   Component: .whatsapp-sticky
   ========================================================================== */
.whatsapp-sticky {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  background-color: var(--accent-cta);
  color: #fff;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.whatsapp-sticky:hover {
  background-color: #15803d;
  color: #fff;
}

/* RTL mirror */
html[dir="rtl"] .whatsapp-sticky {
  right: auto;
  left: 16px;
}

/* Mobile: shrink to 48px */
@media (max-width: 768px) {
  .whatsapp-sticky {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    bottom: 1rem;
    right: 1rem;
  }
}

/* ==========================================================================
   Keyboard focus
   ========================================================================== */
:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Corporate page components
   ========================================================================== */
.corporate-hero-photo {
  max-width: 300px;
  height: auto;
  border-radius: 50%;
}

@media (max-width: 768px) {
  .corporate-hero-photo {
    max-width: 200px;
  }
}

.corporate-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.corporate-tier-cta {
  width: 100%;
  display: block;
}

/* Lesson notes markdown content */
.lesson-notes { padding: var(--space-card); }
.lesson-notes pre {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}
.lesson-notes code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    direction: ltr;
    unicode-bidi: embed;
}

/* ==========================================================================
   Lesson page — two-column layout
   ========================================================================== */
.lesson-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

/* Sidebar — rendered FIRST in HTML so it sits on the right in RTL */
.lesson-sidebar {
  flex-shrink: 0;
  width: 280px;
}

.lesson-sidebar-inner {
  position: sticky;
  top: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.lesson-sidebar-course-title {
  display: block;
  padding: .75rem 1rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.lesson-sidebar-course-title:hover { color: var(--accent-primary); }

.lesson-list {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.lesson-list-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: .82rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.lesson-list-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.lesson-list-item--active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  border-inline-end: 3px solid var(--accent-primary);
}
.lesson-list-item--locked {
  cursor: not-allowed;
  opacity: .45;
  pointer-events: none;
}

.lesson-list-icon { flex-shrink: 0; width: 18px; text-align: center; }
.lesson-list-title { flex-grow: 1; line-height: 1.3; }
.lesson-list-dur { flex-shrink: 0; font-size: .75rem; opacity: .7; }

/* Main content area */
.lesson-main { flex-grow: 1; min-width: 0; }

/* 16:9 responsive player */
.lesson-player {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 10px;
}
.lesson-player iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* Placeholder when not configured */
.lesson-player-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 260px;
  border-radius: 10px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

/* Mobile: collapse sidebar */
@media (max-width: 767px) {
  .lesson-layout { flex-direction: column; }
  .lesson-sidebar { width: 100%; }
  .lesson-sidebar-inner { position: static; }
  .lesson-list { max-height: 240px; }
}

/* ==========================================================================
   Lesson quiz
   ========================================================================== */
.quiz-option {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.quiz-option:hover { border-color: var(--accent-primary); }
.quiz-option:has(input:checked) {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 12%, var(--bg-elevated));
}
.quiz-already-done { opacity: .75; }

/* ==========================================================================
   Course completion certificate
   ========================================================================== */
.certificate-card {
  width: min(700px, 100%);
  background: var(--bg-surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border), 0 8px 40px rgba(0,0,0,.4);
}

.certificate-border {
  border: 6px solid transparent;
  background: linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
              linear-gradient(135deg, #d4af37, #f5e17a, #d4af37) border-box;
  border-radius: 12px;
  padding: 3rem 2.5rem;
  text-align: center;
}

.certificate-logo { margin-bottom: 1rem; opacity: .8; }

.certificate-label {
  font-size: 1rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.certificate-awarded-to {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: .25rem;
}

.certificate-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.certificate-text {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: .4rem;
}

.certificate-course {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.certificate-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #d4af37, transparent);
  margin: 0 auto 1.25rem;
}

.certificate-date {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: .5rem;
}

.certificate-id {
  font-size: .75rem;
  color: var(--text-secondary);
  opacity: .6;
  margin: 0;
}
.certificate-id code {
  font-size: .7rem;
  letter-spacing: .03em;
}

/* Print: light background for physical printing */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .certificate-border {
    background: #fff;
    border: 6px solid #d4af37;
    color: #000;
  }
  .certificate-label { color: #b8860b; }
  .certificate-name, .certificate-course { color: #111; }
  .certificate-awarded-to, .certificate-text, .certificate-date, .certificate-id { color: #444; }
  nav, .lesson-sidebar, .d-flex.gap-3.mt-4 { display: none !important; }
}

a { color: #2c6e49; }
