/* ===== Doc.css — API 文档页独立样式表 ===== */

/* ===== CSS Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== CSS Variables ===== */
:root {
    --doc-sidebar-width: 240px;
    --doc-bg: #ffffff;
    --doc-bg-secondary: #f8f8f8;
    --doc-bg-sidebar: #fafafa;
    --doc-border: #e5e7eb;
    --doc-border-light: #f0f0f0;
    --doc-text: #111111;
    --doc-text-secondary: #555555;
    --doc-text-muted: #999999;
    --doc-accent: #1a1a1a;
    --doc-accent-hover: #000000;
    --doc-accent-light: rgba(0, 0, 0, 0.06);
    --doc-code-bg: #1e1e1e;
    --doc-code-header-bg: #2d2d2d;
    --doc-code-text: #d4d4d4;
    --doc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --doc-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --doc-radius: 8px;
}

/* ===== Base ===== */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--doc-text);
    background: var(--doc-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow:auto;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* ===== Doc Layout: sidebar + content ===== */
.doc-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.doc-sidebar {
    width: var(--doc-sidebar-width);
    min-width: var(--doc-sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    background: var(--doc-bg-sidebar);
    border-right: 1px solid var(--doc-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
}

.doc-sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--doc-border);
}

.doc-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--doc-text);
    text-decoration: none;
}

.doc-sidebar-logo img {
    height: 36px;
    width: auto;
}

/* Sidebar Nav */
.doc-sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.doc-nav-group {
    margin-bottom: 0.25rem;
}

.doc-nav-group-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--doc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.doc-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-nav-link {
    display: block;
    padding: 0.45rem 1.25rem 0.45rem 1.75rem;
    font-size: 0.85rem;
    color: var(--doc-text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.doc-nav-link:hover {
    color: var(--doc-text);
    background: rgba(0, 0, 0, 0.04);
    border-left-color: #d0d0d0;
}

.doc-nav-link.current,
.doc-nav-link.active {
    color: var(--doc-accent);
    background: var(--doc-accent-light);
    border-left-color: var(--doc-accent);
    font-weight: 600;
}

/* Sidebar Footer */
.doc-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--doc-border);
}

.doc-back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--doc-text-secondary);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.doc-back-link:hover {
    color: var(--doc-text);
    background: rgba(0, 0, 0, 0.05);
}

.doc-back-link i {
    font-size: 1rem;
}

/* ===== Content ===== */
.doc-content {
    flex: 1;
    min-width: 0;
    padding: 2.5rem 3rem 5rem;
    max-width: 960px;
}

.doc-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--doc-text);
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--doc-border);
}

.doc-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--doc-text);
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--doc-border);
}

.doc-content h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--doc-text);
    margin: 2rem 0 0.75rem;
}

.doc-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--doc-text);
    margin: 1.5rem 0 0.5rem;
}

.doc-content p {
    color: var(--doc-text-secondary);
    line-height: 1.75;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.doc-content a {
    color: var(--doc-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.doc-content a:hover {
    color: var(--doc-accent-hover);
}

.doc-content section {
    scroll-margin-top: 1rem;
}

/* ===== Endpoint Badge ===== */
.doc-endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1rem 0 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--doc-bg-secondary);
    border: 1px solid var(--doc-border);
    border-radius: var(--doc-radius);
    font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 0.9rem;
}

.doc-method {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.doc-method-post { background: #2563eb; }
.doc-method-get  { background: #16a34a; }

.doc-endpoint-url {
    color: var(--doc-text);
    word-break: break-all;
}

/* ===== Tables ===== */
.doc-table-wrap {
    overflow-x: auto;
    margin: 1rem 0 1.5rem;
    border: 1px solid var(--doc-border);
    border-radius: var(--doc-radius);
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.doc-table thead {
    background: var(--doc-bg-secondary);
    border-bottom: 2px solid var(--doc-border);
}

.doc-table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--doc-text);
    font-size: 0.82rem;
    white-space: nowrap;
}

.doc-table td {
    padding: 0.65rem 1rem;
    color: var(--doc-text-secondary);
    border-bottom: 1px solid var(--doc-border-light);
    vertical-align: top;
    line-height: 1.55;
}

.doc-table tr:last-child td {
    border-bottom: none;
}

.doc-table code {
    font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    background: #f0f0f0;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    color: #333;
}

.field-required {
    color: #ef4444;
    font-weight: 600;
}

.field-optional {
    color: var(--doc-text-muted);
}

/* ===== Code Blocks (dark theme) ===== */
.doc-code-block {
    background: var(--doc-code-bg);
    border-radius: var(--doc-radius);
    margin: 1rem 0 1.5rem;
    overflow: hidden;
}

.doc-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--doc-code-header-bg);
    border-bottom: 1px solid #3e3e3e;
}

.doc-code-lang {
    font-size: 0.75rem;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.doc-code-block pre {
    margin: 0;
    padding: 1.25rem;
    overflow-x: auto;
}

.doc-code-block code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--doc-code-text);
    background: none;
    padding: 0;
}

/* ===== Callout Boxes ===== */
.doc-callout {
    padding: 0.9rem 1.1rem;
    border-radius: var(--doc-radius);
    margin: 1rem 0 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.doc-callout strong {
    color: inherit;
}

.doc-callout code {
    font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.doc-callout-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.doc-callout-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.doc-callout-tip {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* ===== Overview Cards ===== */
.doc-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.doc-overview-card {
    padding: 1.25rem;
    background: var(--doc-bg);
    border: 1px solid var(--doc-border);
    border-radius: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    display: block;
}

.doc-overview-card:hover {
    border-color: var(--doc-accent);
    box-shadow: var(--doc-shadow-md);
}

.doc-overview-card-icon {
    font-size: 1.5rem;
    color: var(--doc-accent);
    margin-bottom: 0.75rem;
}

.doc-overview-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--doc-text);
    margin: 0 0 0.35rem;
    border: none;
    padding: 0;
}

.doc-overview-card p {
    font-size: 0.85rem;
    color: var(--doc-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ===== Inline Code ===== */
.doc-content > p code,
.doc-content > ul code {
    font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    background: #f0f0f0;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    color: #333;
}

/* ===== Scrollbar ===== */
.doc-sidebar::-webkit-scrollbar { width: 4px; }
.doc-sidebar::-webkit-scrollbar-track { background: transparent; }
.doc-sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.doc-sidebar::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== Selection ===== */
::selection {
    background: rgba(0, 0, 0, 0.1);
    color: var(--doc-text);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .doc-sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .doc-sidebar.open {
        transform: translateX(0);
    }

    .doc-content {
        padding: 1.5rem 1rem 3rem;
        max-width: 100%;
    }

    .doc-content h1 { font-size: 1.5rem; }
    .doc-content h2 { font-size: 1.25rem; }
    .doc-content h3 { font-size: 1.05rem; }

    .doc-endpoint {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .doc-table { font-size: 0.8rem; }

    .doc-overview-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Print Styles ===== */
@media print {
    .doc-sidebar { display: none; }
    .doc-content { max-width: 100%; padding: 0; }
}
