/* ============================================================
   MODULE VIEWER & LESSON CONTENT
   ============================================================ */

.module-viewer {
  padding: 32px 40px;
  max-width: var(--max-width);
  animation: fadeIn 0.4s ease;
}

.module-viewer-header {
  margin-bottom: 28px;
}

.module-viewer-header .back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--grey-500);
  margin-bottom: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  background: none;
  border: none;
  font-family: var(--font);
  padding: 4px 0;
}

.module-viewer-header .back-btn:hover {
  color: var(--blue);
}

.module-viewer-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--grey-700);
  margin-bottom: 6px;
}

.module-viewer-header .module-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--grey-500);
  flex-wrap: wrap;
}

.module-viewer-header .module-meta .separator {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--grey-300);
}

/* Lesson content */
.lesson-container {
  max-width: 800px;
}

.learning-goal {
  background: var(--blue-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  border-left: 4px solid var(--blue);
}

.learning-goal h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.learning-goal p {
  font-size: 15px;
  color: var(--grey-600);
  line-height: 1.6;
}

/* Video player */
.video-wrapper {
  margin-bottom: 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #000;
  position: relative;
}

.video-wrapper video {
  width: 100%;
  display: block;
  max-height: 500px;
  object-fit: contain;
  background: #000;
}

.video-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 10;
}

.video-progress-fill {
  height: 100%;
  background: var(--blue);
  transition: width 0.3s ease;
  width: 0%;
}

.video-watch-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-md);
  margin-top: 8px;
  font-size: 13px;
  color: var(--grey-500);
  border: 1px solid var(--glass-border);
}

.video-watch-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.video-watch-status .status-dot.pending {
  background: var(--grey-300);
}

.video-watch-status .status-dot.watching {
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.video-watch-status .status-dot.complete {
  background: var(--success);
}

/* Lesson sections */
.lesson-section {
  margin-bottom: 24px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-glass);
}

.lesson-section h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--grey-700);
  margin-bottom: 12px;
}

.lesson-section h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--grey-700);
  margin-bottom: 8px;
  margin-top: 16px;
}

.lesson-section p {
  font-size: 15px;
  color: var(--grey-600);
  line-height: 1.7;
  margin-bottom: 12px;
}

.lesson-section ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.lesson-section li {
  font-size: 15px;
  color: var(--grey-600);
  line-height: 1.6;
  margin-bottom: 6px;
  list-style: disc;
}

.lesson-section li strong {
  color: var(--grey-700);
}

/* Callout boxes */
.callout {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  position: relative;
}

.callout-tip { background: var(--teal-light); border-left: 4px solid var(--teal); }
.callout-warning { background: var(--warning-light); border-left: 4px solid var(--warning); }
.callout-mistake { background: var(--error-light); border-left: 4px solid var(--error); }
.callout-note { background: var(--blue-light); border-left: 4px solid var(--blue); }
.callout-fun { background: var(--purple-light); border-left: 4px solid var(--purple); }

.callout h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.callout p {
  font-size: 14px;
  margin-bottom: 0;
  line-height: 1.6;
}

.callout-tip h4 { color: var(--teal); }
.callout-warning h4 { color: #B8860B; }
.callout-mistake h4 { color: var(--error); }
.callout-note h4 { color: var(--blue); }
.callout-fun h4 { color: var(--purple); }

/* Example boxes */
.example-box {
  border: 2px solid var(--grey-200);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.example-box.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.example-box.incorrect {
  border-color: var(--error);
  background: var(--error-light);
}

.example-box h4 {
  font-size: 14px;
  margin-bottom: 8px;
}

.example-box.correct h4 { color: var(--success); }
.example-box.incorrect h4 { color: var(--error); }

.example-box p {
  font-size: 14px;
  color: var(--grey-600);
  margin-bottom: 0;
}

/* Table compare */
.table-compare {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-compare th {
  background: var(--navy);
  color: var(--white);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
}

.table-compare td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-100);
}

.table-compare tr:nth-child(even) td {
  background: var(--grey-50);
}

.table-compare .good { color: var(--success); font-weight: 600; }
.table-compare .bad { color: var(--error); }

/* Decision tree */
.decision-tree { margin-bottom: 24px; }

.tree-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: var(--transition);
  cursor: default;
}

.tree-step:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.tree-step .step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.tree-step .step-question {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--grey-700);
}

.tree-step .step-yes {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.tree-step .step-no {
  font-size: 12px;
  color: var(--error);
  font-weight: 600;
}

.tree-arrow {
  text-align: center;
  color: var(--grey-400);
  font-size: 18px;
  margin: -4px 0;
}

/* Module quiz CTA */
.quiz-cta {
  margin-top: 32px;
  padding: 28px;
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
}

.quiz-cta h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--grey-700);
  margin-bottom: 8px;
}

.quiz-cta p {
  font-size: 14px;
  color: var(--grey-500);
  margin-bottom: 20px;
}

/* Worked example */
.worked-example-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.worked-video-section {
  position: sticky;
  top: 24px;
  align-self: start;
}

.worked-video-section video {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.worked-timeline {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--glass-border);
}

.worked-timeline .segment-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.worked-timeline .segment-bar div {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 600;
  color: var(--white);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.worked-timeline .segment-bar div:hover {
  transform: scaleY(1.08);
}

.worked-timeline .segment-bar div.active {
  outline: 2px solid var(--white);
  outline-offset: -2px;
}

.worked-timeline .segment-bar div.done {
  opacity: 0.6;
}

.seg-color-0 { background: #4285F4; }
.seg-color-1 { background: #EA4335; }
.seg-color-2 { background: #FBBC04; }
.seg-color-3 { background: #34A853; }
.seg-color-4 { background: #FA7B17; }
.seg-color-5 { background: #7C3AED; }
.seg-color-6 { background: #0D9488; }
.seg-color-7 { background: #E91E63; }
.seg-color-8 { background: #00BCD4; }

.worked-detail {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-glass);
}

.worked-detail .segment-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.worked-detail .segment-time {
  font-size: 22px;
  font-weight: 800;
  color: var(--grey-700);
  margin-bottom: 12px;
}

.worked-detail .segment-label {
  background: var(--blue-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  border-left: 4px solid var(--blue);
}

.worked-detail .segment-section {
  margin-bottom: 14px;
}

.worked-detail .segment-section h5 {
  font-size: 12px;
  font-weight: 700;
  color: var(--grey-500);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.worked-detail .segment-section p {
  font-size: 14px;
  color: var(--grey-600);
  line-height: 1.6;
}

.worked-frame {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--grey-100);
  transition: opacity 0.3s ease;
}

.worked-storyboard {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.worked-storyboard .thumb {
  flex: 1;
  aspect-ratio: 16/9;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid transparent;
  transition: var(--transition-fast);
  position: relative;
  background: var(--grey-100);
}

.worked-storyboard .thumb:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
}

.worked-storyboard .thumb.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-glow);
}

.worked-storyboard .thumb .thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 7px;
  font-weight: 600;
  padding: 2px 4px;
  text-align: center;
}

@media (max-width: 900px) {
  .module-viewer {
    padding: 20px;
  }

  .worked-example-container {
    grid-template-columns: 1fr;
  }

  .worked-video-section {
    position: static;
  }
}

@media (max-width: 600px) {
  .module-viewer-header h1 {
    font-size: 20px;
  }

  .lesson-section {
    padding: 18px 16px;
  }
}
