/* 文档页样式 —— 沿用首页 index.css 的深色色板，不引入新体系 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: #0f1117;
    color: #e2e8f0;
    min-height: 100vh;
}

/* 顶栏与首页保持一致 */
header {
    border-bottom: 1px solid #1e2433;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0d1018;
    position: sticky;
    top: 0;
    z-index: 20;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.logo-text { font-size: 18px; font-weight: 600; color: #f1f5f9; }

.header-links { display: flex; gap: 8px; flex-wrap: wrap; }
.header-link {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    color: #94a3b8;
    transition: all 0.2s;
}
.header-link:hover { color: #f1f5f9; background: #1e2433; }
.header-link.primary { background: #6366f1; color: white; }
.header-link.primary:hover { background: #4f46e5; }

/* 侧栏 + 正文 */
.layout {
    display: flex;
    align-items: flex-start;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 40px 80px;
    gap: 40px;
}

.sidebar {
    width: 232px;
    flex-shrink: 0;
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 128px);
    overflow-y: auto;
}
.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    margin-bottom: 12px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
}
.sidebar-nav a:hover { background: #1e2433; color: #f1f5f9; }
.sidebar-nav a.active { background: rgba(99,102,241,0.15); color: #a5b4fc; font-weight: 500; }

.sidebar-sub {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #1e2433;
}
.sidebar-sub a {
    display: block;
    padding: 5px 12px;
    font-size: 13px;
    color: #64748b;
    text-decoration: none;
    border-left: 2px solid transparent;
}
.sidebar-sub a:hover { color: #a5b4fc; border-left-color: #6366f1; }

.content { flex: 1; min-width: 0; max-width: 900px; }

/* 正文排版 */
.content h1 {
    font-size: 32px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.3;
    margin-bottom: 12px;
}
.content .lead {
    font-size: 16px;
    color: #94a3b8;
    line-height: 1.7;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid #1e2433;
}
.content h2 {
    font-size: 22px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 44px 0 16px;
    padding-top: 8px;
}
.content h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    margin: 28px 0 12px;
}
.content p { font-size: 15px; line-height: 1.8; color: #cbd5e1; margin-bottom: 14px; }
.content ul, .content ol { margin: 0 0 14px 22px; }
.content li { font-size: 15px; line-height: 1.8; color: #cbd5e1; margin-bottom: 6px; }
.content a { color: #a5b4fc; text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content strong { color: #f1f5f9; font-weight: 600; }
.content hr { border: none; border-top: 1px solid #1e2433; margin: 40px 0; }

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    background: #1a1f2e;
    border: 1px solid #252b3b;
    border-radius: 4px;
    padding: 1px 6px;
    color: #c4b5fd;
}

/* 代码块 */
.code-block {
    position: relative;
    margin: 0 0 18px;
    background: #0b0e14;
    border: 1px solid #1e2433;
    border-radius: 10px;
    overflow: hidden;
}
.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #101420;
    border-bottom: 1px solid #1e2433;
}
.code-lang {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
}
/* 整篇复制 / 下载按钮（由 docs.js 注入到顶栏） */
.doc-action {
    background: transparent;
    border: 1px solid #252b3b;
    font-family: inherit;
    cursor: pointer;
}
.doc-action:hover { background: #1e2433; color: #f1f5f9; }
.doc-action.done { border-color: #22c55e; color: #22c55e; }
.code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}
.code-block pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.7;
    color: #d6deeb;
    white-space: pre;
}

/* 表格 */
.table-wrap { overflow-x: auto; margin: 0 0 18px; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border: 1px solid #1e2433;
    border-radius: 10px;
    overflow: hidden;
}
th {
    background: #101420;
    color: #94a3b8;
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid #1e2433;
    white-space: nowrap;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid #191e29;
    color: #cbd5e1;
    vertical-align: top;
    line-height: 1.6;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #131720; }
td code { font-size: 12.5px; }
.req { color: #f87171; font-weight: 600; font-size: 12px; }
.opt { color: #475569; font-size: 12px; }

/* 提示框 */
.note {
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.75;
    border: 1px solid;
}
.note p { font-size: 14px; margin-bottom: 8px; }
.note p:last-child { margin-bottom: 0; }
.note-info    { background: rgba(59,130,246,0.08);  border-color: rgba(59,130,246,0.3);  color: #bfdbfe; }
.note-warn    { background: rgba(249,115,22,0.08);  border-color: rgba(249,115,22,0.3);  color: #fed7aa; }
.note-danger  { background: rgba(239,68,68,0.08);   border-color: rgba(239,68,68,0.3);   color: #fecaca; }
.note-ok      { background: rgba(34,197,94,0.08);   border-color: rgba(34,197,94,0.3);   color: #bbf7d0; }
.note strong { color:#fff; }

/* 卡片（文档中心用） */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.card {
    background: #131720;
    border: 1px solid #1e2433;
    border-radius: 12px;
    padding: 22px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.card:hover {
    border-color: #6366f1;
    background: #161b27;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99,102,241,0.1);
}
.card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}
.icon-purple { background: rgba(99,102,241,0.15); }
.icon-blue   { background: rgba(59,130,246,0.15); }
.icon-green  { background: rgba(34,197,94,0.15); }
.icon-orange { background: rgba(249,115,22,0.15); }
.icon-pink   { background: rgba(236,72,153,0.15); }
.icon-teal   { background: rgba(20,184,166,0.15); }
.card-body h3 { font-size: 15px; font-weight: 600; color: #f1f5f9; margin-bottom: 6px; }
.card-body p  { font-size: 13.5px; color: #64748b; line-height: 1.55; margin: 0; }

/* 状态徽标 */
.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    font-family: "SFMono-Regular", Consolas, monospace;
}
.pill-queued     { background: rgba(148,163,184,0.15); color: #cbd5e1; }
.pill-running    { background: rgba(59,130,246,0.15);  color: #93c5fd; }
.pill-succeeded  { background: rgba(34,197,94,0.15);   color: #86efac; }
.pill-failed     { background: rgba(239,68,68,0.15);   color: #fca5a5; }
.pill-expired    { background: rgba(249,115,22,0.15);  color: #fdba74; }
.pill-cancelled  { background: rgba(100,116,139,0.18); color: #94a3b8; }

/* 上/下页 */
.pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid #1e2433;
}
.pager a {
    flex: 1;
    padding: 14px 18px;
    background: #131720;
    border: 1px solid #1e2433;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
}
.pager a:hover { border-color: #6366f1; background: #161b27; }
.pager .pager-label { display: block; font-size: 12px; color: #475569; margin-bottom: 4px; }
.pager .pager-title { font-size: 14px; color: #e2e8f0; font-weight: 500; }
.pager .next { text-align: right; }

footer { text-align: center; padding: 32px; border-top: 1px solid #1e2433; color: #334155; font-size: 13px; }

/* 窄屏：侧栏折叠为顶部横向滚动条 */
@media (max-width: 900px) {
    header { padding: 16px 20px; }
    /* 关键：列向下必须 stretch，否则 .content 会按内容撑宽（宽表格/代码块）导致整页横向溢出 */
    .layout { flex-direction: column; align-items: stretch; padding: 20px 20px 60px; gap: 24px; }
    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
        overflow: visible;
        border-bottom: 1px solid #1e2433;
        padding-bottom: 4px;
    }
    .sidebar-nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 8px; }
    .sidebar-nav a { white-space: nowrap; }
    .sidebar-sub { display: none; }
    .content { width: 100%; max-width: 100%; }
    .content h1 { font-size: 26px; }
    .cards { grid-template-columns: 1fr; }
    .pager { flex-direction: column; }
    /* 顶栏在窄屏换行，避免链接挤出容器 */
    header { flex-wrap: wrap; gap: 12px; }
    .header-links { width: 100%; }
}
