/* ========================================
   侧边栏优化样式 - 统一大小和位置
   解决不同页面侧边栏大小不一致的问题
   ======================================== */

/* ===== 侧边栏基础样式优化 ===== */
.sidenav {
    background-color: #fff;
    padding: 15px 0;
    border-radius: 4px;
    margin-right: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
    /* 向左对齐，减少右边距 */
    margin-left: 0;
    margin-right: 10px;
}

/* ===== 用户信息区域优化 ===== */
.sidenav .user-brief-info {
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
}

.sidenav .user-brief-info .avatar {
    width: 50px;
    height: 50px;
    margin: 0 auto 8px;
    border-radius: 50%;
    overflow: hidden;
}

.sidenav .user-brief-info .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidenav .user-brief-info .user-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.sidenav .user-brief-info .user-group {
    font-size: 11px;
    color: #8c8c8c;
}

/* ===== 导航菜单优化 ===== */
.sidenav .list-group {
    margin-bottom: 0;
}

.sidenav .list-group-heading {
    padding: 8px 15px;
    font-weight: 600;
    color: #919191;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.sidenav .list-group-item {
    border-radius: 0;
    border: none;
    padding: 0;
    margin-bottom: 2px;
    position: relative;
    /* 使用伪元素创建边框，不影响文字位置 */
}

.sidenav .list-group-item:last-child,
.sidenav .list-group-item:first-child {
    border-radius: 0;
}

/* 使用伪元素创建左边框，避免影响文字位置 */
.sidenav .list-group-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: transparent;
    transition: background-color 0.2s ease;
}

.sidenav .list-group-item:hover::before {
    background-color: rgba(70, 195, 123, 0.3);
}

.sidenav .list-group-item:hover {
    background-color: rgba(245, 245, 245, 0.38);
}

.sidenav .list-group-item > a {
    display: block;
    color: #616161;
    padding: 8px 15px 8px 20px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    /* 所有链接使用统一的左边距 */
    margin-left: 0;
    position: relative;
    z-index: 1;
}

.sidenav .list-group-item > a:hover {
    color: #46c37b;
    text-decoration: none;
}

.sidenav .list-group-item.active::before {
    background-color: #46c37b;
}

.sidenav .list-group-item.active {
    background-color: rgba(70, 195, 123, 0.1);
}

.sidenav .list-group-item.active > a {
    color: #46c37b;
    font-weight: 500;
    /* 激活状态保持相同的文字位置 */
    padding-left: 20px;
    margin-left: 0;
}

.sidenav .list-group-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    font-size: 12px;
}

/* ===== 移动端侧边栏优化 ===== */
@media (max-width: 991px) {
    .sidenav {
        position: fixed;
        top: 50px;
        z-index: 1029;
        height: calc(100vh - 50px);
        padding: 20px 0;
        min-width: 220px;
        overflow-y: auto;
        overflow-x: hidden;
        width: 220px;
        left: -220px;
        background-color: #fff;
        transition: all 0.3s ease;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
        margin: 0;
    }
    
    .sidebar-toggle {
        display: block;
        position: fixed;
        right: 20px;
        bottom: 70px;
        border-radius: 50%;
        font-size: 18px;
        padding: 8px;
        line-height: 30px;
        height: 45px;
        width: 45px;
        text-align: center;
        z-index: 999999;
        background: #46c37b;
        color: white;
        border: none;
        cursor: pointer;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar-toggle:hover {
        background-color: #3db172 !important;
        transform: scale(1.05);
    }
}

body.sidebar-open .sidenav {
    left: 0;
    width: 220px;
    box-shadow: 0 6px 27px rgba(0, 0, 0, 0.1);
}

body.sidebar-open .sidebar-toggle i:before {
    content: "\f00d";
}

/* ===== 内容区域优化 ===== */
/* 确保内容区域有足够的空间 */
.col-md-10 {
    padding-left: 5px;
}

/* 在小屏幕上调整内容区域 */
@media (max-width: 991px) {
    .col-md-10 {
        padding-left: 15px;
    }
}

/* ===== 响应式优化 ===== */
@media (max-width: 768px) {
    .sidenav {
        width: 280px;
        left: -280px;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
        z-index: 1050;
    }
    
    .sidenav .list-group-item {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .sidenav .list-group-item a {
        display: flex;
        align-items: center;
        padding: 8px 0;
    }
    
    .sidenav .list-group-item i {
        margin-right: 12px;
        width: 20px;
        text-align: center;
    }
    
    body.sidebar-open .sidenav {
        left: 0;
        width: 280px;
    }
}

/* ===== 页面特定优化 ===== */
/* 确保所有页面都使用统一的侧边栏样式 */
#content-container .row > .col-md-2 {
    padding-right: 5px;
}

#content-container .row > .col-md-10 {
    padding-left: 5px;
}
