/* ===================================
 * GitBook Style Wiki Theme for Typecho
 * 模仿GitBook和MacOS风格的现代化设计
 * 支持暗黑模式和现代化交互
 * 
 * @package GitBook Wiki Theme
 * @author PIGYun Team
 * @version 2.0
 * @link https://www.pigyun.com
 * @description 由PIGYun香港优质服务器强力驱动的现代化主题
 * =================================== */

/* 全局重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 暗黑模式 */
body.dark-mode {
    color: #e1e4e8;
    background-color: #0d1117;
}

/* 全局链接样式 */
a {
    color: #0366d6;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0256cc;
}

body.dark-mode a {
    color: #58a6ff;
}

body.dark-mode a:hover {
    color: #79c0ff;
}

/* GitBook风格的整体布局 */
.wiki-container {
    display: flex;
    min-height: 100vh;
}

/* 左侧侧边栏导航 */
.wiki-sidebar {
    width: 300px;
    min-width: 300px;
    background: #fff;
    border-right: 1px solid #e1e4e8;
    overflow-y: auto;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

body.dark-mode .wiki-sidebar {
    background: #161b22;
    border-right-color: #30363d;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

/* 主内容区域 */
.wiki-content {
    flex: 1;
    margin-left: 300px;
    min-height: 100vh;
    background: #fff;
    transition: background-color 0.3s ease;
}

body.dark-mode .wiki-content {
    background: #0d1117;
}

/* 顶部标题栏 - MacOS风格 */
.wiki-header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid #e1e4e8;
    padding: 0 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

body.dark-mode .wiki-header {
    background: rgba(22, 27, 34, 0.8);
    border-bottom-color: #30363d;
}

.wiki-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    transition: color 0.3s ease;
}

body.dark-mode .wiki-header h1 {
    color: #f0f6fc;
}

/* MacOS风格的搜索框 */
.wiki-search {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.wiki-search input {
    width: 100%;
    padding: 8px 36px 8px 16px;
    border: 1px solid #d1d5da;
    border-radius: 20px;
    background: #f6f8fa;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.wiki-search input:focus {
    border-color: #0366d6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

body.dark-mode .wiki-search input {
    background: #21262d;
    border-color: #30363d;
    color: #f0f6fc;
}

body.dark-mode .wiki-search input:focus {
    border-color: #58a6ff;
    background: #0d1117;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.wiki-search button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6a737d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.wiki-search button:hover {
    color: #0366d6;
}

body.dark-mode .wiki-search button {
    color: #8b949e;
}

body.dark-mode .wiki-search button:hover {
    color: #58a6ff;
}

/* 侧边栏内容 */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e1e4e8;
    transition: border-color 0.3s ease;
}

body.dark-mode .sidebar-header {
    border-bottom-color: #30363d;
}

.sidebar-header .logo {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

body.dark-mode .sidebar-header .logo {
    color: #f0f6fc;
}

.sidebar-header .description {
    font-size: 12px;
    color: #6a737d;
    line-height: 1.4;
    opacity: 0.85;
    transition: color 0.3s ease;
}

body.dark-mode .sidebar-header .description {
    color: #8b949e;
}

/* 侧边栏导航菜单 */
.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #6a737d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 20px 8px;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

body.dark-mode .nav-section-title {
    color: #8b949e;
}

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

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 8px 20px;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: #f6f8fa;
    color: #0366d6;
}

.nav-link.active {
    background: #f1f8ff;
    color: #0366d6;
    border-left-color: #0366d6;
    font-weight: 500;
}

body.dark-mode .nav-link {
    color: #e1e4e8;
}

body.dark-mode .nav-link:hover {
    background: #21262d;
    color: #58a6ff;
}

body.dark-mode .nav-link.active {
    background: #1c2128;
    color: #58a6ff;
    border-left-color: #58a6ff;
}

/* 树状导航（分类子项） */
.nav-children {
    list-style: none;
    padding-left: 20px;
}

.nav-children .nav-link {
    font-size: 13px;
    padding: 6px 20px;
    color: #6a737d;
}

.nav-children .nav-link:hover {
    color: #333;
}

body.dark-mode .nav-children .nav-link {
    color: #8b949e;
}

body.dark-mode .nav-children .nav-link:hover {
    color: #e1e4e8;
}

/* 主内容区域样式 */
.wiki-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 30px 60px;
}

/* 文章标题 */
.article-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e1e4e8;
    transition: border-color 0.3s ease;
}

body.dark-mode .article-header {
    border-bottom-color: #30363d;
}

.article-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.25;
    margin-bottom: 12px;
    transition: color 0.3s ease;
}

body.dark-mode .article-title {
    color: #f0f6fc;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: #6a737d;
    flex-wrap: wrap;
    transition: color 0.3s ease;
}

body.dark-mode .article-meta {
    color: #8b949e;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 文章内容 */
.article-content {
    font-size: 16px;
    line-height: 1.7;
    color: #333;
    transition: color 0.3s ease;
}

body.dark-mode .article-content {
    color: #e1e4e8;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin: 32px 0 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #1a1a1a;
    transition: color 0.3s ease;
}

body.dark-mode .article-content h1,
body.dark-mode .article-content h2,
body.dark-mode .article-content h3,
body.dark-mode .article-content h4,
body.dark-mode .article-content h5,
body.dark-mode .article-content h6 {
    color: #f0f6fc;
}

.article-content h1 {
    font-size: 28px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e4e8;
}

body.dark-mode .article-content h1 {
    border-bottom-color: #30363d;
}

.article-content h2 {
    font-size: 24px;
}

.article-content h3 {
    font-size: 20px;
}

.article-content h4 {
    font-size: 18px;
}

.article-content h5 {
    font-size: 16px;
}

.article-content h6 {
    font-size: 14px;
    color: #6a737d;
}

body.dark-mode .article-content h6 {
    color: #8b949e;
}

.article-content p {
    margin: 16px 0;
}

.article-content ul,
.article-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.article-content li {
    margin: 4px 0;
}

/* 代码样式 */
.article-content pre {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.45;
    position: relative;
    transition: all 0.3s ease;
}

body.dark-mode .article-content pre {
    background: #161b22;
    border-color: #30363d;
}

.article-content code {
    background: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 85%;
    color: #e36209;
    transition: all 0.3s ease;
}

body.dark-mode .article-content code {
    background: #161b22;
    color: #ffa657;
}

.article-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* 引用块 */
.article-content blockquote {
    margin: 16px 0;
    padding: 0 16px;
    border-left: 4px solid #dfe2e5;
    color: #6a737d;
    background: #f8f9fa;
    border-radius: 0 4px 4px 0;
    transition: all 0.3s ease;
}

body.dark-mode .article-content blockquote {
    border-left-color: #30363d;
    color: #8b949e;
    background: #161b22;
}

/* 表格 */
.article-content table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

body.dark-mode .article-content table {
    border-color: #30363d;
}

.article-content th,
.article-content td {
    padding: 12px 16px;
    border-bottom: 1px solid #e1e4e8;
    text-align: left;
    transition: border-color 0.3s ease;
}

body.dark-mode .article-content th,
body.dark-mode .article-content td {
    border-bottom-color: #30363d;
}

.article-content th {
    background: #f6f8fa;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
}

body.dark-mode .article-content th {
    background: #161b22;
    color: #f0f6fc;
}

.article-content tr:last-child td {
    border-bottom: none;
}

/* 分类页面样式 */
.category-header {
    margin-bottom: 40px;
    text-align: center;
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    margin-top: -20px;
    position: relative;
    overflow: hidden;
}

.category-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.8) 0%, rgba(159, 122, 234, 0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.dark-mode .category-header::before {
    opacity: 1;
}

.category-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

.category-description {
    font-size: 18px;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.article-card {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(3, 102, 214, 0.05) 0%, rgba(88, 166, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    border-color: #0366d6;
}

.article-card:hover::before {
    opacity: 1;
}

body.dark-mode .article-card {
    background: #161b22;
    border-color: #30363d;
}

body.dark-mode .article-card:hover {
    border-color: #58a6ff;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.article-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.3;
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

body.dark-mode .article-card-title {
    color: #f0f6fc;
}

.article-card-excerpt {
    color: #6a737d;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

body.dark-mode .article-card-excerpt {
    color: #8b949e;
}

.article-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #8e96a3;
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

body.dark-mode .article-card-meta {
    color: #6e7681;
}

/* 文章导航（上一篇/下一篇） */
.article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #e1e4e8;
    gap: 20px;
    transition: border-color 0.3s ease;
}

body.dark-mode .article-nav {
    border-top-color: #30363d;
}

.article-nav-item {
    flex: 1;
    max-width: calc(50% - 10px);
}

.article-nav-link {
    display: block;
    padding: 16px 20px;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    color: #0366d6;
    text-decoration: none;
    transition: all 0.3s ease;
}

.article-nav-link:hover {
    background: #f1f8ff;
    border-color: #0366d6;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(3, 102, 214, 0.15);
}

body.dark-mode .article-nav-link {
    background: #21262d;
    border-color: #30363d;
    color: #58a6ff;
}

body.dark-mode .article-nav-link:hover {
    background: #1c2128;
    border-color: #58a6ff;
    box-shadow: 0 8px 25px rgba(88, 166, 255, 0.15);
}

.article-nav-link.next {
    text-align: right;
}

.article-nav-label {
    font-size: 12px;
    color: #6a737d;
    margin-bottom: 4px;
    display: block;
    transition: color 0.3s ease;
}

body.dark-mode .article-nav-label {
    color: #8b949e;
}

.article-nav-title {
    font-weight: 500;
    color: #333;
    transition: color 0.3s ease;
}

body.dark-mode .article-nav-title {
    color: #e1e4e8;
}

/* 悬浮按钮 */
.floating-buttons {
    position: fixed;
    right: 30px;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.floating-btn {
    width: 50px;
    height: 50px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.floating-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    border-color: #0366d6;
}

body.dark-mode .floating-btn {
    background: rgba(22, 27, 34, 0.9);
    border-color: #30363d;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

body.dark-mode .floating-btn:hover {
    border-color: #58a6ff;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.floating-btn .btn-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.floating-btn:hover .btn-icon {
    transform: scale(1.2);
}

/* 特殊的回到顶部按钮样式 */
#back-to-top {
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* 目录导航样式增强 */
#article-toc {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

body.dark-mode #article-toc {
    background: rgba(22, 27, 34, 0.9) !important;
    border-color: #30363d !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

#article-toc a {
    transition: all 0.3s ease;
}

body.dark-mode #article-toc a {
    color: #8b949e;
}

body.dark-mode #article-toc a:hover,
body.dark-mode #article-toc a.active {
    color: #58a6ff;
    border-left-color: #58a6ff;
}

/* 标签样式 */
.article-tags {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: #f1f8ff;
    color: #0366d6;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background: #0366d6;
    color: white;
    transform: translateY(-1px);
}

body.dark-mode .tag {
    background: #1c2128;
    color: #58a6ff;
}

body.dark-mode .tag:hover {
    background: #58a6ff;
    color: #0d1117;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wiki-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .wiki-sidebar.open {
        transform: translateX(0);
    }
    
    .wiki-content {
        margin-left: 0;
    }
    
    .wiki-main {
        padding: 20px 16px;
    }
    
    .article-title {
        font-size: 24px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .article-nav {
        flex-direction: column;
    }
    
    .article-nav-item {
        max-width: 100%;
    }
    
    .floating-buttons {
        right: 20px;
        bottom: 20px;
    }
    
    .floating-btn {
        width: 45px;
        height: 45px;
    }
    
    .floating-btn .btn-icon {
        font-size: 18px;
    }
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: #333;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: #f6f8fa;
}

body.dark-mode .mobile-menu-btn {
    color: #f0f6fc;
}

body.dark-mode .mobile-menu-btn:hover {
    background: #21262d;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
}

/* 评论区域样式增强 */
.comments-section {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #e1e4e8;
    transition: border-color 0.3s ease;
}

body.dark-mode .comments-section {
    border-top-color: #30363d;
}

.comments-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #1a1a1a;
    transition: color 0.3s ease;
}

body.dark-mode .comments-title {
    color: #f0f6fc;
}

/* 代码块复制按钮增强 */
.copy-btn {
    background: rgba(246, 248, 250, 0.9) !important;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

body.dark-mode .copy-btn {
    background: rgba(33, 38, 45, 0.9) !important;
    color: #e1e4e8 !important;
    border-color: #30363d !important;
}

body.dark-mode .copy-btn:hover {
    background: rgba(48, 54, 61, 0.9) !important;
    color: #f0f6fc !important;
}

/* 动画增强 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-card,
.floating-btn,
.article-nav-link {
    animation: fadeIn 0.6s ease forwards;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #161b22;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #30363d;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* 平滑过渡 */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
