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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.header {
    background: linear-gradient(135deg, #217346 0%, #185c37 100%);
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    color: white;
    font-size: 24px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-box::before {
    content: "\1F50D";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}

.filter-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filter-tag {
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.filter-tag.all {
    background: rgba(255,255,255,0.2);
    color: white;
}

.filter-tag.active {
    background: white;
    color: #217346;
    border-color: white;
}

.stats {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.main {
    display: flex;
    min-height: calc(100vh - 180px);
}

/* ========== 侧边栏样式 - 美化版 ========== */
.sidebar {
    position: sticky;
    top: 140px;
    width: 260px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 12px 0;
    border: 1px solid #e8f5e9;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

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

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

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

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

/* 侧边栏标题 */
.sidebar-title {
    padding: 8px 20px 12px;
    font-weight: 600;
    color: #217346;
    font-size: 14px;
    border-bottom: 2px solid #e8f5e9;
    margin-bottom: 8px;
}

/* 侧边栏菜单项 */
.sidebar-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    text-decoration: none;
    color: #444;
    margin: 2px 10px;
    border-radius: 10px;
}

.sidebar-item:hover {
    background: #e8f5e9;
    color: #217346;
}

.sidebar-item.active {
    background: #217346;
    color: white;
    font-weight: 500;
}

.sidebar-item.active .count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* 计数徽章 */
.sidebar-item .count {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
    transition: all 0.2s ease;
}

.sidebar-item:hover .count {
    background: #d0e8d4;
    color: #217346;
}

/* 返回首页按钮 */
.back-home {
    display: block;
    padding: 10px 20px;
    margin: 15px 12px 8px;
    background: #217346;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-home:hover {
    background: #185c37;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(33, 115, 70, 0.3);
}

/* 移动端侧边栏 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease;
        border-radius: 0;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        padding-top: 55px;
        border-right: none;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-item {
        margin: 2px 12px;
    }
    
    .back-home {
        margin: 15px 15px 8px;
    }
}

.content {
    flex: 1;
    padding: 20px;
}

.module-section {
    margin-bottom: 30px;
}

.module-title {
    font-size: 20px;
    color: #217346;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #217346;
    display: flex;
    align-items: center;
    gap: 10px;
}

.module-title .icon {
    font-size: 24px;
}

.function-card {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #ddd;
    transition: all 0.2s;
}

.function-card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.function-card.high-frequency {
    border-left-color: #ff6b6b;
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
}

.function-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.function-name {
    font-weight: bold;
    font-size: 16px;
    color: #217346;
    font-family: 'Consolas', 'Monaco', monospace;
}

.function-category {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #e8f5e9;
    color: #217346;
}

.function-description {
    color: #555;
    margin-bottom: 10px;
    font-size: 14px;
}

.function-example {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
}

.function-example .label {
    color: #888;
    font-size: 12px;
    margin-bottom: 4px;
}

.function-example code {
    display: block;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #d63384;
    word-break: break-all;
}

.function-example .desc {
    margin-top: 6px;
    color: #666;
    font-size: 12px;
    padding-left: 0;
}

.high-frequency-badge {
    display: inline-block;
    background: #ff6b6b;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: normal;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.no-results .icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.no-results h3 {
    color: #555;
    margin-bottom: 8px;
}

.back-to-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 45px;
    height: 45px;
    background: #217346;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

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

.back-to-top:hover {
    background: #185c37;
    transform: translateY(-3px);
}

.keyboard-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.keyboard-hint.show {
    opacity: 1;
    visibility: visible;
}

.keyboard-hint kbd {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 0 4px;
}

/* 搜索建议下拉框 */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.suggestion-item:hover,
.suggestion-item:focus {
    background: #f5f7fa;
}

.suggestion-name {
    font-weight: bold;
    color: #217346;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 15px;
}

.suggestion-desc {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
}

.suggestion-match {
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 4px;
}

/* 搜索提示 */
.search-tips {
    background: #e8f5e9;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #217346;
    font-size: 14px;
}

/* 函数详情弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.modal-header {
    padding: 20px 20px 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-header h2 {
    font-size: 24px;
    color: #217346;
    font-family: 'Consolas', 'Monaco', monospace;
}

.modal-body {
    padding: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h3 {
    color: #217346;
    font-size: 14px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e8f5e9;
}

.detail-section p {
    color: #555;
    line-height: 1.8;
}

.detail-section .syntax {
    display: inline-block;
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #d63384;
    font-size: 14px;
}

/* 中文语法样式 */
/* 语法容器 - 垂直布局 */
.syntax-container {
    display: flex;
    flex-direction: column;  /* 改为垂直排列 */
    gap: 15px;
}

.syntax-item {
    width: 100%;
}

.syntax-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.syntax {
    display: block;
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
}

.syntax-cn {
    background: #e8f5e9;
    color: #217346;
    border-left: 3px solid #217346;
}

.function-chinese-syntax {
    font-size: 12px;
    color: #217346;
    margin-bottom: 8px;
    background: #e8f5e9;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    font-family: monospace;
}

.example-box {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.example-box code {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #d63384;
    word-break: break-all;
}

.example-desc {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* 示例说明样式 */
.function-example-desc {
    background: #fff8e1;
    border-left: 3px solid #ffc107;
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: 0 6px 6px 0;
    font-size: 12px;
    color: #856404;
}

@media (max-width: 768px) {
    .main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 10px 0;
    }

    .sidebar-item {
        padding: 8px 15px;
    }

    .content {
        padding: 15px;
    }

    .search-box {
        min-width: 100%;
    }

    .header h1 {
        font-size: 20px;
    }

    .function-card {
        padding: 12px 15px;
    }

    .back-to-top {
        right: 20px;
        bottom: 20px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* 详情链接样式 */
.detail-link {
    display: inline-block;
    font-size: 12px;
    color: #217346;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s;
}

.detail-link:hover {
    background: #e8f5e9;
    color: #185c37;
    text-decoration: underline;
}
.footer {
    text-align: center;
    padding: 20px;
    background: #f5f7fa;
    color: #666;
    font-size: 14px;
    border-top: 1px solid #e0e0e0;
}
/* ============================================
   全局样式优化 - 隐藏顶部重复筛选标签
   ============================================ */

/* 所有设备隐藏顶部筛选标签（因为左侧导航已经够用） */
.filter-tags {
    display: none !important;
}

/* ========== 移动端菜单按钮样式 ========== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: 15px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 8px;
    color: #217346;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.mobile-menu-btn:hover {
    background: #217346;
    color: white;
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* 侧边栏关闭按钮 */
.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    z-index: 1002;
}

/* ========== 移动端样式 (≤768px) ========== */
@media (max-width: 768px) {
    /* 显示菜单按钮 */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* 侧边栏关闭按钮 */
    .sidebar-close {
        display: block;
    }
    
    /* 头部样式 - 居中对齐 */
    .header {
        padding: 15px;
        text-align: center;  /* 标题居中 */
    }
    
    .header h1 {
        font-size: 18px;
        margin-bottom: 12px;
        text-align: center;  /* 标题居中 */
    }
    
    /* 搜索框全宽且居中 */
    .search-container {
        width: 100%;
    }
    
    .search-box {
        width: 100%;
        min-width: auto;
    }
    
    .search-box input {
        padding: 10px 15px 10px 40px;
        font-size: 14px;
        width: 100%;
        text-align: left;  /* 输入文字左对齐 */
    }
    
    /* 侧边栏样式 - 滑出菜单 */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 260px;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 15px rgba(0,0,0,0.15);
        overflow-y: auto;
        padding-top: 55px;
        background: white;
        border-right: 1px solid #e0e0e0;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* 统计信息 */
    .stats {
        font-size: 12px;
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .stats span {
        font-size: 12px;
    }
    
    /* 内容区域 */
    .content {
        padding: 15px;
    }
    
    /* 函数卡片 */
    .function-card {
        padding: 12px 15px;
        margin-bottom: 10px;
    }
    
    .function-name {
        font-size: 15px;
    }
    
    .function-description {
        font-size: 13px;
    }
    
    .function-example code {
        font-size: 12px;
    }
    
    /* 模块标题 */
    .module-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    /* 返回顶部按钮 */
    .back-to-top {
        right: 15px;
        bottom: 15px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    /* 键盘提示 */
    .keyboard-hint {
        font-size: 11px;
        padding: 6px 12px;
        bottom: 10px;
    }
    
    /* 弹窗移动端优化 */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        border-radius: 12px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .detail-section h3 {
        font-size: 14px;
    }
    
    .detail-section p {
        font-size: 13px;
    }
    
    .example-box code {
        font-size: 12px;
        word-break: break-all;
    }
}

/* ========== 平板设备样式 (769px - 1024px) ========== */
@media (min-width: 769px) and (max-width: 1024px) {
    /* 隐藏移动端菜单按钮 */
    .mobile-menu-btn,
    .sidebar-close,
    .sidebar-overlay {
        display: none !important;
    }
    
    /* 侧边栏正常显示但宽度稍小 */
    .sidebar {
        width: 200px;
    }
    
    /* 头部内边距调整 */
    .header {
        padding: 15px 20px;
    }
    
    /* 内容区域边距 */
    .content {
        padding: 20px;
    }
}

/* ========== PC端样式 (≥1025px) ========== */
@media (min-width: 1025px) {
    /* 隐藏移动端特有的元素 */
    .mobile-menu-btn,
    .sidebar-close,
    .sidebar-overlay {
        display: none !important;
    }
    
    /* PC端侧边栏正常显示 */
    .sidebar {
        position: sticky;
        top: 140px;
        left: auto;
        width: 220px;
        height: fit-content;
        transform: none;
        padding-top: 20px;
    }
}

/* 头部导航样式 */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.header-nav {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    padding: 4px;
    border-radius: 40px;
}

.nav-link {
    padding: 8px 20px;
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.2);
}

.nav-link.active {
    background: white;
    color: #217346;
}

/* 移动端导航适配 */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-nav {
        justify-content: center;
    }
    
    .nav-link {
        padding: 6px 16px;
        font-size: 13px;
    }
}
