/* ========== Sidebar ========== */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

#sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

#sidebar-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

#sidebar-header p {
  font-size: 12px;
  color: var(--text-tertiary);
}

#progress-bar-container {
  position: relative;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

#progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

#progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--accent), var(--coral));
  border-radius: 3px;
  transition: width 0.3s ease;
}

#progress-text {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding-left: 8px;
}

#sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Scrollbar */
#sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
#sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.nav-chapter {
  margin-bottom: 2px;
}

.nav-chapter-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: background 0.15s;
  user-select: none;
}

.nav-chapter-header:hover {
  background: var(--bg-tertiary);
}

.nav-chapter-header .chapter-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-chapter.locked .nav-chapter-header {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-chapter-header .chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.nav-chapter.expanded .chevron {
  transform: rotate(90deg);
}

.nav-sections {
  display: none;
  padding-bottom: 4px;
}

.nav-chapter.expanded .nav-sections {
  display: block;
}

.nav-section-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 8px 52px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-section-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-section-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
  border-left-color: var(--accent);
}

.nav-section-item.completed .section-status {
  background: var(--success);
  border-color: var(--success);
}

.nav-section-item.completed .section-status::after {
  content: '\2713';
  color: white;
  font-size: 10px;
  font-weight: 700;
}

.lesson-title-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lesson-optional-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  border: 1px solid var(--border-color);
}

.nav-section-item.optional-lesson .lesson-title-text {
  color: var(--text-tertiary);
}

.section-status {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
}

/* Chapter color coding */
.nav-chapter[data-phase="basic"] .chapter-num { background: var(--accent-light); color: var(--accent); }
.nav-chapter[data-phase="interactive"] .chapter-num { background: var(--coral-light); color: var(--coral); }
.nav-chapter[data-phase="advanced"] .chapter-num { background: var(--teal-light); color: var(--teal); }
.nav-chapter[data-phase="application"] .chapter-num { background: var(--amber-light); color: var(--amber); }
