
/* ============================================================
   侧边栏折叠 + 悬浮把手 + 顶栏间距（2026-10-17）
   ============================================================ */

/* ---- 宽度变量 ---- */
body { --sb-width: 260px; }
body.sidebar-collapsed { --sb-width: 60px; }

/* ---- 骨架 / 侧边栏 / 主内容区 跟随宽度 ---- */
body::before {
    width: var(--sb-width) !important;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.sidebar {
    width: var(--sb-width) !important;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.main-content {
    margin-left: var(--sb-width) !important;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ---- 悬浮把手（贴在侧边栏右边缘，垂直居中） ---- */
.sidebar-toggle-handle {
    position: fixed !important;
    left: var(--sb-width) !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 22px !important;
    height: 60px !important;
    border-radius: 0 22px 22px 0 !important;
    background: linear-gradient(135deg, #3498db 0%, #4facfe 100%) !important;
    color: #fff !important;
    border: 1px solid rgba(79, 172, 254, 0.4) !important;
    border-left: none !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 0 !important;
    z-index: 200 !important;
    box-shadow: 4px 0 14px rgba(52, 152, 219, 0.45), inset -1px 0 0 rgba(255,255,255,0.2) !important;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    outline: none !important;
}
.sidebar-toggle-handle:hover {
    width: 26px !important;
    background: linear-gradient(135deg, #4facfe 0%, #667eea 100%) !important;
    box-shadow: 6px 0 20px rgba(79, 172, 254, 0.7), inset -1px 0 0 rgba(255,255,255,0.3) !important;
}
.sidebar-toggle-handle:active {
    transform: translate(-50%, -50%) scale(0.95) !important;
}
.sidebar-toggle-handle span {
    display: block;
    line-height: 1;
    font-family: 'Consolas', monospace;
    transform: translateX(-1px);
}

/* ---- 折叠态：隐藏文字和折叠符 ---- */
body.sidebar-collapsed .sidebar .group-name,
body.sidebar-collapsed .sidebar .menu-text,
body.sidebar-collapsed .sidebar .st-main,
body.sidebar-collapsed .sidebar .st-sub,
body.sidebar-collapsed .sidebar .collapse-symbol {
    display: none !important;
}

/* ---- 折叠态：header 简化，logo 居中放大 ---- */
body.sidebar-collapsed .sidebar .sidebar-header {
    padding: 16px 0 !important;
    justify-content: center !important;
    border-bottom: 1px solid rgba(52, 152, 219, 0.3) !important;
    background: linear-gradient(180deg, rgba(52, 152, 219, 0.15) 0%, transparent 100%) !important;
    position: relative !important;
}
body.sidebar-collapsed .sidebar .sidebar-header::after {
    content: '' !important;
    position: absolute !important;
    bottom: -1px !important;
    left: 20% !important;
    right: 20% !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent, #4facfe, transparent) !important;
    box-shadow: 0 0 8px rgba(79, 172, 254, 0.8) !important;
}
body.sidebar-collapsed .sidebar .sidebar-logo {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    border-radius: 12px !important;
    box-shadow:
        0 0 20px rgba(79, 172, 254, 0.7),
        0 0 40px rgba(79, 172, 254, 0.3),
        inset 0 0 12px rgba(255, 255, 255, 0.3) !important;
    animation: logoPulse 3s ease-in-out infinite !important;
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(79,172,254,0.7), 0 0 40px rgba(79,172,254,0.3), inset 0 0 12px rgba(255,255,255,0.3); }
    50%      { box-shadow: 0 0 26px rgba(79,172,254,1),   0 0 52px rgba(79,172,254,0.55), inset 0 0 14px rgba(255,255,255,0.5); }
}

/* ---- 折叠态：隐藏二级/三级分组（点击把手展开看） ---- */
body.sidebar-collapsed .sidebar .menu-group-items,
body.sidebar-collapsed .sidebar .menu-subgroup {
    display: none !important;
}

/* ---- 折叠态：所有菜单项变成 44×44 圆角方块（图标居中）---- */
body.sidebar-collapsed .sidebar .menu-group,
body.sidebar-collapsed .sidebar .menu-subgroup {
    padding: 6px 0 !important;
    position: relative !important;
}
body.sidebar-collapsed .sidebar .menu-group::after {
    content: '' !important;
    position: absolute !important;
    left: 30% !important; right: 30% !important;
    bottom: 0 !important; height: 1px !important;
    background: linear-gradient(90deg, transparent, rgba(52, 152, 219, 0.25), transparent) !important;
}

body.sidebar-collapsed .sidebar .menu-group-title,
body.sidebar-collapsed .sidebar .menu-subgroup-title,
body.sidebar-collapsed .sidebar a.menu-item,
body.sidebar-collapsed .sidebar a.menu-item.menu-item-top {
    width: 44px !important;
    height: 44px !important;
    margin: 4px auto !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: rgba(52, 152, 219, 0.08) !important;
    border-left: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    transition: all 0.2s !important;
}
body.sidebar-collapsed .sidebar a.menu-item.menu-item-top::before,
body.sidebar-collapsed .sidebar a.menu-item::before,
body.sidebar-collapsed .sidebar a.menu-item.active::after {
    display: none !important;
}

body.sidebar-collapsed .sidebar .menu-icon {
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
    opacity: 1 !important;
    color: #7dd3fc !important;
    filter:
        drop-shadow(0 0 4px rgba(125, 211, 252, 0.8))
        drop-shadow(0 0 10px rgba(52, 152, 219, 0.4)) !important;
}

/* hover 态：淡蓝底 + 亮白光 */
body.sidebar-collapsed .sidebar .menu-group-title:hover,
body.sidebar-collapsed .sidebar .menu-subgroup-title:hover,
body.sidebar-collapsed .sidebar a.menu-item:hover,
body.sidebar-collapsed .sidebar a.menu-item.menu-item-top:hover {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.4), rgba(79, 172, 254, 0.2)) !important;
    box-shadow:
        0 0 16px rgba(79, 172, 254, 0.5),
        inset 0 0 8px rgba(255, 255, 255, 0.1) !important;
}
body.sidebar-collapsed .sidebar .menu-group-title:hover .menu-icon,
body.sidebar-collapsed .sidebar .menu-subgroup-title:hover .menu-icon,
body.sidebar-collapsed .sidebar a.menu-item:hover .menu-icon {
    color: #fff !important;
    filter:
        drop-shadow(0 0 8px rgba(255, 255, 255, 0.9))
        drop-shadow(0 0 16px rgba(125, 211, 252, 0.6)) !important;
    transform: scale(1.1);
}

/* active 态：蓝渐变 + 强发光 */
body.sidebar-collapsed .sidebar a.menu-item.active {
    background: linear-gradient(135deg, #3498db 0%, #4facfe 100%) !important;
    box-shadow:
        0 0 20px rgba(79, 172, 254, 0.8),
        0 0 40px rgba(79, 172, 254, 0.35),
        inset 0 0 12px rgba(255, 255, 255, 0.25) !important;
}
body.sidebar-collapsed .sidebar a.menu-item.active .menu-icon {
    color: #fff !important;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9)) !important;
}

/* ============================================================
   顶栏右侧间距优化
   ============================================================ */
.topbar {
    padding: 0 32px !important;
}
.topbar .lang-switch {
    margin-right: 28px !important;
    gap: 8px !important;
}
.topbar .lang-switch .lang-select {
    padding: 6px 28px 6px 12px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
}
.topbar .user-info {
    margin-right: 28px !important;
    padding: 6px 0 !important;
    font-size: 14px !important;
    color: #cbd5e1 !important;
    letter-spacing: 0.5px;
}
.topbar .logout-btn {
    padding: 8px 20px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(52, 152, 219, 0.25);
}
.topbar .logout-btn:hover {
    border-color: rgba(52, 152, 219, 0.6);
    background: rgba(52, 152, 219, 0.2) !important;
}

@media (min-width: 1600px) {
    .topbar { padding: 0 40px !important; }
    .topbar .lang-switch { margin-right: 36px !important; }
    .topbar .user-info { margin-right: 36px !important; }
}
/* ============================================================
   页面启动遮罩：避免菜单/布局首次渲染前的闪烁（FOUC）
   由各页 <head> 内联脚本加 html.pc-boot，menu.js 渲染完成后移除
   ============================================================ */
html.pc-boot body { visibility: hidden !important; }
html.pc-boot::before {
    content: '';
    position: fixed;
    inset: 0;
    background: #f5f6fa;
    z-index: 99998;
}
html.pc-boot::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid #dbe6f0;
    border-top-color: #3498db;
    border-radius: 50%;
    z-index: 99999;
    animation: pcSpin .8s linear infinite;
}
@keyframes pcSpin { to { transform: rotate(360deg); } }
body.pc-ready { animation: pcFadeIn .18s ease; }
@keyframes pcFadeIn { from { opacity: .35; } to { opacity: 1; } }
