/**
 * QuantaPay 文档详情页样式
 * 三栏布局：左导航 + 中内容 + 右目录
 */

/* === 基础样式重置 === */
body {
  margin: 0;
  padding: 0;
  padding-top: 80px; /* 给固定头部留出空间 */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--doc-text, #0f172a);
  background: var(--doc-bg-secondary, #f8fafc);
  line-height: 1.6;
}

* {
  box-sizing: border-box;
}

a {
  text-decoration: none;
  color: inherit;
}

/* === 面包屑导航 === */
.breadcrumb-nav {
  background: white;
  border-bottom: 1px solid var(--doc-border, #e2e8f0);
  padding: 1rem 0;
}

.breadcrumb-nav .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

.breadcrumb li {
  display: flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: '›';
  margin-left: 0.5rem;
  color: var(--doc-text-muted, #64748b);
}

.breadcrumb a {
  color: var(--doc-primary, #0ea5e9);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb li:last-child {
  color: var(--doc-text-muted, #64748b);
}

/* === 文档布局 === */
.doc-layout {
  background: var(--doc-bg-secondary, #f8fafc);
  min-height: calc(100vh - 80px);
  padding: 2rem 0;
}

.doc-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === 左侧导航 === */
.doc-sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-sticky {
  position: sticky;
  top: 100px;
}

/* === 主要内容区 === */
.doc-content {
  background: white;
  border: 1px solid var(--doc-border, #e2e8f0);
  border-radius: 0.75rem;
  padding: 3rem;
  min-width: 0;
}

.doc-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--doc-border, #e2e8f0);
}

.doc-header .doc-type-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.doc-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--doc-text, #0f172a);
  margin: 0 0 0.75rem 0;
  line-height: 1.2;
}

.doc-excerpt {
  font-size: 1.125rem;
  color: var(--doc-text-muted, #64748b);
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.doc-meta {
  font-size: 0.875rem;
  color: var(--doc-text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* === 文档主体内容 === */
.doc-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--doc-text, #0f172a);
}

.doc-body h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--doc-border, #e2e8f0);
  color: var(--doc-text, #0f172a);
}

.doc-body h2:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.doc-body h3 {
  font-size: 1.375rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem 0;
  color: var(--doc-text, #0f172a);
}

.doc-body h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem 0;
  color: var(--doc-text, #0f172a);
}

.doc-body p {
  margin: 0 0 1.25rem 0;
}

.doc-body a {
  color: var(--doc-primary, #0ea5e9);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.doc-body a:hover {
  border-bottom-color: var(--doc-primary, #0ea5e9);
}

.doc-body ul,
.doc-body ol {
  margin: 0 0 1.25rem 0;
  padding-left: 1.5rem;
}

.doc-body li {
  margin-bottom: 0.5rem;
}

.doc-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
  background: #f1f5f9;
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  color: #e11d48;
}

.doc-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.doc-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.875rem;
}

.doc-body blockquote {
  border-left: 4px solid var(--doc-primary, #0ea5e9);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--doc-text-muted, #64748b);
}

.doc-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.doc-body th,
.doc-body td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--doc-border, #e2e8f0);
  text-align: left;
}

.doc-body th {
  background: var(--doc-bg-secondary, #f8fafc);
  font-weight: 600;
}

/* === 右侧目录和操作按钮 - 隐藏 === */
.doc-toc,
.doc-actions,
.doc-footer-nav {
  display: none;
}

/* === 响应式 === */
@media (max-width: 1024px) {
  .doc-wrapper {
    grid-template-columns: 1fr;
  }

  .doc-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .doc-content {
    padding: 1.5rem;
  }

  .doc-header h1 {
    font-size: 1.75rem;
  }

  .doc-footer-nav {
    grid-template-columns: 1fr;
  }

  .nav-next {
    text-align: left;
  }
}

/* === 加载状态 === */
.doc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.doc-loading i {
  font-size: 2.5rem;
  color: var(--doc-primary, #0ea5e9);
  animation: spin 1s linear infinite;
}

.doc-loading p {
  margin-top: 1rem;
  color: var(--doc-text-muted, #64748b);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
