/* ===================== 1:1 复刻目标站侧边栏导航（支持多层级） ===================== */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    margin: 10px 0;
}
/* 根列表 / 嵌套列表 */
.kd-root, .kd-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
}
/* 嵌套层级逐级缩进 */
.kd-sublist {
    padding-left: 14px;
}
.kd-has-child, .kd-leaf {
    list-style: none;
}

/* 分类行：左侧标题链接（跳转） + 右侧展开箭头（对齐 docs.menu.wiki） */
.kd-cat-row {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 4px 0;
    border-radius: 8px;
    padding: 4px 6px 4px 10px;
    transition: background 0.2s;
}
.kd-cat-row:hover { background: rgba(96,165,250,0.10); }
.kd-cat-row.active-sum {
    background: rgba(59,130,246,0.12);
}
body[data-theme="dark"] .kd-cat-row.active-sum {
    background: rgba(96,165,250,0.15);
}

/* 分类标题链接：点击跳转卡片总览页 */
.kd-cat-link {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 6px 8px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    transition: 0.2s;
    word-break: break-all;
}
body[data-theme="dark"] .kd-cat-link { color: var(--dark-text); }
body[data-theme="light"] .kd-cat-link { color: var(--light-text); }
.kd-cat-link:hover { color: #60a5fa; background: rgba(96,165,250,0.12); }
.kd-cat-link.active,
.kd-cat-row.active-sum .kd-cat-link {
    color: #3b82f6;
    font-weight: 700;
}
body[data-theme="dark"] .kd-cat-link.active,
body[data-theme="dark"] .kd-cat-row.active-sum .kd-cat-link {
    color: #60a5fa;
}

/* 展开/折叠按钮（置于右侧，对齐 docs.menu.wiki） */
.kd-cat-toggle {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    transition: transform 0.2s, background 0.2s, opacity 0.2s;
    padding: 0;
}
.kd-cat-toggle:hover {
    background: rgba(96,165,250,0.18);
    opacity: 0.9;
}
.kd-cat-toggle svg {
    transition: transform 0.2s;
    transform-origin: center;
}
.kd-cat-toggle.kd-toggle-open svg {
    transform: rotate(90deg);
}
body[data-theme="dark"] .kd-cat-toggle { color: var(--dark-text-sub); }
body[data-theme="light"] .kd-cat-toggle { color: var(--light-text-sub); }

/* 深层分类稍微紧凑 */
.kd-sublist .kd-cat-row {
    margin: 2px 0;
    padding: 2px 4px 2px 2px;
}
.kd-sublist .kd-cat-link {
    font-size: 13px;
    font-weight: 600;
    padding: 5px 7px;
}

/* 导航项（叶子节点） */
.kd-nav-item {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    text-decoration: none;
    margin: 3px 0;
    font-size: 13.5px;
    line-height: 1.4;
    transition: 0.2s;
    word-break: break-all;
}
body[data-theme="dark"] .kd-nav-item { color: var(--dark-text-sub); }
body[data-theme="light"] .kd-nav-item { color: var(--light-text-sub); }
.kd-nav-item:hover { background: rgba(96,165,250,0.15); color: #60a5fa; }
.kd-nav-item.active {
    background: rgba(96,165,250,0.22);
    color: #60a5fa;
    font-weight: 600;
}
/* 外部链接样式 */
.kd-nav-item.kd-ext {
    color: #7dd3fc;
}
.kd-nav-item.kd-ext:hover { color: #38bdf8; background: rgba(56,189,248,0.14); }
