/* GX-WMS 左侧侧边栏导航样式 */ :root { --sidebar-width: 240px; --sidebar-collapsed: 60px; } body.with-sidebar { padding-left: var(--sidebar-width); transition: padding-left .25s ease; } body.sidebar-collapsed.with-sidebar { padding-left: var(--sidebar-collapsed); } #sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-width); background: #1e293b; color: #cbd5e1; overflow-y: auto; box-shadow: 2px 0 8px rgba(0,0,0,.08); z-index: 1000; font-family: 'Microsoft YaHei','PingFang SC',sans-serif; transition: width .25s ease; } body.sidebar-collapsed #sidebar { width: var(--sidebar-collapsed); } #sidebar::-webkit-scrollbar { width: 6px; } #sidebar::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; } #sidebar::-webkit-scrollbar-track { background: transparent; } /* 收缩按钮 */ .sidebar-toggle { position: absolute; top: 16px; right: 10px; width: 26px; height: 26px; border: none; border-radius: 4px; background: transparent; color: #94a3b8; font-size: 15px; cursor: pointer; z-index: 10; display: flex; align-items: center; justify-content: center; transition: all .15s; } .sidebar-toggle:hover { background: #334155; color: #fff; } body.sidebar-collapsed .sidebar-toggle { right: 17px; } /* 用户信息区 */ .sidebar-user { display: flex; align-items: center; gap: 10px; padding: 16px 14px; border-bottom: 1px solid #334155; background: #0f172a; } .sidebar-user .avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg,#3b82f6,#1d4ed8); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; flex-shrink: 0; } .sidebar-user .user-text { flex: 1; min-width: 0; } .sidebar-user .user-name { font-size: 14px; color: #e2e8f0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .sidebar-user .user-action { font-size: 12px; margin-top: 2px; } .sidebar-user .user-action a { color: #94a3b8; text-decoration: none; } .sidebar-user .user-action a:hover { color: #60a5fa; } /* 菜单容器 */ .sidebar-menu { padding: 8px 0; } /* 分组标题(可折叠) */ .menu-group-title { display: flex; align-items: center; padding: 11px 16px; cursor: pointer; font-size: 14px; color: #cbd5e1; user-select: none; transition: background .15s; } .menu-group-title:hover { background: #334155; color: #fff; } .menu-group-title .menu-icon { width: 22px; font-size: 16px; flex-shrink: 0; text-align: center; } .menu-group-title .menu-label { flex: 1; margin-left: 10px; } .menu-group-title .menu-arrow { font-size: 11px; color: #64748b; transition: transform .2s; } .menu-arrow.rotate { transform: rotate(-180deg); color: #94a3b8; } .menu-group.expanded > .menu-group-title { background: #334155; color: #fff; } /* 子菜单容器 */ .menu-children { max-height: 0; overflow: hidden; transition: max-height .25s ease; background: #0f172a; } .menu-group.expanded > .menu-children { max-height: 1200px; } /* 子菜单项 */ .menu-child { display: flex; align-items: center; padding: 9px 16px 9px 44px; color: #94a3b8; text-decoration: none; font-size: 13px; transition: all .15s; border-left: 3px solid transparent; } .menu-child:hover { background: #1e293b; color: #e2e8f0; } .menu-child.active { background: #1e3a8a; color: #fff; border-left-color: #3b82f6; font-weight: 500; } .menu-child-dot { width: 14px; color: #475569; font-size: 16px; flex-shrink: 0; } .menu-child.active .menu-child-dot { color: #60a5fa; } /* ===== 子分组(多级菜单,支持任意层级) ===== */ .menu-subgroup-title { display: flex; align-items: center; padding: 10px 16px 10px 22px; color: #94a3b8; cursor: pointer; font-size: 13px; transition: all .15s; } .menu-subgroup-title:hover { background: #334155; color: #fff; } .menu-subgroup-title .menu-icon { width: 20px; font-size: 14px; text-align: center; } .menu-subgroup-title .menu-label { flex: 1; margin-left: 8px; } .menu-subgroup-title .menu-arrow { font-size: 10px; color: #64748b; margin-right: 10px; transition: transform .2s; } .menu-subgroup-children { max-height: 0; overflow: hidden; transition: max-height .25s ease; } .menu-subgroup.expanded > .menu-subgroup-children { max-height: 1000px; } /* 多级缩进:按层级加深 */ .menu-child[data-depth="2"] { padding-left: 58px; } .menu-child[data-depth="3"] { padding-left: 72px; } .menu-child[data-depth="4"] { padding-left: 86px; } .menu-subgroup-title[data-depth="2"] { padding-left: 34px; } .menu-subgroup-title[data-depth="3"] { padding-left: 48px; } .menu-subgroup-title[data-depth="4"] { padding-left: 62px; } /* 单项菜单(无子项) */ .menu-single { display: flex; align-items: center; padding: 11px 16px; color: #cbd5e1; text-decoration: none; font-size: 14px; transition: background .15s; border-left: 3px solid transparent; } .menu-single:hover { background: #334155; color: #fff; } .menu-single.active { background: #1e3a8a; color: #fff; border-left-color: #3b82f6; font-weight: 500; } .menu-single .menu-icon { width: 22px; font-size: 16px; flex-shrink: 0; text-align: center; } .menu-single .menu-label { margin-left: 10px; } /* ===== 折叠状态(只显示图标) ===== */ body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 16px 0; } body.sidebar-collapsed .sidebar-user .avatar { width: 34px; height: 34px; font-size: 14px; } body.sidebar-collapsed .sidebar-user .user-text { display: none; } body.sidebar-collapsed .menu-group-title { justify-content: center; padding: 13px 0; } body.sidebar-collapsed .menu-group-title .menu-label { display: none; } body.sidebar-collapsed .menu-group-title .menu-arrow { display: none; } body.sidebar-collapsed .menu-group-title .menu-icon { width: auto; } body.sidebar-collapsed .menu-children { display: none; } body.sidebar-collapsed .menu-single { justify-content: center; padding: 13px 0; } body.sidebar-collapsed .menu-single .menu-label { display: none; } body.sidebar-collapsed .menu-single .menu-icon { width: auto; } /* 折叠时菜单项 hover 提示 */ body.sidebar-collapsed .menu-group-title { position: relative; } body.sidebar-collapsed .menu-group-title:hover::after { content: attr(data-title); position: absolute; left: calc(var(--sidebar-collapsed) + 8px); top: 50%; transform: translateY(-50%); background: #0f172a; color: #e2e8f0; padding: 6px 12px; border-radius: 6px; font-size: 13px; white-space: nowrap; z-index: 1001; box-shadow: 0 4px 12px rgba(0,0,0,.3); pointer-events: none; } body.sidebar-collapsed .menu-single { position: relative; } body.sidebar-collapsed .menu-single:hover::after { content: attr(data-title); position: absolute; left: calc(var(--sidebar-collapsed) + 8px); top: 50%; transform: translateY(-50%); background: #0f172a; color: #e2e8f0; padding: 6px 12px; border-radius: 6px; font-size: 13px; white-space: nowrap; z-index: 1001; box-shadow: 0 4px 12px rgba(0,0,0,.3); pointer-events: none; }