/* ==========================================================================
   左侧导航栏 · 分组卡片版（2026-11-02 视觉改版 B）
   浅灰底上一张张白色卡片，每个平台一张；展开内容留在卡片内。
   本文件是侧边栏样式与主内容区避让的唯一权威来源。
   ========================================================================== */

/* 主内容区避让
   ① 左侧避让固定侧边栏：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: 42px;
    --nav-text: #3d4a5c;
    --nav-text-strong: #1b2430;
    --nav-caret: #c2cad4;
    --nav-accent: #486df1;
    --nav-accent-text: #3355d8;
    --nav-card-bg: #ffffff;
    --nav-card-border: #e6ebf2;
    position: fixed;
    left: 0;
    top: 55px;
    bottom: 0;
    width: var(--nav-w);
    /* 2026-11-02：底色加深一档，让白色卡片明显浮起来 */
    background: #e6ebf1;
    border-right: 1px solid #dbe2ea;
    box-sizing: border-box;
    z-index: 1000;
    overflow: hidden;
}

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

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

/* --- 一级菜单：整张卡片 --- */
.sidebar-nav .nav-item {
    margin: 0 9px 6px;
    background: var(--nav-card-bg);
    border: 1px solid var(--nav-card-border);
    border-radius: 11px;
    overflow: hidden;
    transition: border-color .14s, background .14s;
}

.sidebar-nav .nav-item:hover {
    border-color: #d9e1eb;
}

.sidebar-nav .nav-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: var(--nav-row-h);
    /* mobile-compact.css 有全局 a/button{min-height:44px}（iOS 触摸区），
       不加这句桌面端会被从 42 撑到 44、手机端从 34 撑到 44 */
    min-height: var(--nav-row-h);
    padding: 0 10px;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: var(--nav-text);
    text-align: left;
    cursor: pointer;
    transition: color .14s;
}

/* 平台名 */
/* 叶子分类（没有子项，整行直接跳分类页）：样式与可展开的按钮一致 */
.sidebar-nav a.nav-row {
    text-decoration: none;
}

.sidebar-nav .nav-caret-link {
    border-color: #ccd3dc;
}

.sidebar-nav .nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* 2026-11-02：一级分类加粗，便于和二级/正文区分 */
    font-weight: 600;
    color: #2b3648;
    letter-spacing: .2px;
}

/* 右侧箭头：细线 V 形，展开时翻转朝下 */
.sidebar-nav .nav-caret {
    flex: none;
    width: 5px;
    height: 5px;
    margin: 0 2px 0 0;
    border-right: 1.5px solid var(--nav-caret);
    border-bottom: 1.5px solid var(--nav-caret);
    transform: rotate(-45deg);
    transition: transform .18s ease, border-color .18s ease;
}

/* 当前所在平台 / 已展开：整行实心底 + 白字（2026-11-12 改成与页头同色的品牌蓝 #486df1） */
.sidebar-nav .nav-item.is-active,
.sidebar-nav .nav-item.is-open {
    border-color: var(--nav-accent);
    background: #fff;
}

.sidebar-nav .nav-item.is-active > .nav-row,
.sidebar-nav .nav-item.is-open > .nav-row {
    background: var(--nav-accent);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-nav .nav-item.is-active > .nav-row .nav-label,
.sidebar-nav .nav-item.is-open > .nav-row .nav-label {
    color: #ffffff;
}

.sidebar-nav .nav-item.is-active > .nav-row .nav-caret,
.sidebar-nav .nav-item.is-open > .nav-row .nav-caret {
    border-color: #ffffff;
}

/* 实心蓝底上再 hover，稍微压深一点，避免“点了没反应”的错觉 */
.sidebar-nav .nav-item.is-active > .nav-row:hover,
.sidebar-nav .nav-item.is-open > .nav-row:hover {
    background: #3355d8;
}

.sidebar-nav .nav-item.is-open .nav-caret {
    transform: rotate(45deg);
}

/* --- 二级菜单：就在卡片内，与一级之间一条细分割线 --- */
.sidebar-nav .nav-panel {
    /* 左右不再留内边距：子项自己带 padding，分隔线才能真正贯穿卡片 */
    padding: 1px 0 3px;
    background: transparent;
    border-top: 1px solid #f0f3f7;
}

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

.sidebar-nav .nav-sub {
    position: relative;
    display: block;
    padding: 5px 10px;
    /* 同上：不压掉全局 min-height:44px，每个子项会白多 16px */
    min-height: 0;
    font-size: 13px;
    color: #7b8798;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .1s;
}

/* 2026-11-02：子项之间用细线隔开，形成逐行列表（首行不加线） */
.sidebar-nav .nav-sub + .nav-sub {
    border-top: 1px solid #e7ecf3;
}

.sidebar-nav .nav-sub:hover {
    color: var(--nav-text-strong);
}

.sidebar-nav .nav-sub.is-active {
    color: var(--nav-accent-text);
    font-weight: 500;
}

/* 移动端：侧栏压到 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;
        /* 2026-11-07：40px → 34px。12.5px 字号配 40px 行高，上下各空 14px，
           手机上 10 个分类要多滑一屏，压到 34px（上下各 10px）更利落。 */
        --nav-row-h: 34px;
    }

    .sidebar-nav { padding: 7px 0 14px; }

    .sidebar-nav .nav-item {
        margin: 0 4px 4px;
        border-radius: 9px;
    }

    .sidebar-nav .nav-row {
        gap: 3px;
        padding: 0 6px;
        font-size: 12.5px;
        /* mobile-compact.css 给所有 a/button 设了 min-height:44px（iOS 触摸区），
           光改 --nav-row-h 会被它撑回 44px，这里必须显式压掉。 */
        min-height: var(--nav-row-h);
    }

    .sidebar-nav .nav-caret {
        width: 4px;
        height: 4px;
        margin-right: 0;
    }

    .sidebar-nav .nav-panel {
        padding: 2px 0 3px;
    }

    .sidebar-nav .nav-sub {
        padding: 6px 6px;
        font-size: 12px;
        line-height: 18px;
        /* 同 nav-row：全局 a{min-height:44px} 会把每个子项撑到 44px，
           9 个子项就是 400px，这里压到 30px（6+18+6） */
        min-height: 30px;
    }

}
