/* ==========================================================================
   左侧导航栏 · 纯列表版（点击就地展开）
   一行一个平台名 + 右侧浅灰三角，无色条 / 无标题栏 / 无搜索框
   本文件是侧边栏样式与主内容区避让的唯一权威来源
   ========================================================================== */

/* 主内容区避让
   ① 左侧避让固定侧边栏：margin-left 与 width 必须成对给出，
      只给 margin-left 时，页面或子元素一旦有 width:100% 就总宽 = 100% + 侧栏宽 → 右侧溢出。
   ② 顶部避让固定横幅（.site-banner，position:fixed; height:55px）：
      用 padding-top 而不是 margin-top —— margin-top 会让 .main-content 自身被下推 55px，
      叠加 min-height:100vh 会导致页面总高多出 55px 出现第二条滚动条；
      padding-top 则是内容内缩，盒子高度不变，且背景色能铺到横幅下方。 */
.main-content {
    --nav-w: 170px;
    --nav-top: 55px;
    margin-left: var(--nav-w);
    width: calc(100% - var(--nav-w));
    max-width: calc(100% - var(--nav-w));
    padding-top: var(--nav-top);
    box-sizing: border-box;
    transition: margin-left .18s ease, width .18s ease;
}

.sidebar {
    --nav-w: 170px;
    --nav-row-h: 52px;
    --nav-text: #2f4858;
    --nav-caret: #c6ccd4;
    --nav-hover: #f5f7f9;
    --nav-open-bg: #e8f6ec;/* 展开态淡绿底 */
    --nav-open-text: #1e3a2a;
    position: fixed;
    left: 0;
    top: 55px;
    bottom: 0;
    width: var(--nav-w);
    background: #fff;
    z-index: 1000;
    overflow: hidden;   /* 二级菜单已改为行内展开，不再有浮层，可以安全裁剪 */
}

/* 导航列表：自身滚动，宽度不超侧栏，避免横向溢出 */
.sidebar-nav {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0 24px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #e2e6ea;
    border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

/* --- 一级菜单行 --- */
.nav-item {
    position: relative;
}

.nav-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: var(--nav-row-h);
    padding: 0 20px;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    color: var(--nav-text);
    text-align: left;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.nav-row:hover {
    background: var(--nav-hover);
    color: #1b2f42;
}

/* 平台名 */
.nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 右侧展开三角：浅灰实心下三角 */
.nav-caret {
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--nav-caret);
    transition: transform .16s ease;
}

.nav-item.is-open .nav-caret {
    transform: rotate(180deg);
    border-top-color: #7a8b7f;
}

/* 展开中：淡绿底 + 深绿字（对应参考图） */
.nav-item.is-open > .nav-row {
    background: var(--nav-open-bg);
    color: var(--nav-open-text);
    font-weight: 600;
}

/* 当前所在平台（未展开时也标出） */
.nav-item.is-active:not(.is-open) > .nav-row {
    background: var(--nav-hover);
    color: #14283a;
    font-weight: 600;
}

/* --- 二级菜单：点击一级后就在其下方就地展开 --- */
.nav-panel {
    padding: 2px 0 6px;
    background: transparent;
}

.nav-panel[hidden] { display: none; }

.nav-sub {
    display: block;
    height: 46px;
    line-height: 46px;
    padding: 0 20px 0 34px;
    font-size: 15px;
    color: var(--nav-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .1s, color .1s;
}

.nav-sub:hover {
    background: #f2f5f7;
    color: #1b2f42;
}

.nav-sub.is-active {
    background: #f2f5f7;
    color: #14283a;
    font-weight: 600;
}

/* 移动端：同样就地展开，仅缩小尺寸。
   手机屏幕窄，侧栏占 1/3 会把右侧内容挤没，故这里压到 84px。 */
@media (max-width: 768px) {
    .main-content {
        --nav-w: 84px;
        margin-left: var(--nav-w);
        width: calc(100% - var(--nav-w));
        max-width: calc(100% - var(--nav-w));
    }

    .sidebar {
        --nav-w: 84px;
        --nav-row-h: 42px;
    }

    .sidebar-nav { padding: 6px 0 20px; }

    .nav-row {
        padding: 0 6px;
        font-size: 13px;
        gap: 3px;
    }

    .nav-caret {
        border-left-width: 4px;
        border-right-width: 4px;
        border-top-width: 5px;
    }

    .nav-sub {
        height: 36px;
        line-height: 36px;
        padding: 0 6px 0 14px;
        font-size: 12.5px;
    }
}
