/* ===================== XAPI · 接口文档页样式 ===================== */

/* ---------- 文档头部 ---------- */
.doc-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #fff;
    padding: 40px 0 48px;
}

.doc-hero .container {
    max-width: 1200px;
}

.doc-crumb {
    font-size: 13px;
    color: rgba(255, 255, 255, .68);
    margin-bottom: 16px;
}

.doc-crumb a:hover {
    color: #fff;
}

.doc-crumb span {
    margin: 0 6px;
}

.doc-crumb .current {
    color: #fff;
    margin: 0;
}

.doc-hero h1 {
    font-size: 30px;
    line-height: 1.35;
    font-weight: 700;
    margin-bottom: 14px;
}

.doc-hero code {
    background: rgba(255, 255, 255, .14);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: .9em;
}

.doc-lead {
    font-size: 15px;
    color: rgba(255, 255, 255, .85);
    max-width: 820px;
}

.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 10px;
}

.doc-tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #e5edff;
}

.doc-tag.free {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
    font-weight: 600;
}

.doc-charge {
    font-size: 14px;
    color: #ffd479;
    font-weight: 600;
    margin: 0 0 6px;
}

.doc-updated {
    font-size: 13px;
    color: rgba(255, 255, 255, .6);
}

/* ---------- 布局 ---------- */
.doc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 28px;
    align-items: start;
    padding-top: 32px;
    padding-bottom: 48px;
}

.doc-main {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 36px 40px;
    min-width: 0;
}

.doc-main section {
    scroll-margin-top: 80px;
    margin-bottom: 38px;
}

.doc-main h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    margin-bottom: 16px;
}

.doc-main h3 {
    font-size: 16px;
    margin: 20px 0 10px;
}

.doc-main p {
    margin-bottom: 12px;
    color: var(--text);
}

.doc-main code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 13px;
    font-family: "JetBrains Mono", Consolas, Menlo, monospace;
}

.sub-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin: 18px 0 8px;
}

/* ---------- 事实摘要盒（GEO：便于直接引用） ---------- */
.fact-box {
    background: var(--primary-light);
    border: 1px solid #dbeafe;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 18px;
}

.fact-title {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px !important;
}

.fact-box p:last-child {
    margin-bottom: 0;
}

/* ---------- 表格 ---------- */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.doc-table caption {
    caption-side: top;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    padding-bottom: 6px;
}

.doc-table th,
.doc-table td {
    border: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.doc-table thead th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
}

.doc-table tbody th {
    background: #f8fafc;
    width: 130px;
    white-space: nowrap;
    font-weight: 600;
}

/* ---------- 代码块 ---------- */
.code-block {
    background: #0f172a;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(255, 255, 255, .06);
    color: #94a3b8;
    font-size: 12px;
}

.copy-btn {
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #cbd5e1;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.code-block pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
    font-size: 13px;
    line-height: 1.7;
    font-family: "JetBrains Mono", Consolas, Menlo, monospace;
}

/* ---------- FAQ ---------- */
.faq-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: #fff;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--dark);
    list-style: none;
    position: relative;
    padding-right: 22px;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 0;
    color: var(--primary);
    font-weight: 700;
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-item p {
    margin: 10px 0 2px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------- 相关资源 ---------- */
.related-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}

.related-list li:last-child {
    border-bottom: none;
}

.related-list a {
    color: var(--primary);
    font-weight: 600;
}

.related-list a:hover {
    text-decoration: underline;
}

/* ---------- 右侧目录 ---------- */
.doc-toc {
    position: sticky;
    top: 84px;
}

.toc-inner {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 16px;
}

.toc-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 10px;
}

.toc-inner ul li a {
    display: block;
    padding: 6px 8px;
    font-size: 13px;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    border-radius: 4px;
}

.toc-inner ul li a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.toc-inner ul li a.active {
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
    background: var(--primary-light);
}

.toc-cta {
    display: block;
    margin-top: 14px;
    text-align: center;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 0;
    border-radius: 8px;
}

.toc-cta:hover {
    background: var(--primary-dark);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .doc-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-toc {
        display: none;
    }
}

@media (max-width: 640px) {
    .doc-hero h1 {
        font-size: 23px;
    }

    .doc-main {
        padding: 22px 18px 28px;
    }

    .doc-table tbody th {
        width: 100px;
    }
}
