/* api.css - 视觉增强版 (已移除进度填充效果，保留百分比数字) */

:root {
    /* --- 核心色板 (Google Material Design Green) --- */
    --c-p: #2e7d32;           /* 主色 - 森林绿 */
    --c-p-dark: #1b5e20;      /* 深绿 - 悬停态 */
    --c-p-light: #e8f5e9;     /* 浅绿 - 背景/高亮 */
    --c-p-fade: rgba(46, 125, 50, 0.08); /* 透明主色 */
    
    /* --- 界面色板 --- */
    --c-bg: #86add3;          /* 全局背景 - 极淡灰 */
    --c-sur: #edf5e7;         /* 表面 - 纯白 */
    --c-txt: #1a202c;         /* 正文 - 深灰黑 */
    --c-txt-sec: #4a5568;     /* 次级文字 - 蓝灰 */
    --c-bor: #e2e8f0;         /* 边框 - 淡银 */
    
    /* --- 代码块 --- */
    --c-code-bg: #282c34;     /* 代码背景 */
    --c-code-header: #21252b; /* 代码头背景 */
    
    /* --- 渐变彩色 --- */
    --gradient-blue: rgba(56, 189, 248, 0.1);
    --gradient-purple: rgba(139, 92, 246, 0.1);
    --gradient-pink: rgba(236, 72, 153, 0.05);
    
    /* --- 尺寸与阴影 (提升立体感) --- */
    --radius: 10px;
    --radius-sm: 6px;
    --nav-height: 64px;
    
    /* 柔和的多层阴影 */
    --shadow-card: 0 1px 3px rgba(0,0,0,0.05), 0 5px 15px rgba(0,0,0,0.02);
    --shadow-float: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-nav: 0 4px 20px rgba(0,0,0,0.03);
    --shadow-code: 0 4px 20px rgba(0, 0, 0, 0.3);
    
    /* 字体栈 */
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== 全局重置与基础排版 ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 24px); /* 锚点定位偏移 */
}

body {
    font-family: var(--font-stack);
    background: var(--c-bg);
    color: var(--c-txt);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--c-bor); }
::-webkit-scrollbar-thumb { background: var(--c-txt-sec); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-txt); }

a {
    color: var(--c-p);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}
a:hover { color: var(--c-p-dark); }

/* ===== 1. 导航栏 (玻璃拟态 + 动效) ===== */
.api-navbar {
    position: fixed;
    top: 0; left: 0; width: 100%; height: var(--nav-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: var(--shadow-nav);
    z-index: 1000;
}

.api-nav-container {
    width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px;
    height: 100%;
    display: flex; justify-content: space-between; align-items: center;
}
.api-logo img {
    width: 40px; /* 响应式宽度 */
    height: auto;
    object-fit: contain; /* 保持比例 */
    align-self: bottom; /* 额外的垂直居中 */
}
.api-logo a {
    font-size: 1.25rem;
    font-weight: 700;
     background: linear-gradient(135deg, #2980b9 0%, #f1c40f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #2980b9;
    display: flex; align-items: center; gap: 10px;
    letter-spacing: -0.5px;
}
.api-logo i { color: var(--c-p); font-size: 1.2em; }

.api-nav-links {
    display: flex; gap: 32px; list-style: none;
}

.api-nav-links a {
    color: var(--c-txt-sec);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    padding: 8px 0;
}

/* 导航下划线动画 */
.api-nav-links a::after {
    content: '';
    position: absolute; bottom: 0; left: 0; width: 0; height: 2px;
    background: var(--c-p);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}
.api-nav-links a:hover::after, .api-nav-links a.active::after { width: 100%; }
.api-nav-links a:hover, .api-nav-links a.active { color: var(--c-p); }

.api-mobile-menu-btn {
    display: none; background: transparent; border: none;
    font-size: 1.4rem; color: var(--c-txt); cursor: pointer;
    padding: 8px; border-radius: 4px;
    transition: background 0.2s;
}
.api-mobile-menu-btn:hover { background: rgba(0,0,0,0.05); }

/* ===== 2. 核心布局 ===== */
.api-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 32px) 24px 60px;
}

.api-layout-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
    position: relative;
}

/* 面包屑 */
.api-breadcrumb-card { margin-bottom: 24px; }
.api-breadcrumb { font-size: 0.9rem; color: var(--c-txt-sec); display: flex; align-items: center; gap: 8px; }
.api-breadcrumb i.fa-chevron-right { font-size: 0.7em; opacity: 0.4; }
.api-breadcrumb span[aria-current="page"] { color: var(--c-txt); font-weight: 500; }

/* 头部卡片 */
.api-header-card {
    background: var(--c-sur);
    border: 1px solid var(--c-bor);
    border-radius: var(--radius);
    padding: clamp(25px, 3vw, 40px);
    margin-bottom: clamp(25px, 2.5vw, 40px);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.api-header-card h1 {
font-size: clamp(2.82rem, 1.1vw, 3.5rem);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    padding: 6px 12px;
    margin-bottom: clamp(12px, 1vw, 16px);
    /* 渐变文字 */
    background: linear-gradient(135deg, #2980b9 0%, #f1c40f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #2980b9;
}
.api-header-card h1 i { color: var(--c-p); font-size: 0.8em; opacity: 0.9; }
.api-header-card .subtitle { 
     font-size: clamp(0.82rem, 1.1vw, 1.1rem);
    color: #2980b9;
    max-width: 700px;
    margin-bottom: clamp(16px, 1.5vw, 24px);
    font-weight: 500;
    /* 渐变下划线 */
    text-decoration: underline;
    text-decoration-color: rgba(41, 128, 185, 0.3);
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
    transition: text-decoration-color 0.3s ease;
 }
.api-meta { 
    display: inline-flex; align-items: center; gap: 12px;
    padding: 6px 6px; background: rgba(255, 47, 47, 0.15); border-radius: 20px;
    font-weight: 800;
    font-size: 0.95rem; color: #2c3541 ; border: 1px solid transparent;
}

/* ===== 3. 侧边栏目录 (Sticky - 多级结构) ===== */
.api-toc-desktop {
    position: sticky;
    top: calc(var(--nav-height) + 32px);
    background: var(--c-sur);
    border-radius: var(--radius);
    border: 1px solid var(--c-bor);
    box-shadow: var(--shadow-card);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.api-toc-header {
    padding: 10px 20px 16px;
    border-bottom: 1px solid var(--c-bor);
    flex-shrink: 0;
}

.api-toc-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-p);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

/* 阅读进度摘要 */
.api-reading-progress-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.api-reading-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--c-bor);
    border-radius: 3px;
    overflow: hidden;
}

.api-reading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--c-p), #66bb6a);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.api-reading-percent {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-p);
    min-width: 40px;
    text-align: right;
}

.api-toc-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.api-toc-nav {
    padding: 10px 0;
}

.api-toc-list {
    list-style: none;
}

.api-toc-item {
    display: flex;
    align-items: center;
    padding: 5px 20px;
    color: var(--c-txt-sec);
    font-size: 0.9rem;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}


.api-toc-item > * {
    position: relative;
    z-index: 1;
}

.api-toc-item i { 
    width: 16px;
    text-align: center;
    font-size: 0.85em;
    opacity: 0.7;
    transition: all 0.2s;
    margin-right: 10px;
    flex-shrink: 0;
}

.api-toc-item .item-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-progress-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-p);
    background: rgba(46, 125, 50, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 38px;
    text-align: center;
    margin-left: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.api-toc-item.active .api-progress-percent {
    background: var(--c-p);
    color: white;
}

.api-toc-item:hover {
    background: var(--c-bg);
    color: var(--c-p);
}

.api-toc-item:hover i {
    color: var(--c-p);
    opacity: 1;
}

/* 一级目录项 */
.api-toc-item.level-1 {
    font-weight: 600;
    color: var(--c-txt);
}

/* 二级目录项 */
.api-toc-item.level-2 {
    padding-left: 55px;
    font-size: 0.85rem;
}

/* 三级目录项 */
.api-toc-item.level-3 {
    padding-left: 80px;
    font-size: 0.8rem;
    color: #718096;
}

/* 目录激活态 */
.api-toc-item.active {
    color: var(--c-p-dark);
    font-weight: 600;
}
.api-toc-item.active i {
    color: var(--c-p);
    opacity: 1;
}

/* 目录折叠/展开控制 */
.api-toc-toggle {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.6;
    transition: transform 0.3s ease;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.api-toc-toggle.collapsed {
    transform: rotate(0deg);
}

.api-toc-toggle:not(.collapsed) {
    transform: rotate(90deg);
}

/* 子目录容器 */
.api-toc-sublist {
    list-style: none;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* ===== 4. 内容区域 ===== */
.api-main-content {
    background: var(--c-sur);
    border-radius: var(--radius);
    border: 1px solid var(--c-bor);
    padding: 48px;
    box-shadow: var(--shadow-card);
    min-width: 0; /* 防止Grid溢出 */
}

/* 章节样式 */
.api-section { margin-bottom: 60px; }
.api-section h2 {
    color:  #1b3d6f;
    margin: 0 0 clamp(20px, 2vw, 25px) 0;
    font-size: clamp(1.4rem, 1.8vw, 1.55rem);
    padding-bottom: clamp(12px, 1vw, 16px);
    border-bottom: 1px solid var(--c-bor);
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    font-weight: 600;
}
.api-section h2 i { 
    color:  #1b3d6f;
    font-size: 0.8em;
    opacity: 0.9;
}

.api-section h2 strong {
    font-weight: 800;
    color: #346cc2;
    background-color: rgba(52, 152, 219, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}
.api-section p strong {
    font-weight: 600;
    color: #346cc2;
    background-color: rgba(52, 152, 219, 0.2);
    padding: 2px 2px;
    border-radius: 4px;
}
.api-section h3 {
    color: var(--c-txt);
    margin: clamp(20px, 2vw, 30px) 0 clamp(15px, 1.2vw, 18px) 0;
    font-size: clamp(1.1rem, 1.3vw, 1.25rem);
    display: flex;
    align-items: center;
    gap: clamp(8px, 0.8vw, 10px);
    font-weight: 600;
    position: relative;
    padding-left: clamp(12px, 1vw, 16px);
}

.intro-section h3 strong {
    font-weight: 800;
    color: #2a7e3b;
    padding: 2px 2px;
}
.api-section h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: clamp(4px, 0.5vw, 6px);
    bottom: clamp(4px, 0.5vw, 6px);
    width: 4px;
    background: var(--c-p);
    border-radius: 2px;
}

.api-section p { 
    margin-bottom: clamp(2px, 1.2vw, 4px);
    color: var(--c-txt-sec);
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.8;
    font-weight: 400;
 }

/* ===== API表格样式 ===== */
.api-table-wrapper {
    width: 100%;
    margin: 24px 0;
    overflow-x: auto;
    border: 1px solid var(--c-bor);
    border-radius: 4px;
    background: #ffffff;
    box-shadow: var(--shadow-card);
}

.api-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
}

.api-table th {
    background: var(--c-accent);
    color: var(--c-txt);
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--c-bor);
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    letter-spacing: 0.02em;
}

.api-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-bor);
    color: var(--c-txt-sec);
    vertical-align: top;
    line-height: 1.5;
}

/* 移除列间分隔线，更简约 */
.api-table th:not(:last-child),
.api-table td:not(:last-child) {
    border-right: none;
}

/* 斑马纹效果 */
.api-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* 悬停效果 */
.api-table tbody tr:hover {
    background: var(--c-p-light);
}

/* 最后一行无底边框 */
.api-table tbody tr:last-child td {
    border-bottom: none;
}

/* 表格内的代码片段样式 */
.func {
    color: var(--c-p);
    font-weight: 600;
    font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    background: var(--c-p-fade);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(46, 125, 50, 0.1);
}

.type {
    color: #0288d1;
    font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    font-weight: 500;
}

.param {
    color: #e65100;
    font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    font-style: italic;
    background: rgba(230, 81, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}
/* ===== 6. 代码块 (渐变彩色风格) ===== */
.api-code-block-wrapper {
    border-radius: var(--radius);
    overflow: hidden;
    margin: clamp(18px, 1.5vw, 24px) 0;
    box-shadow: var(--shadow-code);
    background: #282c34;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}
.api-code-block {
    background: transparent !important;
    margin: 0 !important;
    border-radius: 0 !important;
    font-size: clamp(0.85rem, 0.9vw, 0.95rem) !important;
    line-height: 1.6 !important;
    font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', monospace !important;
    display: block;
    overflow-x: auto;
    width: 100%;
    padding: 0;
}
.api-code-block::-webkit-scrollbar {
    height: 8px;
}
.api-code-block::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}
.api-code-block::-webkit-scrollbar-track {
    background: #282c34;
}
.api-code-header {
    background: #21252b;
    color: #e0e0e0;
    padding: clamp(10px, 1vw, 12px) clamp(15px, 1.5vw, 20px);
    font-size: clamp(0.85rem, 0.9vw, 0.9rem);
    font-weight: 500;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

/* 模拟红黄绿按钮 */
.api-code-header-left {
    display: flex;
    align-items: center;
    gap: clamp(6px, 0.5vw, 8px);
    position: relative;
    padding-left: clamp(45px, 3.5vw, 54px);
}
.api-code-header-left::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(8px, 0.8vw, 10px);
    height: clamp(8px, 0.8vw, 10px);
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 18px 0 0 #ffbd2e, 36px 0 0 #27c93f;
}
.api-code-header-left i { display: none; }
.api-code-header-left span { 
    padding: 0 clamp(12px, 1vw, 16px); 
    color: #46cdc6; 
    font-size: clamp(0.9rem, 1vw, 1rem); 
    font-weight: bold; 
    font-family: 'Fira Code', monospace; 
 }

/* 渐变彩色复制按钮 */
.api-copy-btn {
    background: linear-gradient(135deg, var(--gradient-blue), var(--gradient-purple));
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border-radius: 4px;
    padding: clamp(5px, 0.5vw, 6px) clamp(10px, 1vw, 12px);
    cursor: pointer;
    font-size: clamp(0.8rem, 0.85vw, 0.85rem);
    font-weight: 500;
    transition: all 0.2s ease-out;
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.4vw, 6px);
    position: relative;
    overflow: hidden;
}

.api-copy-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #38bdf8, #8b5cf6, transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.api-copy-btn:hover {
    background: linear-gradient(135deg, 
        rgba(56, 189, 248, 0.15), 
        rgba(139, 92, 246, 0.15)
    );
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
    transform: translateY(-1px);
}

.api-copy-btn:hover::before {
    opacity: 1;
}

.api-copy-btn:active {
    transform: translateY(0);
}
.api-copy-btn.copied {
    background: #4caf50;
    border-color: #4caf50;
    color: white;
}
.api-copy-btn.copied i::before {
    content: "\f00c";
}
/* 代码区域 */
.api-code-block-wrapper pre.hljs {
    background: transparent !important;
    padding: 0px !important;
    border-radius: 0 !important;
    overflow-x: auto !important;
    white-space: pre !important;
    word-wrap: normal !important;
    font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', monospace !important;
    text-shadow: none !important;
    font-size: clamp(0.85rem, 0.9vw, 0.95rem) !important;
    line-height: 1.6 !important;
    display: block !important;
}

/* 代码高亮区域 */
.hljs {
    box-shadow: none !important;
    padding: 0 !important;
    border: none !important;
}

/* 行号和代码块的样式调整 */
.hljs-ln-line {
    line-height: 1.6 !important;
}

.hljs-ln-numbers {
     -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    text-align: right;
    color: #97b148;
    border-right: 2px solid rgba(136, 141, 151, 0.2);
    padding: 0 clamp(8px, 1vw, 12px) 0 clamp(6px, 0.7vw, 8px) !important;
    vertical-align: top;
    background-color: rgba(74, 81, 94, 0.2) !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
}

.hljs-ln-code {
     padding-left: clamp(8px, 0.8vw, 10px) !important;
    padding-top: 3px !important;
    padding-bottom: 5px !important;
}

/* ===== 7. 提示框 (Alerts) ===== */
.api-tip {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 20px;
    margin: 24px 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: #1e3a8a;
}
.api-tip h4 { color: #2563eb; margin-bottom: 8px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }

/* 颜色图例 */
.api-color-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.api-color-item {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.8rem; background: #fff;
    padding: 6px 12px; border-radius: 20px;
    border: 1px solid #dbeafe; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.api-color-sample { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,0.1); }

/* ===== 8. 响应式适配 (Mobile) ===== */
@media (max-width: 900px) {
    .api-nav-links { display: none; }
    .api-mobile-menu-btn { display: block; }
    .api-container { padding: calc(var(--nav-height) + 20px) 16px 40px; }
    
    .api-layout-container { display: block; }
    .api-toc-desktop { display: none; }
    
    .api-header-card, .api-main-content {
        padding: 24px 20px;
        margin-bottom: 24px;
        border-radius: var(--radius-sm);
    }
    
    .api-section h2 { font-size: 1.5rem; flex-wrap: wrap; }
    .api-code-header-left { padding-left: 48px; }
    
    /* 移动端表格横向滚动提示 */
    .api-table-wrapper {
        box-shadow: inset -10px 0 10px -10px rgba(0,0,0,0.1);
    }
}

/* ===== 移动端目录样式重写 ===== */
.api-toc-mobile-btn {
    display: none;
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: var(--c-p);
    color: white;
    border-radius: 0 6px 6px 0;
    z-index: 900;
    box-shadow: 2px 0 8px rgba(0,0,0,0.2);
    border: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.api-toc-mobile-btn:hover {
    background: var(--c-p-dark);
    width: 45px;
}

@media (max-width: 900px) { 
    .api-toc-mobile-btn { 
        display: flex; 
    } 
}

.api-toc-mobile-sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    height: 100%;
    width: 280px;
    background: var(--c-sur);
    z-index: 1100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.api-toc-mobile-sidebar.active {
    left: 0;
}

.api-toc-mobile-header {
    padding: 20px;
    background: var(--c-p);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.api-toc-mobile-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-toc-mobile-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.api-toc-mobile-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.api-toc-mobile-content {
    overflow-y: auto;
    flex: 1;
    padding: 10px 0;
}

.api-toc-mobile-list {
    list-style: none;
}

.api-toc-mobile-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--c-txt);
    transition: background 0.2s;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

/* 删除了这里的背景填充效果 */

.api-toc-mobile-item > * {
    position: relative;
    z-index: 1;
}

.api-toc-mobile-item .item-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 多级目录缩进 */
.api-toc-mobile-item.level-1 {
    font-weight: 600;
}

.api-toc-mobile-item.level-2 {
    padding-left: 35px;
    font-size: 0.9rem;
}

.api-toc-mobile-item.level-3 {
    padding-left: 50px;
    font-size: 0.85rem;
    color: #718096;
}

.api-toc-mobile-item i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
    font-size: 0.9em;
    opacity: 0.8;
    flex-shrink: 0;
}

.api-toc-mobile-item .api-progress-percent {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--c-p);
    background: rgba(46, 125, 50, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 36px;
    text-align: center;
    margin-left: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.api-toc-mobile-item.active {
    color: var(--c-p-dark);
    font-weight: 600;
}

.api-toc-mobile-item.active i {
    color: var(--c-p);
    opacity: 1;
}

.api-toc-mobile-item.active .api-progress-percent {
    background: var(--c-p);
    color: white;
}

.api-toc-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1050;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
}

.api-toc-mobile-overlay.active {
    display: block;
}

/* 移动端顶部导航展开 */
.api-nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    width: 100%;
    background: var(--c-sur);
    padding: 10px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--c-bor);
}
.api-nav-links.active a {
    padding: 12px 24px;
    border-bottom: 1px solid #f1f5f9;
}
.api-nav-links.active a::after {
    display: none;
}

/* ===== 返回顶部按钮 ===== */
.api-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: var(--c-p);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-float);
    z-index: 900;
}
.api-back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.api-back-to-top:hover {
    background: var(--c-p-dark);
    transform: translateY(-4px);
}

/* ===== 页脚 ===== */
.api-footer {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-txt-sec);
    border-top: 1px solid var(--c-bor);
    margin-top: 80px;
    background: white;
}
.api-footer-links {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}
.api-footer-links a {
    color: var(--c-txt-sec);
    font-size: 0.9rem;
}
.api-footer-links a:hover {
    color: var(--c-p);
}
.api-footer-meta {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* 页面加载进度条 */
.api-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c-p), #66bb6a);
    z-index: 9999;
    transition: width 0.3s ease, opacity 0.3s ease;
    width: 0;
}

/* ===== 新增：隐藏子目录的进度百分比 ===== */
.api-toc-item.level-2 .api-progress-percent,
.api-toc-mobile-item.level-2 .api-progress-percent {
    display: none !important;
}

/* 保持主目录的进度显示 */
.api-toc-item.level-1 .api-progress-percent,
.api-toc-mobile-item.level-1 .api-progress-percent {
    display: inline-block;
}