:root {
    --primary-color: #2badad;
    --primary-dark: #228a8a;
    --bg-color: #1a1a1a;
    --sidebar-bg: #222;
    --text-color: #e7e7e7;
    --text-muted: #9090aa;
    --border-color: #414242;
    --code-bg: #1d1d1d;
    --hover-bg: #2a2a2a;
}

/* 暗黑主题（默认） */
[data-theme="dark"] {
    --primary-color: #2badad;
    --primary-dark: #228a8a;
    --bg-color: #1a1a1a;
    --sidebar-bg: #222;
    --text-color: #e7e7e7;
    --text-muted: #9090aa;
    --border-color: #414242;
    --code-bg: #1d1d1d;
    --hover-bg: #2a2a2a;
    --code-color: #abb2bf;
}

/* 明亮主题 */
[data-theme="light"] {
    --primary-color: #007acc;
    --primary-dark: #005a9e;
    --bg-color: #ffffff;
    --sidebar-bg: #f5f5f5;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #dddddd;
    --code-bg: #f8f8f8;
    --hover-bg: #e9e9e9;
    --code-color: #383a42;
}

/* 蓝色主题 */
[data-theme="blue"] {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --code-bg: #1e293b;
    --hover-bg: #334155;
}

/* 绿色主题 */
[data-theme="green"] {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --bg-color: #0a0f0f;
    --sidebar-bg: #1a1f1e;
    --text-color: #ecfdf5;
    --text-muted: #a7f3d0;
    --border-color: #374151;
    --code-bg: #1a1f1e;
    --hover-bg: #374151;
}

/* 紫色主题 */
[data-theme="purple"] {
    --primary-color: #8b5cf6;
    --primary-dark: #7c3aed;
    --bg-color: #1a1a2e;
    --sidebar-bg: #16213e;
    --text-color: #e2e8f0;
    --text-muted: #cbd5e1;
    --border-color: #2d3748;
    --code-bg: #16213e;
    --hover-bg: #2d3748;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: all 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    text-align: center;
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.header p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* 控制面板样式 */
.control-panel {
    position: absolute;
    top: 20px;
    right: 0;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.control-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-align: center;
    white-space: nowrap;
}

.theme-switcher, .language-switcher {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.theme-switcher {
    margin-right: 15px;
}

.theme-btn, .lang-btn {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: center;
}

.theme-btn:hover, .lang-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    min-width: 120px;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 5px;
}

.dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

.sidebar {
    background: var(--sidebar-bg);
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
    transition: all 0.3s ease;
}

.search-box {
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.nav {
    max-height: 70vh;
    overflow-y: auto;
}

.nav-category {
    margin-bottom: 1.5rem;
}

.nav-category h3 {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-items {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-item a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-item a:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.nav-item a.active {
    background: var(--primary-color);
    color: white;
}

.main {
    background: var(--sidebar-bg);
    border-radius: 8px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.content-section {
    margin-bottom: 3rem;
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.api-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.api-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.api-name {
    font-family: 'Menlo', monospace;
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-right: 1rem;
}

.api-type {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.api-description {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.api-details {
    margin-bottom: 1rem;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.parameters, .returns {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.parameters th, .returns th {
    background: var(--code-bg);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
}

.parameters td, .returns td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.parameters tr:last-child td, .returns tr:last-child td {
    border-bottom: none;
}

.code-example {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    overflow-x: auto;
    transition: all 0.3s ease;
}

.code-example pre {
    margin: 0;
    font-family: 'Menlo', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-panel {
        position: static;
        justify-content: center;
        margin-top: 1rem;
        gap: 15px;
    }
    
    .control-group {
        flex: 1;
        max-width: 120px;
    }
    
    .theme-btn, .lang-btn {
        min-width: auto;
        padding: 8px 12px;
    }
}

/* 滚动条样式 */
.nav::-webkit-scrollbar {
    width: 6px;
}

.nav::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.nav::-webkit-scrollbar-track {
    background: var(--bg-color);
}

/* 主题切换动画 */
body.theme-changing * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* 确保所有可过渡元素都有平滑效果 */
body * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 下拉菜单动画增强 */
.dropdown {
    transform-origin: top right;
}

.dropdown.show {
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 外部链接样式 */
.external-link-type {
    background: #ff6b35 !important;
}

.link-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-color);
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid var(--primary-color);
}

.link-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: white;
}

.external-link {
    margin-top: 1rem;
}

/* API类型标签样式增强 */
.api-type.external-link-type {
    background: #ff6b35;
}

/* .api-type.sdk-function {
    background: var(--primary-color);
} */

.api-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 15px;
}

.api-header h2 {
    margin: 0;
    flex: 1;
}

/* 在现有的CSS中添加以下样式 */

/* 函数名样式 - 突出显示 */
.function-item .function-header h3 {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1.3em;
  margin-bottom: 8px;
  border-left: 4px solid var(--primary-color);
  padding-left: 12px;
  background: linear-gradient(135deg, var(--bg-color) 0%, var(--sidebar-bg) 100%);
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px 0;
}

/* 函数描述样式 */
.function-description {
  color: var(--text-color);
  font-size: 1.1em;
  line-height: 1.5;
  margin-bottom: 20px;
  opacity: 0.9;
}

/* 代码示例容器 */
.code-example {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0;
}

/* 代码示例标题 */
.code-example-header {
  background: var(--sidebar-bg);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9em;
  color: var(--text-muted);
  font-weight: 500;
}

/* 代码块样式 */
.code-example pre {
  margin: 0;
  padding: 0;
  background: transparent;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  white-space: pre;
  overflow-x: auto;
}

/* 示例代码样式 - 灰色显示 */
.code-example code {
    color: #888 !important; /* 灰色文本 */
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.5;
}

/* 暗色主题代码颜色 */
[data-theme="dark"] .code-example code {
  --code-color: #abb2bf;
}

[data-theme="dark"] .code-example {
  --code-bg: #282c34;
}

/* 亮色主题代码颜色 */
[data-theme="light"] .code-example code {
  --code-color: #383a42;
}

[data-theme="light"] .code-example {
  --code-bg: #fafafa;
}

/* 蓝色主题代码颜色 */
[data-theme="blue"] .code-example code {
  --code-color: #e1e8f0;
}

[data-theme="blue"] .code-example {
  --code-bg: #1e2a3a;
}

/* 绿色主题代码颜色 */
[data-theme="green"] .code-example code {
  --code-color: #d4e6d4;
}

[data-theme="green"] .code-example {
  --code-bg: #1a2a1a;
}

/* 紫色主题代码颜色 */
[data-theme="purple"] .code-example code {
  --code-color: #e8d4e8;
}

[data-theme="purple"] .code-example {
  --code-bg: #2a1a2a;
}

/* 模块类型样式 */
.api-type.module-type {
    background: #8b5cf6 !important;
}

/* 全局类型样式 */
.api-type.global-type {
    background: #f7b502 !important;
}

/* 库类型样式 */
.api-type.library-type {
    background: #e402f8 !important;
}

/* 函数类型样式 */
.api-type.function-type {
    background: #3b82f6 !important; /* 蓝色 */
}