/* 火狐支付文档皮 — 参考 mi.gdggdf.top/doc（蓝侧栏 + 白卡片 + V1/V2 顶栏） */
:root {
  --doc-bg: #f8fafc;
  --doc-sidebar-from: #4585d2;
  --doc-sidebar-to: #4280cb;
  --doc-border: #e2e8f0;
  --doc-text: #1e293b;
  --doc-muted: #64748b;
  --doc-accent: #4585d2;
  --doc-accent-soft: rgba(69, 133, 210, .12);
  --doc-tab-active: #667eea;
  --doc-code-bg: #1e293b;
  --doc-code-fg: #e2e8f0;
  --doc-radius: 12px;
  --doc-nav-h: 70px;
  --doc-tabs-h: 58px;
  --doc-sidebar-w: 280px;
  --doc-card-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}

html, body {
  background: var(--doc-bg) !important;
  color: var(--doc-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ========== 顶栏 ========== */
#navbar {
  height: var(--doc-nav-h) !important;
  background: #fff !important;
  border-bottom: 1px solid var(--doc-border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
  z-index: 1000;
}
#navbar .bg-blur {
  background: transparent !important;
  box-shadow: none !important;
  height: var(--doc-nav-h) !important;
  line-height: var(--doc-nav-h) !important;
  backdrop-filter: none !important;
}
#navbar .navbar-body {
  padding: 0 24px !important;
  height: var(--doc-nav-h);
  display: flex;
  align-items: center;
}
#navbar .nav-menu {
  display: flex !important;
  align-items: center;
  gap: 12px;
}
#navbar .nav-menu .logo {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--doc-text) !important;
  font-size: 16px;
  text-decoration: none !important;
}
#navbar .nav-menu .logo img {
  width: 32px;
  height: 32px;
  max-height: 32px !important;
  border-radius: 8px;
}
#navbar .doc-brand-text {
  color: var(--doc-text);
  font-weight: 650;
}
#navbar .layui-nav {
  background: transparent !important;
}
#navbar .layui-nav .layui-nav-item a {
  color: var(--doc-muted) !important;
  font-size: 14px;
  font-weight: 500;
}
#navbar .layui-nav .layui-nav-item a:hover,
#navbar .layui-nav .layui-this a {
  color: var(--doc-accent) !important;
}

/* ========== V1 / V2 版本切换 ========== */
.doc-version-tabs {
  position: fixed;
  top: var(--doc-nav-h);
  left: 0;
  right: 0;
  height: var(--doc-tabs-h);
  background: #fff;
  border-bottom: 2px solid var(--doc-border);
  z-index: 998;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}
.doc-version-tabs .tabs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.doc-version-tabs .tab-btn {
  flex: 1;
  max-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 28px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: var(--doc-muted);
  text-decoration: none !important;
  transition: all .25s ease;
  box-sizing: border-box;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.doc-version-tabs .tab-btn:hover {
  background: #f8fafc;
  color: #334155;
}
.doc-version-tabs .tab-btn.active {
  color: var(--doc-tab-active);
  border-bottom-color: var(--doc-tab-active);
  background: #f8fafc;
  font-weight: 600;
}
.doc-version-tabs .tab-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ========== 蓝渐变侧栏 ========== */
#leftbar,
#leftbar.layui-nav-side {
  position: fixed !important;
  left: 0 !important;
  top: calc(var(--doc-nav-h) + var(--doc-tabs-h)) !important;
  width: var(--doc-sidebar-w) !important;
  height: calc(100vh - var(--doc-nav-h) - var(--doc-tabs-h)) !important;
  background: linear-gradient(160deg, var(--doc-sidebar-from), var(--doc-sidebar-to)) !important;
  border-right: 0 !important;
  box-shadow: 2px 0 10px rgba(0, 0, 0, .1) !important;
  color: #fff !important;
  overflow-y: auto;
  display: block !important;
  visibility: visible !important;
  z-index: 900 !important;
}
#leftbar .layui-tab {
  margin: 0 !important;
}
#leftbar .layui-tab-title {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, .2) !important;
  height: 48px !important;
  padding: 0 12px !important;
}
#leftbar .layui-tab-title li {
  color: rgba(255, 255, 255, .75) !important;
  line-height: 48px !important;
}
#leftbar .layui-tab-title .layui-this {
  color: #fff !important;
  font-weight: 600 !important;
}
#leftbar .layui-tab-title .layui-this:after {
  border-bottom-color: #fff !important;
}
#leftbar .layui-tab-content {
  padding: 12px 10px 60px !important;
}
#leftbar .copyright {
  background: transparent !important;
  color: rgba(255, 255, 255, .65) !important;
  border-top: 1px solid rgba(255, 255, 255, .15) !important;
  font-size: 12px !important;
}

/* 目录树：白字导航风格 */
.ztree * {
  font-family: inherit !important;
  font-size: 14px !important;
}
.ztree li {
  line-height: 42px !important;
  padding-left: .35em !important;
}
.ztree li a {
  height: 42px !important;
  color: rgba(255, 255, 255, .92) !important;
  border-radius: 8px;
  margin-right: 8px;
  font-weight: 500;
  transition: all .25s ease;
}
.ztree li a::before {
  height: 42px !important;
  border-radius: 8px;
  background: transparent !important;
}
.ztree li a.curSelectedNode {
  color: #fff !important;
  font-weight: 600 !important;
}
.ztree li a.curSelectedNode::before {
  background: rgba(255, 255, 255, .18) !important;
}
.ztree li a.curSelectedNode::after {
  background-color: #fff !important;
  height: 22px !important;
  top: 10px !important;
  border-radius: 2px;
  width: 3px !important;
}
.ztree li a:hover {
  color: #fff !important;
}
.ztree li a:hover::before {
  background: rgba(255, 255, 255, .12) !important;
}
.ztree li ul {
  background: transparent !important;
}
.ztree li span.button {
  filter: brightness(0) invert(1);
  opacity: .85;
}

.layui-tab-item:not(.layui-show) .searchResultNone {
  display: none !important;
}
.searchResultNone {
  position: relative !important;
  top: auto !important;
  width: auto !important;
  padding: 40px 16px;
  display: none;
  color: rgba(255, 255, 255, .8);
}
#treeSearch:empty + .searchResultNone,
.searchBox .searchResultNone.show {
  display: block;
}

#searchForm {
  padding: 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, .15) !important;
}
#search-keyword {
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, .35) !important;
  height: 36px !important;
  background: rgba(255, 255, 255, .15) !important;
  color: #fff !important;
}
#search-keyword::placeholder {
  color: rgba(255, 255, 255, .6);
}
#search-keyword:focus {
  border-color: #fff !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .22) !important;
}
#leftbar .input-icon {
  color: rgba(255, 255, 255, .7) !important;
}
#treeSearch li a {
  color: #fff !important;
}
#treeSearch li a h3 {
  color: #fff !important;
}
#treeSearch li a p {
  color: rgba(255, 255, 255, .7) !important;
}

/* ========== 正文区 ========== */
#body {
  padding-top: calc(var(--doc-nav-h) + var(--doc-tabs-h)) !important;
  padding-left: var(--doc-sidebar-w) !important;
  background: var(--doc-bg) !important;
  min-height: 100vh;
}
#content_body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 80px !important;
  box-sizing: border-box;
}
#article-content.markdown-body {
  max-width: none;
  margin: 0;
  padding: 0 !important;
  box-sizing: border-box;
  counter-reset: doc-section;
}

/* 标题卡片 */
#content_body > h1:first-child,
.markdown-body > h1:first-child {
  text-align: center !important;
  font-size: 2.2rem !important;
  font-weight: 700 !important;
  letter-spacing: -.02em;
  color: var(--doc-text) !important;
  padding: 40px 32px 10px !important;
  margin: 0 !important;
  border: 0 !important;
  background: #fff;
  border-radius: var(--doc-radius) var(--doc-radius) 0 0;
  box-shadow: var(--doc-card-shadow);
}
.markdown-body > h1:first-child + p {
  text-align: center;
  color: var(--doc-muted) !important;
  font-size: 1.05rem !important;
  margin: 0 0 28px !important;
  padding: 0 32px 36px !important;
  background: #fff;
  border-radius: 0 0 var(--doc-radius) var(--doc-radius);
  box-shadow: var(--doc-card-shadow);
}

/* 章节白卡片（JS 会包一层 .doc-section） */
.markdown-body .doc-section {
  background: #fff;
  border-radius: var(--doc-radius);
  padding: 36px 40px;
  margin-bottom: 28px;
  box-shadow: var(--doc-card-shadow);
}
.markdown-body {
  font-size: 15px !important;
  line-height: 1.75 !important;
  color: #1e293b !important;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: var(--doc-text) !important;
  font-weight: 700 !important;
  border-bottom: 0 !important;
}
.markdown-body h2,
.markdown-body .doc-section > h2 {
  font-size: 1.55rem !important;
  margin: 0 0 1.25rem !important;
  padding: 0 !important;
  border-top: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  counter-increment: doc-section;
}
.markdown-body h2::before,
.markdown-body .doc-section > h2::before {
  content: counter(doc-section);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #4585d2, #4280cb);
  color: #fff;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.markdown-body h3 {
  font-size: 1.1rem !important;
  margin: 1.25rem 0 .6rem !important;
}
.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin: .75rem 0 !important;
  color: #334155 !important;
}
.markdown-body a {
  color: var(--doc-accent) !important;
  text-decoration: none !important;
  font-weight: 500;
}
.markdown-body a:hover {
  text-decoration: underline !important;
}

/* 行内代码 */
.markdown-body code {
  color: #475569 !important;
  background: #e2e8f0 !important;
  border: 0;
  border-radius: 6px !important;
  padding: .2em .55em !important;
  font-size: .88em !important;
  font-family: Monaco, Menlo, ui-monospace, SFMono-Regular, Consolas, monospace !important;
  font-weight: 500;
}
.markdown-body code:before,
.markdown-body code:after {
  content: none !important;
}

/* 代码块：深色（对齐参考站） */
.markdown-body pre,
.syntaxhighlighter {
  background: var(--doc-code-bg) !important;
  border-radius: 8px !important;
  overflow: hidden;
  margin: 16px 0 20px !important;
  border: 0 !important;
  box-shadow: none !important;
}
.markdown-body pre code,
.syntaxhighlighter .line .content {
  color: var(--doc-code-fg) !important;
  background: transparent !important;
  border: 0 !important;
  font-size: .85rem !important;
  line-height: 1.6 !important;
}
.syntaxhighlighter .line .number {
  color: #94a3b8 !important;
}
.syntaxhighlighter table td.code .container {
  background: var(--doc-code-bg) !important;
}
.syntaxhighlighter table td.gutter .line {
  background: #0f172a !important;
  border-right: 1px solid #334155 !important;
}

/* 表格：蓝表头 */
.markdown-body table,
#article-content table,
.api_block table,
.table {
  width: 100%;
  margin: 16px 0 20px !important;
  border-collapse: collapse;
  display: table;
  font-size: 13.5px;
  overflow: hidden;
  border: 0 !important;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
  background: #fff;
}
.markdown-body table th,
.markdown-body table td,
.table > thead > tr > th,
.table > tbody > tr > td {
  border: 1px solid #e2e8f0 !important;
  padding: 14px 12px !important;
  text-align: left !important;
  vertical-align: top;
}
.markdown-body table th,
.table > thead > tr > th {
  background: linear-gradient(135deg, #4585d2, #4280cb) !important;
  color: #fff !important;
  font-weight: 600 !important;
  border-color: transparent !important;
}
.markdown-body table tr:hover td,
.table-hover > tbody > tr:hover > td {
  background: #f8fafc !important;
}

/* 提示块 */
.markdown-body .hint,
.doc-callout {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 14px 16px;
  color: #92400e;
  margin: 1rem 0;
}

/* 规则条（协议规则等） */
.markdown-body .rule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 20px;
}
.markdown-body .rule-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 8px;
  border-left: 4px solid var(--doc-accent);
  color: #334155;
  margin: 0 !important;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8 !important;
}
::-webkit-scrollbar-thumb:window-inactive {
  background: #94a3b8 !important;
}

@media (min-width: 769px) {
  #leftbar,
  #leftbar.layui-nav-side {
    left: 0 !important;
    display: block !important;
    visibility: visible !important;
    z-index: 900 !important;
  }
  #body {
    padding-left: var(--doc-sidebar-w) !important;
  }
}

@media (max-width: 768px) {
  :root {
    --doc-tabs-h: 52px;
  }
  #leftbar,
  #leftbar.layui-nav-side {
    left: -280px !important;
  }
  #leftbar.show-item,
  #leftbar.layui-nav-side.show-item {
    left: 0 !important;
  }
  #body {
    padding-left: 0 !important;
  }
  .doc-version-tabs .tab-btn {
    padding: 0 12px;
    font-size: .9rem;
    max-width: none;
  }
  #content_body {
    padding: 20px 12px 60px !important;
  }
  .markdown-body .doc-section {
    padding: 24px 18px;
  }
  #content_body > h1:first-child,
  .markdown-body > h1:first-child {
    font-size: 1.6rem !important;
    padding: 28px 18px 8px !important;
  }
}
