/* WordPress管理员工具栏影响处理 */
body.admin-bar .left-sidebar {
    top: 32px; /* 管理员登录状态下的左侧菜单顶部间距 */
    height: calc(100vh - 32px); /* 减去工具栏高度 */
}

@media screen and (max-width: 782px) {
    body.admin-bar .left-sidebar {
        top: 46px; /* 移动端工具栏更高 */
        height: calc(100vh - 46px);
    }
}

/* 页面布局样式 */

.page-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.left-sidebar {
    width: 250px;
    background: #3F4257;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    overflow-x: hidden;
}

.sidebar-content {
    padding: 0; /* 移除顶部的padding，使logo完全贴合顶部 */
}

.left-sidebar .site-logo {
    padding: 0 20px;
    text-align: center;
    border-bottom: 1px solid #5A5E7D;
    margin-bottom: 0;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    margin-top: 0; /* 移除顶部间距，使logo完全贴合顶部 */
}

.left-sidebar .site-logo a {
    color: white;
    text-decoration: none;
}

.left-sidebar .site-logo .site-title {
    color: #333;
    font-size: 24px;
    margin: 0;
}

.main-wrapper {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    width: calc(100% - 250px);
    position: relative; /* 添加相对定位上下文，以便其子元素可以使用绝对定位 */
}

/* 主要内容区域样式 */
.main-content {
    display: flex;
    gap: 30px;
    padding: 0;
    width: 100%;
    margin-top: 96px !important; /* 与顶部导航保持间距 (66px导航栏高度 + 30px原有间距) */
    margin-bottom: 30px; /* 与底部保持30px间距 */
}

.content-area {
    flex: 1;
    max-width: calc(100% - 330px); /* 减去右侧边栏宽度 */
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    align-self: flex-start;
    box-sizing: border-box; /* 确保宽度包含填充和边框 */
}

/* 容器样式调整 */
.container {
    max-width: 1410px; /* 修改为更精确的宽度以匹配浏览器调试工具显示的宽度 */
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
}

.site-header .container {
    padding: 0 15px !important;  /* 添加header容器的内边距以与内容对齐 */
    max-width: 1410px !important; /* 与下方内容区保持一致的最大宽度 */
    margin: 0 auto !important;
    position: relative !important; /* 添加相对定位以使子元素可以定位 */
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 移动端响应式布局 */
@media (max-width: 1100px) {
    .page-wrapper {
        flex-direction: column;
    }
    
    .left-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        display: none;
    }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .main-content {
        flex-direction: column;
        padding: 0;
        width: 100%;
        margin-top: 96px; /* 与顶部导航保持间距 (66px导航栏高度 + 30px原有间距) */
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); /* 增加安全区域底部内边距 */
    }
    
    .content-area {
        max-width: 100%;
        width: 100%;
        margin: 0;
        gap: 30px;
    }
    
    .sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0;
        max-width: 100%;
        width: 100%;
        overflow: hidden; /* 防止溢出 */
    }
    
    /* 移除顶部导航的内边距 */
    .site-header .container {
        padding: 0 !important;
        max-width: 100% !important;
        width: 100vw !important; /* 使用视口宽度 */
        overflow: visible !important; /* 允许搜索框显示 */
        box-sizing: border-box !important;
    }
    
    .main-content {
        padding: 0;
        gap: 20px;
        width: 100%;
        margin-top: 150px !important; /* 增加顶部间距以容纳导航和搜索框 */
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 60px); /* 增加更多安全区域底部内边距以适配Microsoft Edge */
    }
    
    .content-area {
        gap: 20px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0;
        max-width: 100%;
        width: 100%;
    }
    
    /* 移除顶部导航的内边距 */
    .site-header .container {
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    .main-content {
        gap: 15px;
        margin-top: 150px !important; /* 保持与768px断点一致的间距 */
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 60px); /* 增加更多安全区域底部内边距以适配Microsoft Edge */
    }
    
    .content-area {
        gap: 15px;
    }
}