/**
 * iFolo Help Center Styles
 * 帮助中心页面专用样式 - 知识库风格
 */

/* ========== 阅读进度条 ========== */
.reading-progress {
  position: fixed;
  top: 72px;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--theme), #4ade80);
  z-index: 100;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(105, 207, 61, 0.5);
}

/* ========== 面包屑导航 ========== */
.help-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 0;
  margin-bottom: 0;
  font-size: 13px;
  color: var(--text-tertiary);
}

.help-breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}

.help-breadcrumb a:hover {
  color: var(--theme);
}

.help-breadcrumb .separator {
  font-size: 10px;
  opacity: 0.5;
}

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

/* ========== 当前阅读位置指示器 ========== */
.section-indicator {
  position: fixed;
  bottom: 80px;
  /* 调高位置，避免与返回顶部按钮冲突 */
  right: 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.section-indicator.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.section-indicator .section-num {
  background: var(--theme);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
}

.section-indicator .section-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 页面基础 */
body {
  padding-top: 72px;
}

/* 独立帮助中心布局（无顶部导航栏） */
body.help-standalone {
  padding-top: 0;
}

/* ========== 顶部固定栏（Logo + 搜索） ========== */
.help-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--card-border);
  z-index: 50;
  padding: 0 24px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.help-topbar .help-logo {
  flex-shrink: 0;
  margin-right: 24px;
}

.help-topbar .help-search-bar {
  position: static;
  flex: 1;
  max-width: 480px;
  background: none;
  border: none;
  padding: 0;
  backdrop-filter: none;
}

body.help-standalone .help-sidebar {
  top: 52px;
}

body.help-standalone .sidebar-toggle {
  top: 68px;
}

body.help-standalone .reading-progress {
  top: 52px;
}

body.help-standalone .help-layout {
  padding-top: 52px;
}

/* ========== 搜索栏 ========== */
.help-search-bar {
  position: fixed;
  top: 72px;
  left: 260px;
  /* 从侧边栏后开始 */
  right: 0;
  z-index: 45;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 24px;
  /* 缩小上下内边距 */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* 左对齐 */
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.help-layout.sidebar-collapsed .help-search-bar {
  left: 0;
}

.help-search-bar .search-container {
  width: 100%;
  max-width: 480px;
  /* 缩小搜索框最大宽度 */
  position: relative;
}

.help-search-bar .search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.help-search-bar .search-input-wrapper i {
  position: absolute;
  left: 14px;
  color: var(--text-tertiary);
  font-size: 14px;
  transition: color 0.2s;
}

.help-search-bar .search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  /* 缩小内边距 */
  background: var(--card);
  border: 1px solid var(--card-border);
  /* 边框变细 */
  border-radius: 10px;
  /* 圆角变小 */
  font-size: 14px;
  /* 字体变小 */
  color: var(--text);
  outline: none;
  transition: all 0.2s ease;
}

.help-search-bar .search-input::placeholder {
  color: var(--text-tertiary);
  font-size: 13px;
}

.help-search-bar .search-input:focus {
  border-color: var(--theme);
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(105, 207, 61, 0.15);
}

.search-input:focus+.search-input-wrapper i,
.search-input:focus~i {
  color: var(--theme);
}

.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: none;
  transition: color 0.2s;
}

.search-clear.visible {
  display: block;
}

.search-clear:hover {
  color: var(--text);
}

/* ========== 搜索结果下拉 ========== */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  max-height: 380px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 3px;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--card-border);
  transition: all 0.15s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(105, 207, 61, 0.08);
}

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

.search-result-title mark {
  background: rgba(105, 207, 61, 0.3);
  color: var(--text);
  padding: 1px 3px;
  border-radius: 3px;
}

.search-result-section {
  font-size: 11px;
  color: var(--theme);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-result-preview {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

.search-result-preview mark {
  background: rgba(105, 207, 61, 0.3);
  color: var(--text);
  padding: 1px 3px;
  border-radius: 3px;
}

.search-no-results {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
}

.search-no-results i {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

/* ========== 页面布局 ========== */
.help-layout {
  display: block;
  min-height: calc(100vh - 72px - 60px);
  padding-top: 60px;
  position: relative;
}

.help-layout.sidebar-collapsed .help-content {
  margin-left: auto;
  margin-right: auto;
}

/* ========== 左侧边栏 ========== */
.help-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--card-border);
  position: fixed;
  top: 132px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.help-sidebar::-webkit-scrollbar {
  width: 6px;
}

.help-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.help-sidebar::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 3px;
}

.help-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.help-sidebar.collapsed {
  transform: translateX(-260px);
}

/* 侧边栏切换按钮 */
.sidebar-toggle {
  position: fixed;
  top: 148px;
  left: 260px;
  z-index: 41;
  width: 28px;
  height: 56px;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-left: none;
  border-radius: 0 12px 12px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-toggle:hover {
  background: var(--theme-light);
  color: var(--theme);
  width: 32px;
}

.sidebar-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle.collapsed {
  left: 0;
  border-left: 1px solid var(--card-border);
  border-radius: 0 12px 12px 0;
}

.sidebar-toggle.collapsed svg {
  transform: rotate(180deg);
}

/* 侧边栏头部 */
.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--card-border);
  background: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--theme), rgba(105, 207, 61, 0.4));
  border-radius: 2px;
}

.sidebar-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 400;
  padding-left: 12px;
}

/* 侧边栏导航 */
.sidebar-nav {
  padding: 16px 0 32px;
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group:last-child {
  margin-bottom: 0;
}

.nav-group-title {
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-group-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--card-border), transparent);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  margin: 2px 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 8px;
  position: relative;
}

.nav-item:hover {
  background: rgba(105, 207, 61, 0.08);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(105, 207, 61, 0.15), rgba(105, 207, 61, 0.05));
  color: var(--theme);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--theme);
  border-radius: 0 2px 2px 0;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.nav-item:hover i {
  opacity: 1;
  color: var(--theme);
}

.nav-item.active i {
  opacity: 1;
  color: var(--theme);
}

.nav-item span {
  flex: 1;
}

/* ========== 右侧内容区 ========== */
.help-content {
  margin-left: 260px;
  padding: 40px 56px;
  max-width: 880px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.help-content.expanded {
  margin-left: 40px;
}

.help-section {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--card-border);
}

.help-section:last-child {
  border-bottom: none;
}

.help-section h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.section-intro {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.7;
}

/* ========== 帮助卡片 ========== */
.help-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.help-card:hover {
  border-color: rgba(105, 207, 61, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.help-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.help-card p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
  font-size: 14px;
}

.help-card ul,
.help-card ol {
  padding-left: 18px;
  color: var(--text-secondary);
}

.help-card li {
  margin-bottom: 8px;
  line-height: 1.6;
  font-size: 14px;
}

/* 步骤列表 */
.step-list {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.step-list li {
  position: relative;
  padding-left: 36px;
  margin-bottom: 14px;
  font-size: 14px;
}

.step-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--theme), rgba(105, 207, 61, 0.7));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

/* 表格 */
.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}

.help-table th,
.help-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

.help-table th {
  font-weight: 600;
  color: var(--text);
  background: rgba(105, 207, 61, 0.05);
  font-size: 13px;
}

.help-table td {
  color: var(--text-secondary);
}

.help-table tr:hover td {
  background: rgba(105, 207, 61, 0.03);
}

/* 提示框 */
.tip-box {
  background: rgba(105, 207, 61, 0.08);
  border-left: 3px solid var(--theme);
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.warning-box {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #F59E0B;
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* 代码 */
code {
  background: var(--card);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  border: 1px solid var(--card-border);
  color: var(--theme);
}

/* ========== Footer 适配 ========== */
.footer {
  margin-left: 260px !important;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.help-layout.sidebar-collapsed+.footer {
  margin-left: 0 !important;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .help-search-bar {
    left: 0;
    padding: 10px 16px;
  }

  .help-sidebar {
    transform: translateX(-260px);
    top: 132px;
    box-shadow: none;
  }

  .help-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  }

  .sidebar-toggle {
    left: 0;
    top: 148px;
    border-left: 1px solid var(--card-border);
    height: 48px;
    width: 24px;
  }

  .sidebar-toggle.mobile-open {
    left: 260px;
    border-left: none;
  }

  .sidebar-toggle.mobile-open svg {
    transform: rotate(0);
  }

  .help-content {
    margin-left: 0;
    padding: 24px 16px;
  }

  .sidebar-header {
    padding: 20px 16px 16px;
  }

  .sidebar-title {
    font-size: 16px;
  }

  .nav-item {
    padding: 10px 16px;
    margin: 2px 6px;
  }

  .nav-group-title {
    padding: 8px 16px;
    font-size: 10px;
  }

  .help-section h1 {
    font-size: 22px;
  }

  .section-intro {
    font-size: 14px;
  }

  .footer {
    margin-left: 0 !important;
  }

  .section-indicator {
    bottom: 16px;
    right: 16px;
    padding: 10px 12px;
  }

  .help-breadcrumb {
    padding: 12px 0 0;
    font-size: 12px;
  }
}

/* ========== 可折叠侧边栏分组 ========== */
.nav-group-title {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.nav-group-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-tertiary);
  border-bottom: 1.5px solid var(--text-tertiary);
  transform: rotate(45deg);
  margin-right: 8px;
  transition: transform 0.2s ease;
}

.nav-group.collapsed .nav-group-title::before {
  transform: rotate(-45deg);
}

.nav-group-items {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.3s ease-out, opacity 0.2s ease;
  opacity: 1;
}

.nav-group.collapsed .nav-group-items {
  max-height: 0;
  opacity: 0;
}

/* ========== 增强卡片样式 ========== */
.help-card {
  position: relative;
  overflow: hidden;
}

.help-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--theme), rgba(105, 207, 61, 0.3));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.help-card:hover::before {
  opacity: 1;
}

/* 章节计数器 */
.help-section {
  counter-increment: section;
}

.help-section h1::before {
  content: counter(section, decimal-leading-zero);
  font-size: 14px;
  font-weight: 600;
  color: var(--theme);
  background: rgba(105, 207, 61, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
  margin-right: 12px;
  vertical-align: middle;
}

/* ========== 快速跳转按钮组 ========== */
.quick-nav {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 45;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.quick-nav:hover {
  opacity: 1;
}

.quick-nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--card-border);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.quick-nav-dot:hover {
  background: var(--theme);
  transform: scale(1.3);
}

.quick-nav-dot.active {
  background: var(--theme);
  box-shadow: 0 0 0 3px rgba(105, 207, 61, 0.2);
}

.quick-nav-dot::before {
  content: attr(data-title);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.quick-nav-dot:hover::before {
  opacity: 1;
}

@media (max-width: 1200px) {
  .quick-nav {
    display: none;
  }
}

/* ========== 搜索结果动画 ========== */
.search-result-item {
  animation: fadeInUp 0.2s ease forwards;
  opacity: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-result-item:nth-child(1) {
  animation-delay: 0.05s;
}

.search-result-item:nth-child(2) {
  animation-delay: 0.1s;
}

.search-result-item:nth-child(3) {
  animation-delay: 0.15s;
}

.search-result-item:nth-child(4) {
  animation-delay: 0.2s;
}

.search-result-item:nth-child(5) {
  animation-delay: 0.25s;
}