/* API 接口文档：左侧目录 + 右侧文章，配色与生成 API 页一致 */

html:has(.apidoc),
body.page-apidoc {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden;
    background: #f7f9fc !important;
}

body.page-apidoc,
body.page-apidoc .site-main {
    background: #f7f9fc !important;
    text-align: left;
}

body.page-apidoc .header,
body.page-apidoc .container {
    min-width: 0 !important;
    max-width: 100% !important;
}

.apidoc {
    padding: 28px 0 64px;
    color: #1d2129;
}

.apidoc-wrap {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.apidoc-side {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 104px);
    overflow: auto;
    background: #fff;
    border: 1px solid #e7eef8;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(22, 42, 76, 0.04);
}

.apidoc-group + .apidoc-group {
    border-top: 1px solid #eef2f8;
}

.apidoc-group__btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    background: transparent;
    color: #1d2129;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.apidoc-group__btn::after {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 1.5px solid #86909c;
    border-bottom: 1.5px solid #86909c;
    transform: rotate(45deg);
    margin-top: -3px;
}

.apidoc-group.is-open .apidoc-group__btn::after {
    transform: rotate(-135deg);
    margin-top: 3px;
}

.apidoc-group__list {
    display: none;
    margin: 0;
    padding: 0 8px 10px;
    list-style: none;
}

.apidoc-group.is-open .apidoc-group__list {
    display: block;
}

.apidoc-group__list a {
    display: block;
    padding: 8px 12px 8px 14px;
    border-radius: 6px;
    color: #4e5969;
    font-size: 13px;
    line-height: 1.5;
    text-decoration: none;
}

.apidoc-group__list a:hover {
    color: #2468F2;
    background: #f4f7fd;
    text-decoration: none;
}

.apidoc-group__list a.is-active {
    color: #2468F2;
    font-weight: 600;
    background: #eef4ff;
    box-shadow: inset 3px 0 0 #2468F2;
}

.apidoc-main {
    min-width: 0;
    background: #fff;
    border: 1px solid #e7eef8;
    border-radius: 12px;
    padding: 28px 36px 32px;
    box-shadow: 0 8px 24px rgba(22, 42, 76, 0.04);
}

.apidoc-crumb {
    margin: 0 0 18px;
    color: #86909c;
    font-size: 13px;
    line-height: 1.5;
}

.apidoc-crumb a {
    color: #86909c;
    text-decoration: none;
}

.apidoc-crumb a:hover {
    color: #2468F2;
}

.apidoc-crumb__sep {
    margin: 0 8px;
    color: #c9cdd4;
}

.apidoc-title {
    margin: 0 0 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef2f8;
    font-size: 28px;
    font-weight: 650;
    line-height: 1.3;
    color: #1d2129;
}

.apidoc-panel {
    display: none;
}

.apidoc-panel.is-active {
    display: block;
}

.apidoc-panel h2 {
    margin: 28px 0 12px;
    font-size: 18px;
    font-weight: 650;
    color: #1d2129;
}

.apidoc-panel h2:first-child {
    margin-top: 0;
}

.apidoc-panel p {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.75;
    color: #4e5969;
}

.apidoc-panel a {
    color: #2468F2;
}

.apidoc-table-wrap {
    margin: 8px 0 16px;
    overflow-x: auto;
    border: 1px solid #e6edf8;
    border-radius: 8px;
}

.apidoc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.apidoc-table th,
.apidoc-table td {
    padding: 12px 16px;
    border-top: 1px solid #eef2f8;
    text-align: left;
    vertical-align: top;
    line-height: 1.6;
}

.apidoc-table tr:first-child th,
.apidoc-table tr:first-child td {
    border-top: 0;
}

.apidoc-table th {
    background: #f5f8fc;
    color: #1d2129;
    font-weight: 600;
}

.apidoc-table td:first-child {
    color: #1d2129;
    white-space: nowrap;
}

.apidoc-table--params td:first-child,
.apidoc-table--code td:first-child {
    font-family: Consolas, "SF Mono", "Courier New", monospace;
    font-weight: 600;
    color: #2468F2;
    width: 18%;
}

.apidoc-table a[data-doc] {
    display: inline-block;
    margin: 2px 14px 2px 0;
    text-decoration: none;
}

.apidoc-table a[data-doc]:hover {
    text-decoration: underline;
}

.apidoc-endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    padding: 14px 16px;
    background: #f4f7fd;
    border: 1px solid #e1eaff;
    border-radius: 10px;
}

.apidoc-method {
    flex-shrink: 0;
    min-width: 52px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #2468F2;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
}

.apidoc-url {
    min-width: 0;
    color: #2468F2;
    font-size: 14px;
    font-weight: 600;
    word-break: break-all;
    background: transparent;
}

.apidoc-copy {
    flex-shrink: 0;
    height: 28px;
    margin-left: auto;
    padding: 0 12px;
    border: 1px solid #d4dce9;
    border-radius: 6px;
    background: #fff;
    color: #2468F2;
    font-size: 12px;
    cursor: pointer;
}

.apidoc-copy:hover {
    border-color: #2468F2;
    background: #e9f0fe;
}

.apidoc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.apidoc-chip {
    padding: 3px 10px;
    border: 1px solid #e1eaff;
    border-radius: 999px;
    background: #fff;
    color: #1d2129;
    font-size: 12px;
    line-height: 1.6;
}

.apidoc-chip em {
    font-style: normal;
    color: #86909c;
    margin-right: 4px;
}

.apidoc-req,
.apidoc-opt {
    display: inline-block;
    min-width: 40px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.apidoc-req {
    color: #2468F2;
    background: #e8f0fe;
}

.apidoc-opt {
    color: #86909c;
    background: #f2f3f5;
}

.apidoc-pre {
    margin: 8px 0 14px;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid #e6edf8;
    border-radius: 8px;
    background: #f8fafc;
    color: #1d2129;
    font-family: Consolas, "SF Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.apidoc-examples {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(180px, 0.7fr);
    gap: 14px;
    align-items: start;
}

.apidoc-ex-label {
    display: inline-block;
    margin-bottom: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e8f0fe;
    color: #2468F2;
    font-size: 12px;
    font-weight: 600;
}

.apidoc-note {
    margin-top: 8px;
    color: #86909c;
    font-size: 13px;
}

.apidoc-pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid #eef2f8;
}

.apidoc-pager a {
    color: #4e5969;
    font-size: 14px;
    text-decoration: none;
}

.apidoc-pager a:hover {
    color: #2468F2;
}

.apidoc-pager__next {
    margin-left: auto;
}

.apidoc code {
    padding: 0 4px;
    border-radius: 4px;
    background: #f4f7fd;
    color: #2468F2;
    font-size: 12px;
}

.apidoc-pre code {
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
}

@media (max-width: 991px) {
    .apidoc-wrap {
        grid-template-columns: 1fr;
        padding: 0 12px;
    }

    .apidoc-side {
        position: static;
        max-height: none;
    }

    .apidoc-main {
        padding: 20px 16px 24px;
    }

    .apidoc-title {
        font-size: 22px;
    }

    .apidoc-examples {
        grid-template-columns: 1fr;
    }

    .apidoc-endpoint {
        flex-wrap: wrap;
    }
}
