/* Layout and Structure Styles */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f5f6fa;
    margin: 0;
    padding: 0; /* 移除所有padding，让fixed元素自己定位 */
}

/* 主内容容器 */
.main-content {
    display: flex;
    flex: 1;
    position: relative;
    min-height: 100vh; /* 占满整个视口 */
    width: 100%;
    box-sizing: border-box;
}

/* 侧边栏样式 */
.sidebar-container {
    width: 280px;
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    position: fixed;
    top: 60px; /* 从header下方开始 */
    bottom: 60px; /* 到footer上方结束 */
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    height: calc(100vh - 120px); /* header 60px + footer 60px */
    padding-bottom: 20px;
    flex-shrink: 0;
}

/* 确保菜单滚动正常 */
.sidebar-menu {
    height: calc(100% - 120px);
    overflow-y: auto;
    padding-bottom: 30px;
}

/* 右侧内容区域 - 重新设计定位 */
.right-section {
    flex: 1 !important;
    margin-left: 280px !important; /* 为侧边栏留出空间 */
    padding: 20px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background-color: #f5f6fa !important;
    box-sizing: border-box !important;
    width: calc(100vw - 280px) !important;
    max-width: calc(100vw - 280px) !important;
    /* 关键修复：正确设置top和bottom位置 */
    position: relative !important;
    top: 60px !important; /* 从header下方开始 */
    min-height: calc(100vh - 120px) !important; /* header + footer = 120px */
    max-height: calc(100vh - 120px) !important;
}

/* 确保内容容器不会溢出 */
.right-section > * {
    max-width: 100%;
    box-sizing: border-box;
}

/* 表格响应式处理 */
.right-section .table-responsive {
    overflow-x: auto;
    max-width: 100%;
}

/* 容器流体布局修复 - 强制覆盖Bootstrap默认样式 */
.right-section .container-fluid {
    padding-left: 15px !important;
    padding-right: 15px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
}

/* 顶部导航栏样式 */
.header-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background-color: white;
    height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 桌面端布局 */
@media (min-width: 992px) {
    .sidebar-container {
        transform: translateX(0) !important;
    }
    
    .right-section {
        margin-left: 280px !important;
        width: calc(100vw - 280px) !important;
        max-width: calc(100vw - 280px) !important;
    }
}

/* 移动端响应式布局 */
@media (max-width: 991.98px) {
    .sidebar-container {
        transform: translateX(-280px);
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }
    
    .right-section {
        margin-left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        top: 60px !important; /* 移动端也从header下方开始 */
    }

    /* 当移动端侧边栏显示时 */
    .sidebar-visible .sidebar-container {
        transform: translateX(0);
    }

    .sidebar-visible .right-section {
        margin-left: 0;
    }
}

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

.sidebar-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-container::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

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

/* 修复子菜单展开问题 */
.sidebar-container .collapse.show {
    max-height: none;
    overflow: visible;
}

/* 优化侧边栏内容，防止过度滚动 */
.user-profile {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1001;
}

/* 减小头像大小，节省空间 */
.user-profile img {
    width: 80px !important; 
    height: 80px !important;
} 

