/* 主题样式定义 */

/* 浅色主题（默认） */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --text-secondary: #666666;
    --primary-color: #3EAF7C;
    --primary-hover: #2d8a5f;
    --header-bg: #ffffff;
    --sidebar-bg: #f8f9fa;
    --content-bg: #ffffff;
    --border-color: #e1e4e8;
    --hover-bg: #f6f8fa;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --table-header-bg: #f6f8fa;
    --table-row-even: #f6f8fa;
    --code-bg: #f8f9fa;
    --pre-bg: #f6f8fa;
    --code-text: #24292e;
    --pre-text: #24292e;
    --inline-code-bg: #f3f4f6;
    --inline-code-text: #e11d48;
    --inline-code-border: #e5e7eb;
    --syntax-keyword: #d73a49;
    --syntax-string: #032f62;
    --syntax-comment: #6a737d;
    --syntax-number: #005cc5;
    --syntax-function: #6f42c1;
    --syntax-class: #e36209;
    --syntax-operator: #d73a49;
    --syntax-property: #005cc5;
    --copy-btn-bg: #ffffff;
    --copy-btn-text: #586069;
    --copy-btn-hover-bg: #f6f8fa;
    --copy-btn-hover-text: #24292e;
    --scrollbar-track: #f1f1f1;
    --scrollbar-thumb: #c1c1c1;
    --scrollbar-thumb-hover: #a8a8a8;
}

/* 深色主题 */
[data-theme="dark"] {
    --bg-color: #22272e;
    --text-color: #ffffff;
    --text-secondary: #adbac7;
    --primary-color: #3EAF7C;
    --primary-hover: #4bc08a;
    --header-bg: #22272e;
    --sidebar-bg: #1c2128;
    --content-bg: #2d333b;
    --border-color: #444c56;
    --hover-bg: #373e47;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --table-header-bg: #373e47;
    --table-row-even: #2b313a;
    --code-bg: #373e47;
    --pre-bg: #1c2128;
    --code-text: #e6edf3;
    --pre-text: #e6edf3;
    --inline-code-bg: #373e47;
    --inline-code-text: #ff7b72;
    --inline-code-border: #444c56;
    --syntax-keyword: #ff7b72;
    --syntax-string: #a5d6ff;
    --syntax-comment: #8b949e;
    --syntax-number: #79c0ff;
    --syntax-function: #d2a8ff;
    --syntax-class: #ffa657;
    --syntax-operator: #ff7b72;
    --syntax-property: #79c0ff;
    --copy-btn-bg: #373e47;
    --copy-btn-text: #adbac7;
    --copy-btn-hover-bg: #444c56;
    --copy-btn-hover-text: #e6edf3;
    --scrollbar-track: #2d333b;
    --scrollbar-thumb: #545d68;
    --scrollbar-thumb-hover: #636c76;
}

/* 主题切换动画 */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 确保页面最小高度 */
html, body {
    min-height: 100vh;
}

/* 主题切换按钮特殊样式 */
.theme-toggle {
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background-color: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    z-index: -1;
}

.theme-toggle:hover::before {
    width: 100%;
    height: 100%;
}

/* 深色主题下的特殊调整 */
[data-theme="dark"] .logo {
    filter: brightness(1.2);
}

[data-theme="dark"] img:not(.logo):not(#theme-icon) {
    opacity: 0.9;
}

/* 链接在深色主题下的特殊样式 */
[data-theme="dark"] .link {
    color: #58a6ff;
}

[data-theme="dark"] .link:hover {
    color: #79c0ff;
}

/* 表格在深色主题下的特殊样式 */
[data-theme="dark"] table {
    border: 1px solid var(--border-color);
}

[data-theme="dark"] th {
    background-color: var(--table-header-bg);
    border-bottom: 2px solid var(--border-color);
}

[data-theme="dark"] tr:nth-child(even) {
    background-color: var(--table-row-even);
}

/* 按钮在深色主题下的调整 */
[data-theme="dark"] .doc-button {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 内容区域在深色主题下的调整 */
[data-theme="dark"] .content-body {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

/* 版本更新项在深色主题下的调整 */
[data-theme="dark"] .changelog-item {
    border-left-color: var(--primary-color);
}

/* 菜单项在深色主题下的调整 */
[data-theme="dark"] .menu-header {
    border-bottom-color: var(--border-color);
}

/* 导航栏在深色主题下的调整 */
[data-theme="dark"] .header {
    border-bottom-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 侧边栏在深色主题下的调整 */
[data-theme="dark"] .sidebar {
    border-right-color: var(--border-color);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}

/* 主题切换时的平滑过渡 */
.theme-transition {
    transition: all 0.3s ease;
}

/* 确保图标在主题切换时的平滑过渡 */
#theme-icon {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 主题切换时图标的旋转效果 */
.theme-toggle.switching #theme-icon {
    transform: rotate(180deg);
}

/* 代码块在深色主题下的特殊样式 */
[data-theme="dark"] pre,
[data-theme="dark"] code {
    background-color: var(--code-bg);
    border-color: var(--border-color);
    color: #e6edf3;
}

/* 选中文本的样式 */
::selection {
    background-color: var(--primary-color);
    color: white;
}

[data-theme="dark"] ::selection {
    background-color: var(--primary-color);
    color: white;
}

/* 焦点样式 */
a:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
    }
}

/* 打印样式 */
@media print {
    .sidebar,
    .header,
    .theme-toggle,
    .doc-button {
        display: none !important;
    }
    
    .content {
        margin-left: 0 !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .main-container {
        margin-top: 0 !important;
    }
    
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
}