/* 基础设置 */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #333333;
    line-height: 1.6;
    background-color: #f7f9fc;
}

/* 布局 */
.main-content-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏容器 */
#sidebar {
    width: 280px;
    padding: 0;
    background-color: #ffffff;
    border-right: 1px solid #eaeaea;
    flex-shrink: 0;
    font-size: 0.95em;
    user-select: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
}

/* 顶级分类项容器 */
.sidebar-category {
    /* 移除边框，让所有项像列表一样平滑 */
}

/* 顶级分类头部（只做折叠开关，默认不变色） */
.category-header-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 500;
    color: #333; /* 默认黑色文字 */
    transition: color 0.2s, background-color 0.2s;
}

/* 鼠标悬停时，背景变浅，颜色不变 */
.category-header-link:hover {
    background-color: #f5f5f5;
}

/* 🎯 关键：当父分类下有子项被选中时，父分类变蓝字（但背景不变） */
.category-header-link.active {
    color: #0050b3; /* 蓝色字体 */
}

/* 箭头图标样式 (使用伪元素模拟 > 符号) */
.toggle-arrow::after {
    content: '\203A'; /* > 符号 */
    display: inline-block;
    font-weight: bold;
    font-size: 1.2em;
    color: #aaa; /* 默认灰色箭头 */
    transition: transform 0.3s ease-in-out;
}

/* 展开状态下箭头旋转 (v) */
.category-header-link.open .toggle-arrow::after {
    transform: rotate(90deg); /* 模拟向下箭头 */
}

/* 子菜单列表 */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0; 
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.35);
}

.submenu.active {
    max-height: 800px;
}

/* 子菜单链接 */
.submenu a {
    display: block;
    padding: 8px 15px 8px 40px; /* 缩进模拟二级菜单 */
    text-decoration: none;
    color: #444;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.1s, color 0.1s;
}

/* 🎯 关键：鼠标悬停子项时，背景变灰，文字变黑 */
.submenu a:hover {
    background-color: #f0f0f0; 
    color: #333; 
}

/* 🎯 关键：当前激活的子链接（蓝色高亮） */
.submenu a.active-link {
    background-color: #e6f4ff !important; /* 浅蓝色背景 */
    color: #0050b3 !important; /* 蓝色字体 */
    font-weight: 600;
    border-left: 3px solid #0050b3; /* 左侧蓝色边框 */
    padding-left: 37px; /* 补偿边框宽度 */
}

/* 文档内容区域 */
#doc-container {
    flex-grow: 1;
    padding: 30px 40px;
    background-color: #ffffff;
    margin-left: 280px;
}
/* H1 标题颜色 */
#doc-container h1 {
    font-size: 2.2em;
    color: #0050b3; /* Brand Blue (与截图标题颜色匹配) */
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-top: 0;
}

/* H2 标题颜色 */
#doc-container h2 {
    font-size: 1.6em;
    color: #0050b3; /* Brand Blue (与截图二级标题颜色匹配) */
    margin-top: 30px;
}

/* 文档内链接颜色 */
#doc-container a {
    color: #0050b3; 
    text-decoration: none; /* 移除下划线 */
}

#doc-container a:hover {
    text-decoration: underline;
}

/* ========================================
   移动端适配
   ======================================== */

/* 移动端顶部导航栏 */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #4285f4;
    z-index: 1001;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.menu-toggle svg {
    display: block;
}

/* 移动端标题 */
.mobile-title {
    color: white;
    font-size: 20px;
    font-style: italic;
    margin-left: 12px;
    font-weight: 400;
}

/* 遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* 响应式断点 - 平板和手机 */
@media screen and (max-width: 768px) {
    /* 显示移动端顶部导航栏 */
    .mobile-header {
        display: flex;
        align-items: center;
    }

    /* 侧边栏改为抽屉式 */
    #sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        z-index: 1002;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    #sidebar.open {
        left: 0;
    }

    /* 主内容区域 */
    .main-content-wrapper {
        flex-direction: column;
    }

    #doc-container {
        padding: 76px 20px 30px 20px;
        width: 100%;
        box-sizing: border-box;
        margin-left: 0;
    }

    #doc-container h1 {
        font-size: 1.8em;
    }

    #doc-container h2 {
        font-size: 1.4em;
    }
}

/* 更小屏幕的微调 */
@media screen and (max-width: 480px) {
    #doc-container {
        padding: 70px 15px 20px 15px;
    }

    #doc-container h1 {
        font-size: 1.5em;
    }

    .submenu a {
        padding: 10px 15px 10px 35px;
    }
}