/* OpenClaw 教程详情页样式 */

/* ===== 布局结构 ===== */
.lesson-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ===== 左侧课程导航 ===== */
.lesson-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8ecf1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  padding: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s;
}

.sidebar-back:hover {
  background: #f3f7fb;
  color: var(--brand-strong);
}

.sidebar-back .arrow {
  transition: transform 0.2s;
}

.sidebar-back:hover .arrow {
  transform: translateX(-3px);
}

.lesson-sidebar__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f4f8;
}

.lesson-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lesson-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 13px;
  transition: all 0.2s;
}

.lesson-nav__item:hover {
  background: #f3f7fb;
  color: var(--brand);
}

.lesson-nav__item.active {
  background: linear-gradient(135deg, rgba(15, 157, 144, 0.1) 0%, rgba(46, 196, 182, 0.05) 100%);
  color: var(--brand-strong);
  font-weight: 600;
}

.lesson-nav__num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  color: #8b9aad;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  transition: all 0.2s;
}

.lesson-nav__item:hover .lesson-nav__num {
  background: rgba(15, 157, 144, 0.15);
  color: var(--brand);
}

.lesson-nav__item.active .lesson-nav__num {
  background: var(--brand);
  color: #fff;
}

.lesson-nav__text {
  flex: 1;
  line-height: 1.4;
}

/* ===== 主内容区 ===== */
.lesson-main {
  min-width: 0;
}

.lesson-container {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8ecf1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  padding: 40px 48px;
}

/* 文章内容样式 */
.lesson-content {
  font-size: 16px;
  line-height: 1.85;
  color: #1f2937;
}

.lesson-content h1 {
  font-size: 32px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--brand);
  letter-spacing: -0.02em;
}

.lesson-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 40px 0 16px;
  padding-left: 14px;
  border-left: 5px solid var(--brand);
  scroll-margin-top: 100px;
}

.lesson-content h3 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  margin: 28px 0 12px;
}

.lesson-content p {
  margin: 14px 0;
}

.lesson-content ul,
.lesson-content ol {
  margin: 14px 0;
  padding-left: 24px;
}

.lesson-content li {
  margin: 8px 0;
}

.lesson-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.lesson-content th,
.lesson-content td {
  border: 1px solid #d1d5db;
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.lesson-content th {
  background: #f3f4f6;
  font-weight: 600;
  color: #111827;
}

.lesson-content tr:nth-child(even) {
  background: #fafbfc;
}

.lesson-content pre {
  background: #0f172a;
  color: #e5e7eb;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.7;
  margin: 16px 0;
}

.lesson-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.lesson-content :not(pre) > code {
  background: #f3f4f6;
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
}

/* 提示框样式 */
.lesson-content .note,
.lesson-content .warn,
.lesson-content .good,
.lesson-content .tip {
  padding: 16px 18px;
  margin: 20px 0;
  border-radius: 10px;
  border-left: 4px solid;
  font-size: 15px;
}

.lesson-content .note {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1e40af;
}

.lesson-content .warn {
  background: #fff7ed;
  border-color: #f97316;
  color: #9a3412;
}

.lesson-content .good {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.lesson-content .tip {
  background: #fdf4ff;
  border-color: #c026d3;
  color: #86198f;
}

.lesson-content .todo-shot {
  border: 2px dashed #9ca3af;
  padding: 24px;
  text-align: center;
  color: #6b7280;
  margin: 20px 0;
  border-radius: 10px;
  background: #f9fafb;
}

.lesson-content .small {
  color: #6b7280;
  font-size: 14px;
}

.lesson-content hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 32px 0;
}

.lesson-content strong {
  color: #111827;
  font-weight: 600;
}

/* ===== 上一章/下一章导航 ===== */
.lesson-nav-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid #f0f4f8;
}

.lesson-nav-prev,
.lesson-nav-next {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.25s;
}

.lesson-nav-prev:hover,
.lesson-nav-next:hover {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 4px 16px rgba(15, 157, 144, 0.12);
  transform: translateY(-2px);
}

.lesson-nav-next {
  text-align: right;
  align-items: flex-end;
}

.lesson-nav-label {
  font-size: 12px;
  font-weight: 600;
  color: #8b9aad;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.lesson-nav-prev:hover .lesson-nav-title,
.lesson-nav-next:hover .lesson-nav-title {
  color: var(--brand-strong);
}

.lesson-nav-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ===== 章节进度指示器 ===== */
.lesson-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(15, 157, 144, 0.05) 0%, rgba(46, 196, 182, 0.03) 100%);
  border-radius: 10px;
  border: 1px solid rgba(15, 157, 144, 0.1);
}

.lesson-progress__bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.lesson-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #2ec4b6);
  border-radius: 3px;
  transition: width 0.3s;
}

.lesson-progress__text {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-strong);
  white-space: nowrap;
}

/* ===== 响应式适配 ===== */
@media (max-width: 1024px) {
  .lesson-layout {
    grid-template-columns: 220px 1fr;
    gap: 20px;
    padding: 20px 16px 40px;
  }
  
  .lesson-container {
    padding: 32px;
  }
  
  .lesson-content h1 {
    font-size: 28px;
  }
  
  .lesson-content h2 {
    font-size: 22px;
  }
}

@media (max-width: 768px) {
  .lesson-layout {
    grid-template-columns: 1fr;
  }
  
  .lesson-sidebar {
    position: static;
    max-height: none;
    order: -1;
    padding: 16px;
  }
  
  .lesson-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .lesson-nav__item {
    flex: 1;
    min-width: 140px;
    justify-content: center;
  }
  
  .lesson-nav__text {
    display: none;
  }
  
  .lesson-container {
    padding: 24px 20px;
  }
  
  .lesson-content h1 {
    font-size: 24px;
  }
  
  .lesson-content h2 {
    font-size: 20px;
    margin-top: 32px;
  }
  
  .lesson-nav-footer {
    grid-template-columns: 1fr;
  }
  
  .lesson-nav-next {
    text-align: left;
    align-items: flex-start;
  }
}
