/* TianYuan 用户手册样式 */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --bg-color: #ffffff;
    --text-color: #1e293b;
    --sidebar-bg: #f8fafc;
    --border-color: #e2e8f0;
    --code-bg: #f1f5f9;
    --link-color: #2563eb;
    --link-hover: #1e40af;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --header-height: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* 页面布局 */
.page-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.sidebar-header .subtitle {
    font-size: 14px;
    color: var(--secondary-color);
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: block;
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 15px;
}

.nav-link:hover {
    background-color: #e2e8f0;
    color: var(--primary-color);
}

.nav-link.active {
    background-color: #dbeafe;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
    font-weight: 500;
}

.nav-section {
    margin-top: 20px;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--secondary-color);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* 主内容区域 */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 40px 60px;
    max-width: 1200px;
}

/* 页面标题 */
.page-title {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.page-description {
    font-size: 18px;
    color: var(--secondary-color);
    margin-bottom: 30px;
    line-height: 1.8;
}

/* 内容区块 */
.content-section {
    margin-bottom: 40px;
}

.content-section h2 {
    font-size: 28px;
    margin-top: 40px;
    margin-bottom: 15px;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.content-section h3 {
    font-size: 22px;
    margin-top: 30px;
    margin-bottom: 12px;
    color: var(--text-color);
}

.content-section h4 {
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.content-section p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.content-section ul, .content-section ol {
    margin-bottom: 15px;
    padding-left: 30px;
}

.content-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* 代码块 */
pre {
    margin: 20px 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

pre code {
    display: block;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: auto;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

pre code {
    background-color: transparent;
    padding: 0;
}

/* 函数表格 */
.function-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: var(--shadow);
    border-radius: 6px;
    overflow: hidden;
}

.function-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 500;
}

.function-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.function-table tr:last-child td {
    border-bottom: none;
}

.function-table tr:hover {
    background-color: #f8fafc;
}

.function-name {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--primary-color);
    font-weight: 500;
}

/* 卡片样式 */
.card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* 提示框 */
.note {
    background-color: #dbeafe;
    border-left: 4px solid var(--primary-color);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.warning {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.tip {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

/* 链接 */
a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--link-hover);
    transform: translateY(-3px);
}

/* 移动端返回按钮 */
.mobile-back-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background-color: var(--primary-color);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.mobile-back-btn:hover {
    background-color: var(--link-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.mobile-back-btn:active {
    transform: scale(0.95);
}

/* 移动端关闭按钮 */
.mobile-close-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 180px;
    z-index: 1001;
    background-color: #ef4444;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.mobile-close-btn:hover {
    background-color: #dc2626;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.mobile-close-btn:active {
    transform: scale(0.95);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 70px;
    z-index: 1000;
    background-color: var(--primary-color);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.mobile-menu-btn:hover {
    background-color: var(--link-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
        padding: 30px 40px;
    }
}

@media (max-width: 768px) {
    .mobile-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 防止页面横向滚动 */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .main-content {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* 确保代码块不会导致页面过宽 */
    pre {
        max-width: calc(100vw - 40px);
        overflow-x: auto;
    }
    
    pre code {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 70px 20px 20px 20px;
    }
    
    .page-title {
        font-size: 26px;
    }
    
    .page-description {
        font-size: 16px;
    }
    
    .content-section h2 {
        font-size: 22px;
    }
    
    .content-section h3 {
        font-size: 18px;
    }
    
    pre code {
        font-size: 13px;
        padding: 15px;
    }
    
    .function-table {
        font-size: 14px;
    }
    
    .function-table th,
    .function-table td {
        padding: 8px 10px;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
}

/* 目录索引 */
.toc {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    margin: 30px 0;
}

.toc-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color);
}

.toc ul {
    list-style: none;
    padding-left: 0;
}

.toc li {
    margin-bottom: 8px;
}

.toc a {
    color: var(--text-color);
    text-decoration: none;
}

.toc a:hover {
    color: var(--primary-color);
}

/* 搜索框 */
.search-box {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}

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

/* 主题切换按钮 */
.theme-switcher {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
    z-index: 1000;
}

.theme-switcher:hover {
    background-color: var(--link-hover);
    transform: translateY(-3px) scale(1.1);
}

.theme-switcher:active {
    transform: translateY(-1px) scale(1.05);
}

@media (max-width: 768px) {
    .theme-switcher {
        display: flex !important;
        width: 45px;
        height: 45px;
        top: 15px;
        left: 125px;
        bottom: auto;
        right: auto;
        font-size: 20px;
        z-index: 1000;
        border: 2px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    .theme-switcher:hover {
        box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    }
}


