/* 全局重置和变量 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4285f4;
    --primary-dark: #1a73e8;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --sidebar-bg: #f8f9fa;
    --content-bg: #ffffff;
    --border-color: #e8eaed;
    --hover-bg: #f1f3f4;
    --active-bg: #e8f0fe;
    --active-text: #1a73e8;
}

html,
body {
    height: 100%;
    font-family: 'Roboto', 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* 主容器 - 使用固定定位实现左右分栏 */
.docs-container {
    display: flex;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 64px;
    /* 为顶部header留空间 */
}

/* 左侧导航栏 */
.docs-sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

/* 导航栏内容 */
.docs-nav {
    padding: 8px 0;
}

.nav-section {
    margin-bottom: 0;
}

.nav-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    padding: 8px 16px;
    margin-bottom: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.nav-title:hover {
    background-color: var(--hover-bg);
}

.nav-title::after {
    content: '▼';
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.nav-title.collapsed::after {
    transform: rotate(-90deg);
}

.nav-section ul {
    list-style: none;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-section.collapsed ul {
    max-height: 0;
}

.nav-section li {
    margin: 0;
}

.nav-section a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 16px 6px 32px;
    font-size: 13px;
    line-height: 18px;
    transition: all 0.2s ease;
    border-radius: 0;
    position: relative;
}

.nav-section a:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.nav-section a.active {
    background-color: var(--active-bg);
    color: var(--active-text);
    font-weight: 500;
}

.nav-section a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--active-text);
}

/* 主内容区域 */
.docs-content {
    flex: 1;
    background-color: var(--content-bg);
    overflow-y: auto;
    padding: 24px 48px;
    position: relative;
}

/* 内容样式 */
.content-section {
    max-width: 1000px;
    margin-bottom: 48px;
}

.section-title {
    font-size: 28px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.3;
}

.content-block {
    margin-bottom: 32px;
}

.content-block h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.content-block h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
    line-height: 1.4;
}

.content-block p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 14px;
}

.content-block ul {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 16px 20px;
    font-size: 14px;
}

.content-block li {
    margin-bottom: 4px;
}

.content-block a {
    color: var(--primary-color);
    text-decoration: none;
}

.content-block a:hover {
    text-decoration: underline;
}

/* 功能卡片 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.feature-card {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s ease;
}

.feature-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.feature-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* 步骤列表 */
.step-list {
    margin: 24px 0;
}

.step-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    margin-right: 16px;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.step-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* 代码块样式 */
.code-block {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 16px 0;
    overflow: hidden;
}

.code-header {
    background: #e8eaed;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.copy-btn:hover {
    background: var(--primary-dark);
}

.code-block pre {
    padding: 16px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
}

/* 选项卡 */
.code-tabs {
    margin: 16px 0;
}

.tab-buttons {
    display: flex;
    gap: 2px;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

.tab-btn {
    background: #f1f3f4;
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 8px 16px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 500;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* FAQ样式 */
.faq-list {
    margin: 24px 0;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.faq-question {
    background: #f8f9fa;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.faq-question:hover {
    background: #f1f3f4;
}

.faq-question h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    color: var(--text-primary);
}

.faq-toggle {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.faq-question.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: white;
}

.faq-answer.active {
    max-height: 300px;
    padding: 16px 20px;
}

.faq-answer p,
.faq-answer ul {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* 联系卡片 */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.contact-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: box-shadow 0.2s ease;
}

.contact-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.contact-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.contact-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0;
}

/* 场景网格 */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.scenario-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid var(--primary-color);
}

.scenario-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.scenario-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* API端点样式 */
.endpoint-list {
    margin: 24px 0;
}

.endpoint-item {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.method {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.method.post {
    background: #34a853;
    color: white;
}

.method.get {
    background: var(--primary-color);
    color: white;
}

.url {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* 错误代码 */
.error-codes {
    margin: 24px 0;
}

.error-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.error-item .code {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.error-item .description {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .docs-container {
        flex-direction: column;
        position: static;
        height: auto;
        padding-top: 0;
    }

    .docs-sidebar {
        width: 100%;
        height: auto;
        order: 1;
    }

    .docs-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        gap: 24px;
    }

    .nav-section {
        min-width: 150px;
        margin-bottom: 0;
    }

    .docs-content {
        order: 2;
        padding: 16px 20px;
    }

    .feature-grid,
    .scenarios-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

/* 滚动条样式 */
.docs-sidebar::-webkit-scrollbar,
.docs-content::-webkit-scrollbar {
    width: 8px;
}

.docs-sidebar::-webkit-scrollbar-track,
.docs-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.docs-sidebar::-webkit-scrollbar-thumb,
.docs-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb:hover,
.docs-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}