/**
 * 天鸿智算 - 文档中心样式
 * 用于 API 文档与详情页的两栏布局
 */

/* ===== 文档中心整体布局 ===== */
.docs-layout {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
  background: #fff;
}

/* ===== 左侧导航 ===== */
.docs-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #fafafa;
  border-right: 1px solid #e5e7eb;
  padding: 24px 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.docs-sidebar::-webkit-scrollbar { width: 6px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.docs-sidebar::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.docs-sidebar-search {
  padding: 0 20px 16px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.docs-sidebar-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center;
  background-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}

.docs-sidebar-search input:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.docs-nav-section {
  margin-bottom: 8px;
}

.docs-nav-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}

.docs-nav-title:hover {
  background: #f3f4f6;
}

.docs-nav-title i.fa-chevron-down {
  margin-left: auto;
  font-size: 10px;
  color: #9ca3af;
  transition: transform .2s;
}

.docs-nav-section.collapsed .docs-nav-title i.fa-chevron-down {
  transform: rotate(-90deg);
}

.docs-nav-section.collapsed .docs-nav-list {
  display: none;
}

.docs-nav-list {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
}

.docs-nav-list a {
  display: block;
  padding: 7px 20px 7px 40px;
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all .15s;
  word-break: break-all;
  line-height: 1.5;
}

.docs-nav-list a:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.docs-nav-list a.active {
  color: #dc2626;
  font-weight: 600;
  background: #fef2f2;
  border-left-color: #dc2626;
}

/* ===== 右侧内容 ===== */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 40px 56px 80px;
  background: #fff;
}

.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 16px;
}

.docs-breadcrumb a {
  color: #6b7280;
  text-decoration: none;
}

.docs-breadcrumb a:hover {
  color: #dc2626;
}

.docs-breadcrumb i {
  font-size: 10px;
  color: #d1d5db;
}

.docs-content h1 {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 12px;
  line-height: 1.3;
}

.docs-content > p.docs-lead {
  font-size: 15px;
  color: #6b7280;
  line-height: 1.7;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.docs-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}

.docs-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  margin: 28px 0 12px;
}

.docs-content p {
  font-size: 14px;
  color: #374151;
  line-height: 1.75;
  margin-bottom: 14px;
}

.docs-content ul,
.docs-content ol {
  font-size: 14px;
  color: #374151;
  line-height: 1.8;
  padding-left: 24px;
  margin-bottom: 16px;
}

.docs-content li {
  margin-bottom: 4px;
}

.docs-content code {
  background: #f3f4f6;
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.docs-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.65;
}

.docs-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}

.docs-content table th {
  background: #f9fafb;
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

.docs-content table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #4b5563;
  vertical-align: top;
}

.docs-content table tr:hover td {
  background: #fafafa;
}

.docs-content blockquote {
  border-left: 4px solid #dc2626;
  background: #fef2f2;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
  color: #7f1d1d;
  font-size: 14px;
}

.docs-content blockquote p {
  margin: 0;
  color: inherit;
}

/* 提示框 */
.docs-tip,
.docs-warn,
.docs-info {
  padding: 14px 18px;
  border-radius: 10px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.7;
  display: flex;
  gap: 12px;
}

.docs-tip {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.docs-warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.docs-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.docs-tip i,
.docs-warn i,
.docs-info i {
  flex-shrink: 0;
  font-size: 18px;
  margin-top: 2px;
}

/* 占位区域 */
.docs-placeholder {
  background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 100%);
  border: 1px dashed #fbbf24;
  border-radius: 12px;
  padding: 24px 28px;
  margin: 24px 0;
  color: #78350f;
}

.docs-placeholder h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-placeholder p {
  font-size: 13px;
  color: #78350f;
  margin: 0;
}

/* 上下页导航 */
.docs-pagination {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.docs-pagination a {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  text-decoration: none;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.docs-pagination a:hover {
  border-color: #dc2626;
  background: #fef2f2;
  transform: translateY(-2px);
}

.docs-pagination a span:first-child {
  font-size: 12px;
  color: #9ca3af;
}

.docs-pagination a span:last-child {
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
}

.docs-pagination .next {
  text-align: right;
  align-items: flex-end;
}

/* 模型卡片网格（分类列表页） */
.docs-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.docs-model-card {
  display: block;
  padding: 18px 20px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  text-decoration: none;
  transition: all .25s;
  background: #fff;
}

.docs-model-card:hover {
  border-color: #dc2626;
  box-shadow: 0 8px 20px rgba(220,38,38,0.08);
  transform: translateY(-2px);
}

.docs-model-card .model-name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
  word-break: break-all;
}

.docs-model-card .model-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

.docs-model-card .model-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 11px;
  border-radius: 4px;
  margin-top: 8px;
}

/* 移动端 */
@media (max-width: 1024px) {
  .docs-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .3s;
    box-shadow: 4px 0 12px rgba(0,0,0,0.05);
  }

  .docs-sidebar.active {
    transform: translateX(0);
  }

  .docs-content {
    padding: 24px 20px 60px;
  }

  .docs-mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    cursor: pointer;
  }
}

@media (min-width: 1025px) {
  .docs-mobile-toggle { display: none; }
}

/* 文档中心首页样式 */
.docs-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
}

.docs-hub-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 28px;
  transition: all .25s;
  text-decoration: none;
  display: block;
}

.docs-hub-card:hover {
  border-color: #dc2626;
  box-shadow: 0 12px 28px rgba(220,38,38,0.08);
  transform: translateY(-4px);
}

.docs-hub-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  margin-bottom: 16px;
}

.docs-hub-icon.text { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.docs-hub-icon.image { background: linear-gradient(135deg, #f59e0b, #d97706); }
.docs-hub-icon.video { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.docs-hub-icon.audio { background: linear-gradient(135deg, #10b981, #047857); }
.docs-hub-icon.start { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.docs-hub-icon.guide { background: linear-gradient(135deg, #06b6d4, #0e7490); }

.docs-hub-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.docs-hub-card p {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 14px;
}

.docs-hub-card .docs-hub-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #9ca3af;
}

.docs-hub-card .docs-hub-meta .count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
