/* =========================================================
   ARZAN 代理端最终菜单定位修复
   目标：所有页面点击后菜单位置完全一致，不再跟随不同页面布局左右跳动
========================================================= */

:root{
    --hf-side-w: 220px;
    --hf-side-left: 54px;
    --hf-side-top: 96px;
    --hf-content-left: 300px;
}

/* 页面底色统一 */
body.agent-unified-page{
    min-height:100vh !important;
    background:#f3f5f1 !important;
    overflow-x:hidden !important;
}

/* 只保留最终菜单 */
body.agent-unified-page .sidebar:not(#hfFinalSidebar),
body.agent-unified-page .agent-sidebar:not(#hfFinalSidebar),
body.agent-unified-page .admin-side:not(#hfFinalSidebar),
body.agent-unified-page .side-nav{
    display:none !important;
}

/* 最终菜单固定在屏幕左侧，不受任何父级 flex/grid/transform 影响 */
body.agent-unified-page #hfFinalSidebar{
    position:fixed !important;
    left:var(--hf-side-left) !important;
    top:var(--hf-side-top) !important;
    bottom:auto !important;

    width:var(--hf-side-w) !important;
    min-width:var(--hf-side-w) !important;
    max-width:var(--hf-side-w) !important;
    height:auto !important;
    max-height:calc(100vh - var(--hf-side-top) - 28px) !important;

    overflow-y:auto !important;
    overflow-x:hidden !important;

    margin:0 !important;
    padding:18px 14px !important;
    box-sizing:border-box !important;

    border-radius:24px !important;
    background:linear-gradient(180deg,#24201f 0%,#171615 100%) !important;
    border:1px solid rgba(255,255,255,.06) !important;
    box-shadow:0 22px 55px rgba(20,18,16,.22) !important;

    z-index:9999 !important;
    flex:none !important;
    transform:none !important;
}

/* 菜单内部统一 */
body.agent-unified-page #hfFinalSidebar,
body.agent-unified-page #hfFinalSidebar *{
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Arial,sans-serif !important;
}

body.agent-unified-page #hfFinalSidebar::-webkit-scrollbar{
    width:0 !important;
    height:0 !important;
}

body.agent-unified-page #hfFinalSidebar .hf-brand{
    padding:12px 10px 16px !important;
    margin:0 0 12px !important;
    border-bottom:1px solid rgba(255,255,255,.08) !important;
}

body.agent-unified-page #hfFinalSidebar .hf-brand-name{
    font-size:19px !important;
    line-height:1.25 !important;
    font-weight:950 !important;
    color:#fff !important;
}

body.agent-unified-page #hfFinalSidebar .hf-brand-sub{
    margin-top:5px !important;
    font-size:12px !important;
    line-height:1.3 !important;
    color:rgba(255,255,255,.52) !important;
}

body.agent-unified-page #hfFinalSidebar .hf-menu-group{
    margin-top:12px !important;
    padding:0 !important;
}

body.agent-unified-page #hfFinalSidebar .hf-menu-title{
    padding:0 10px 7px !important;
    font-size:11px !important;
    line-height:1.2 !important;
    font-weight:900 !important;
    color:rgba(255,255,255,.34) !important;
    background:transparent !important;
}

body.agent-unified-page #hfFinalSidebar .hf-menu-item{
    width:100% !important;
    height:40px !important;
    min-height:40px !important;
    display:flex !important;
    align-items:center !important;
    gap:9px !important;
    margin:4px 0 !important;
    padding:0 11px !important;
    box-sizing:border-box !important;
    border-radius:13px !important;
    border:1px solid transparent !important;
    background:transparent !important;
    color:rgba(255,255,255,.72) !important;
    text-decoration:none !important;
    font-size:13px !important;
    line-height:40px !important;
    font-weight:850 !important;
    box-shadow:none !important;
    transform:none !important;
}

body.agent-unified-page #hfFinalSidebar .hf-menu-item:hover{
    background:rgba(255,255,255,.08) !important;
    color:#fff !important;
}

body.agent-unified-page #hfFinalSidebar .hf-menu-item.active,
body.agent-unified-page #hfFinalSidebar .hf-menu-item.active:hover{
    color:#fff !important;
    background:linear-gradient(135deg,#f08b45 0%,#d85836 100%) !important;
    box-shadow:0 10px 24px rgba(216,88,54,.28) !important;
}

body.agent-unified-page #hfFinalSidebar .hf-menu-icon{
    width:18px !important;
    min-width:18px !important;
    height:18px !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    font-size:13px !important;
    line-height:18px !important;
    color:inherit !important;
    opacity:.9 !important;
}

body.agent-unified-page #hfFinalSidebar .hf-menu-text{
    flex:1 !important;
    min-width:0 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    font-size:13px !important;
    line-height:40px !important;
    font-weight:850 !important;
    color:inherit !important;
}

/* 内容区域统一右移：兼容不同页面的不同容器 */
body.agent-unified-page .page-shell,
body.agent-unified-page .agent-layout,
body.agent-unified-page .admin-shell,
body.agent-unified-page .page-dashboard{
    width:auto !important;
    max-width:none !important;
    margin-left:var(--hf-content-left) !important;
    margin-right:34px !important;
    padding-left:0 !important;
    box-sizing:border-box !important;
}

/* 避免父级 flex 把菜单挤来挤去 */
body.agent-unified-page #hfFinalSidebar + .agent-content,
body.agent-unified-page #hfFinalSidebar + .agent-main,
body.agent-unified-page #hfFinalSidebar + .admin-main,
body.agent-unified-page .agent-content,
body.agent-unified-page .agent-main,
body.agent-unified-page .admin-main{
    flex:1 1 auto !important;
    min-width:0 !important;
    width:100% !important;
}

/* 防止某些页面自己给主内容又加大左边距 */
body.agent-unified-page .page-dashboard{
    display:block !important;
}

body.agent-unified-page .agent-layout,
body.agent-unified-page .admin-shell{
    display:block !important;
}

/* 小屏隐藏侧边栏 */
@media(max-width:980px){
    body.agent-unified-page #hfFinalSidebar{
        display:none !important;
    }

    body.agent-unified-page .page-shell,
    body.agent-unified-page .agent-layout,
    body.agent-unified-page .admin-shell,
    body.agent-unified-page .page-dashboard{
        margin-left:0 !important;
        margin-right:0 !important;
        padding:14px !important;
    }
}
