文件
mashangyoujiu/Public/Retail/css/bs5-admin-sidebar.css

231 行
3.9 KiB
CSS
可执行文件

/* Bootstrap 5 后台管理系统 - 侧边栏样式 */
.sidebar {
position: fixed;
top: 0;
left: 0;
width: var(--sidebar-width);
height: 100vh;
background: linear-gradient(180deg, var(--admin-bg-sidebar) 0%, var(--admin-bg-sidebar-dark) 100%);
color: var(--admin-text-white);
z-index: 1000;
transition: all 0.3s ease;
overflow-y: auto;
overflow-x: hidden;
display: flex;
flex-direction: column;
}
.sidebar.collapsed {
width: var(--sidebar-collapsed-width);
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .user-details {
opacity: 0;
visibility: hidden;
}
.sidebar.collapsed .sidebar-brand {
justify-content: center;
}
.sidebar.collapsed .nav-link {
justify-content: center;
padding-left: 1rem;
padding-right: 1rem;
}
/* 侧边栏头部 */
.sidebar-header {
padding: 1.5rem 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-brand {
display: flex;
align-items: center;
text-decoration: none;
color: var(--admin-text-white);
transition: all 0.3s ease;
}
.sidebar-logo {
width: 40px;
height: 40px;
border-radius: 0.5rem;
object-fit: cover;
margin-right: 0.75rem;
flex-shrink: 0;
}
.sidebar-brand-text {
transition: all 0.3s ease;
}
.brand-name {
font-size: 1.125rem;
font-weight: 700;
line-height: 1.2;
margin-bottom: 2px;
}
.brand-subtitle {
font-size: 0.75rem;
opacity: 0.7;
line-height: 1;
}
/* 侧边栏菜单 */
.sidebar-menu {
flex: 1;
padding: 1rem 0;
}
.sidebar-menu .nav {
padding: 0 0.5rem;
}
.sidebar-menu .nav-item {
margin-bottom: 0.25rem;
}
.sidebar-menu .nav-link {
display: flex;
align-items: center;
padding: 0.75rem 1rem;
color: rgba(255, 255, 255, 0.8);
text-decoration: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
position: relative;
font-size: 0.875rem;
font-weight: 500;
}
.sidebar-menu .nav-link:hover {
background-color: rgba(255, 255, 255, 0.1);
color: var(--admin-text-white);
transform: translateX(2px);
}
.sidebar-menu .nav-link.active {
background-color: var(--admin-primary);
color: var(--admin-text-white);
box-shadow: var(--admin-shadow-md);
}
.nav-icon {
width: 20px;
height: 20px;
margin-right: 0.75rem;
flex-shrink: 0;
font-size: 1.125rem;
}
.nav-icon-sub {
width: 16px;
height: 16px;
margin-right: 0.75rem;
flex-shrink: 0;
font-size: 0.875rem;
}
.nav-text {
flex: 1;
transition: all 0.3s ease;
}
.nav-arrow {
margin-left: auto;
transition: transform 0.3s ease;
font-size: 0.75rem;
}
.nav-link[aria-expanded="true"] .nav-arrow {
transform: rotate(180deg);
}
/* 子菜单 */
.submenu {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 0.5rem;
margin: 0.25rem 0;
padding: 0.5rem 0;
}
.submenu .nav-link {
padding: 0.5rem 1.5rem;
font-size: 0.8125rem;
margin-bottom: 2px;
}
.submenu .nav-link:hover {
background-color: rgba(255, 255, 255, 0.05);
}
.submenu .nav-link.active {
background-color: var(--admin-primary-light);
}
/* 侧边栏底部 */
.sidebar-footer {
padding: 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.user-info {
display: flex;
align-items: center;
padding: 0.75rem;
background-color: rgba(255, 255, 255, 0.05);
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.user-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
margin-right: 0.75rem;
flex-shrink: 0;
}
.user-avatar img {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
}
.user-details {
flex: 1;
transition: all 0.3s ease;
}
.user-name {
font-size: 0.875rem;
font-weight: 600;
line-height: 1.2;
margin-bottom: 2px;
}
.user-role {
font-size: 0.75rem;
opacity: 0.7;
line-height: 1;
}
/* 响应式 */
@media (max-width: 767.98px) {
.sidebar {
transform: translateX(-100%);
width: var(--sidebar-width);
}
.sidebar.show {
transform: translateX(0);
}
}