/* 导航菜单和顶部设计的自定义样式 */

/* 侧边栏折叠相关样式 */
.sidebar-collapsed {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
}

.sidebar-collapsed span,
.sidebar-collapsed .ms-auto,
.sidebar-collapsed hr,
.sidebar-collapsed .collapse {
    display: none !important;
}

.sidebar-collapsed .nav-link {
    text-align: center;
    padding: 0.5rem 0 !important;
    justify-content: center !important;
}

.sidebar-collapsed i.fas:not(.fa-chevron-left):not(.fa-chevron-right) {
    font-size: 1.25rem !important;
    margin: 0 !important;
}

.sidebar-collapsed + #mainContent {
    width: calc(100% - 60px);
    max-width: calc(100% - 60px);
    flex: 0 0 calc(100% - 60px);
}

.sidebar-collapsed #sidebarCollapseBtn i {
    transform: rotate(180deg);
}

/* 过渡效果 */
.sidebar,
#mainContent,
.sidebar span,
.sidebar .nav-link,
.sidebar i,
#sidebarCollapseBtn i {
    transition: all 0.3s ease;
}

/* 侧边栏折叠按钮样式 */
#sidebarCollapseBtn {
    position: fixed; /* 添加此行以固定按钮位置 */
    top: 10px;
    right: -15px;
    z-index: 1060;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 侧边栏样式优化 */
.sidebar {
    transition: all 0.3s ease;
    position: relative;
}

/* 侧边栏顶部导航切换按钮样式 */
.sidebar .d-flex.justify-content-end {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1050; /* 提高z-index确保在顶部导航栏之上 */
    padding: 0.5rem;
    display: flex !important; /* 确保按钮显示 */
}

/* 移动设备下的侧边栏样式 */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 56px; /* 导航栏高度 */
        left: 0;
        width: 250px;
        height: calc(100% - 56px);
        z-index: 1030;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    /* 确保导航切换按钮在移动设备上可见 */
    .navbar-toggler {
        display: block !important; /* 强制显示 */
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 1050 !important; /* 确保在移动设备上有较高的z-index */
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* 当侧边栏显示时添加遮罩 */
    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1020;
    }
}

/* 导航菜单项样式 */
.nav-link {
    transition: all 0.2s ease;
    border-radius: 0.25rem;
}

.nav-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

/* 确保主菜单项的图标与文本间距一致 */
.navbar-nav > .nav-item > .nav-link i.fas {
    width: 1.25rem;
    text-align: center;
    margin-right: 0.75rem;
}

/* 子菜单项样式 - 确保水平对齐 */
.collapse .nav-link {
    padding-left: 2.5rem !important;
    padding-right: 1rem !important;
}

/* 确保子菜单图标与文本对齐 */
.collapse .nav-link i {
    width: 1.25rem;
    text-align: center;
    margin-right: 0.75rem;
}

/* 确保所有菜单项的图标宽度一致 */
.navbar-nav .nav-link i.fas {
    width: 1.25rem;
    text-align: center;
}

/* 确保主菜单和子菜单的内容对齐 */
.navbar-nav > .nav-item > .nav-link,
.collapse .nav-link {
    display: flex;
    align-items: center;
}

/* 菜单展开/折叠图标动画 */
.transition-transform {
    transition: transform 0.3s ease;
}

.rotate-180 {
    transform: rotate(180deg);
}

/* 通知徽章样式 */
.notification-badge:empty {
    display: none;
}

/* 用户头像占位符样式 */
.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #0d6efd;
    color: white;
    border-radius: 50%;
}

/* 下拉菜单样式优化 */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

/* 活动菜单项样式 */
.nav-link.active {
    font-weight: 500;
}

/* 移动设备下的主内容区域调整 */
@media (max-width: 767.98px) {
    main {
        margin-left: 0 !important;
    }
}

/* 通知下拉菜单样式 */
.notification-dropdown {
    width: 320px;
    max-width: 100vw;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

/* 改进的导航栏品牌样式 */
.navbar-brand {
    display: flex;
    align-items: center;
}

/* 改进的页脚样式 */
.footer {
    font-size: 0.875rem;
}