/* ============================================================
   Course Player Styles — Data Analysis
   ============================================================ */

#courseApp {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */
#courseSidebar {
  width: 300px;
  min-width: 300px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.course-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.course-sidebar-header .back-link {
  margin-right: auto;
}

.course-sidebar-header .sidebar-close {
  display: none;
}

.course-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.course-title-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  border-radius: 10px;
}

.course-title-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.course-title-text p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Progress --- */
.course-progress {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Course Nav --- */
#courseNav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
}

#courseNav::-webkit-scrollbar {
  width: 4px;
}

#courseNav::-webkit-scrollbar-track {
  background: transparent;
}

#courseNav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.module-block {
  margin-bottom: 4px;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.module-header:hover {
  background: var(--border-light);
}

.module-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.module-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.module-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: 10px;
}

.module-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.module-block.collapsed .module-arrow {
  transform: rotate(-90deg);
}

.module-lessons {
  list-style: none;
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.3s ease;
}

.module-block.collapsed .module-lessons {
  max-height: 0;
}

.module-lessons li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px 7px 44px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.module-lessons li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  border-radius: 0 3px 3px 0;
  transition: background 0.15s ease;
}

.module-lessons li:hover {
  background: var(--primary-bg);
  color: var(--primary-dark);
}

.module-lessons li:hover::before {
  background: var(--primary-light);
}

.module-lessons li.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 500;
}

.module-lessons li.active::before {
  background: var(--primary);
}

.lesson-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.lesson-check.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
  font-size: 10px;
}

.lesson-check.done::after {
  content: '\2713';
}

.lesson-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-duration {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* --- Main Content --- */
#courseMain {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.course-top-bar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.course-top-bar .sidebar-open {
  display: none;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumb .crumb-sep {
  margin: 0 8px;
  color: var(--text-muted);
}

.breadcrumb .crumb-current {
  color: var(--text);
  font-weight: 500;
}

/* --- Lesson Content --- */
.lesson-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.lesson-content::-webkit-scrollbar {
  width: 6px;
}

.lesson-content::-webkit-scrollbar-track {
  background: transparent;
}

.lesson-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.lesson-wrapper {
  max-width: 760px;
  padding: 40px 48px 100px;
}

/* --- Lesson Header --- */
.lesson-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.lesson-header .lesson-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.lesson-header .lesson-duration-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--border-light);
  padding: 4px 12px;
  border-radius: 20px;
}

.lesson-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

/* --- Objectives --- */
.objectives-box {
  background: var(--primary-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 36px;
}

.objectives-box h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.objectives-box ul {
  list-style: none;
  padding: 0;
}

.objectives-box li {
  position: relative;
  padding-left: 24px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 6px;
}

.objectives-box li::before {
  content: '\2022';
  position: absolute;
  left: 8px;
  color: var(--primary);
  font-weight: bold;
  font-size: 18px;
  line-height: 1.4;
}

/* --- Content Blocks --- */
.lesson-body {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
}

.lesson-body h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-top: 36px;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.lesson-body h2:first-child {
  margin-top: 0;
}

.lesson-body p {
  margin-bottom: 18px;
}

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

/* --- Callouts --- */
.callout {
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin: 22px 0;
  border-left: 4px solid;
}

.callout-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callout p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
}

.callout.analogy {
  background: #fefce8;
  border-color: var(--warning);
}

.callout.analogy .callout-title {
  color: #92400e;
}

.callout.tip {
  background: #ecfdf5;
  border-color: var(--success);
}

.callout.tip .callout-title {
  color: #065f46;
}

.callout.warning {
  background: #fef2f2;
  border-color: var(--danger);
}

.callout.warning .callout-title {
  color: #991b1b;
}

.callout.info {
  background: var(--primary-bg);
  border-color: var(--primary);
}

.callout.info .callout-title {
  color: var(--primary-dark);
}

/* --- Example --- */
.example-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 22px 0;
}

.example-box .example-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.example-box p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
}

/* --- Steps --- */
.steps-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 22px 0;
}

.steps-box .steps-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.steps-box ol {
  list-style: none;
  counter-reset: step-counter;
  padding: 0;
}

.steps-box li {
  position: relative;
  padding-left: 40px;
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.6;
  counter-increment: step-counter;
}

.steps-box li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-code);
}

/* --- Table --- */
.data-table {
  margin: 22px 0;
  overflow-x: auto;
}

.data-table .table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--border-light);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  line-height: 1.5;
}

.data-table tr:hover td {
  background: var(--primary-bg);
}

/* --- Code Block --- */
.code-block {
  margin: 22px 0;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.code-block .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.code-block .code-lang {
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-block pre {
  padding: 16px 20px;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.7;
  color: var(--code-text);
  white-space: pre;
  tab-size: 4;
}

/* Code syntax colors */
.code-block .tok-kw { color: #c084fc; }
.code-block .tok-str { color: #34d399; }
.code-block .tok-num { color: #fbbf24; }
.code-block .tok-com { color: #64748b; font-style: italic; }
.code-block .tok-fn { color: #60a5fa; }
.code-block .tok-op { color: #f472b6; }

/* --- SVG Diagram --- */
.svg-diagram {
  margin: 24px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
}

.svg-diagram svg {
  max-width: 100%;
  height: auto;
}

.svg-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* --- Takeaways --- */
.takeaways-box {
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 36px 0 28px;
}

.takeaways-box h3 {
  font-size: 16px;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.takeaways-box ul {
  list-style: none;
  padding: 0;
}

.takeaways-box li {
  position: relative;
  padding-left: 28px;
  font-size: 15px;
  color: #064e3b;
  line-height: 1.6;
  margin-bottom: 8px;
}

.takeaways-box li::before {
  content: '\2713';
  position: absolute;
  left: 4px;
  top: 0;
  color: var(--success);
  font-weight: bold;
  font-size: 16px;
}

/* --- Quiz --- */
.quiz-box {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 28px 0;
}

.quiz-box h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-box .quiz-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.quiz-question {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.quiz-question:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.quiz-question .q-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
  color: var(--text);
}

.quiz-option:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.quiz-option.correct {
  border-color: var(--success);
  background: #ecfdf5;
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: #fef2f2;
}

.quiz-option-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-code);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.quiz-option.selected .quiz-option-letter {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.quiz-option.correct .quiz-option-letter {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.quiz-option.incorrect .quiz-option-letter {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.quiz-explanation {
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: none;
}

.quiz-explanation.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* --- Lesson Navigation --- */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.lesson-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.lesson-nav-btn.prev {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.lesson-nav-btn.prev:hover {
  background: var(--border-light);
  color: var(--text);
}

.lesson-nav-btn.next {
  background: var(--primary);
  color: white;
  margin-left: auto;
}

.lesson-nav-btn.next:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.lesson-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Mark Complete Button --- */
.mark-complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mark-complete-btn:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.mark-complete-btn.done {
  background: var(--border-light);
  color: var(--success);
  cursor: default;
}

/* --- Welcome / Lesson List --- */
.course-welcome {
  max-width: 760px;
  padding: 60px 48px;
  text-align: center;
}

.course-welcome .welcome-icon-big {
  font-size: 64px;
  margin-bottom: 20px;
}

.course-welcome h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.course-welcome p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.course-welcome .start-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.course-welcome .start-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.course-welcome .welcome-stats {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin: 32px 0;
}

.course-welcome .w-stat-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.course-welcome .w-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  #courseSidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  #courseSidebar.open {
    transform: translateX(0);
  }

  .course-sidebar-header .sidebar-close {
    display: block;
  }

  .course-top-bar .sidebar-open {
    display: block;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .lesson-wrapper {
    padding: 24px 20px 80px;
  }

  .lesson-header h1 {
    font-size: 26px;
  }

  .course-welcome {
    padding: 40px 20px;
  }

  .course-welcome h1 {
    font-size: 28px;
  }

  .course-welcome .welcome-stats {
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .lesson-wrapper {
    padding: 20px 16px 80px;
  }

  .lesson-nav {
    flex-direction: column;
  }

  .lesson-nav-btn.next {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }
}
