/* ==========================================================================
   toc-system.css - 重疾险系列统一目录系统样式 (20260624)
   5 个 critical-* 页面统一引用，不依赖 JS 加载即生效
   ========================================================================== */

/* ===== 防御性规则 (核心): 一级目录从不高亮 ===== */
/* 无论 .has-sub 与否，所有 toc-link.active 都强制保持正常样式 */
.toc-link.active,
.toc-link.active:hover,
.toc-link.has-sub.active,
.toc-link.has-sub.active:hover {
    background: transparent !important;
    color: #92400e !important;
    font-weight: 500 !important;
}

/* ===== 浮窗高度限制 (核心) ===== */
#tocContainer {
    top: 280px !important;
    height: calc(100vh - 320px) !important;
    max-height: calc(100vh - 320px) !important;
    left: 16px !important;
    width: 280px !important;
}

/* 浮窗内部卡片：flex column */
#tocContainer > div {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* 浮窗内部主 nav：占据剩余空间 + 内部滚动 */
#tocContainer > div > nav {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 4px !important;
}

/* Firefox 滚动条 */
#tocContainer > div > nav {
    scrollbar-width: thin;
    scrollbar-color: #ef4444 #fef2f2;
}
/* WebKit 滚动条 */
#tocContainer > div > nav::-webkit-scrollbar {
    width: 8px;
}
#tocContainer > div > nav::-webkit-scrollbar-track {
    background: #fef2f2;
    border-radius: 4px;
}
#tocContainer > div > nav::-webkit-scrollbar-thumb {
    background: #ef4444;
    border-radius: 4px;
    border: 1px solid #fee2e2;
}
#tocContainer > div > nav::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}

/* ===== 子目录展开/折叠 (20260624 v2 - 统一手风琴) ===== */
/* 不区分 PC/Mobile：默认全部收起，点击一级才展开自己 + 收缩其他 */
nav[id^="sub-"] {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}
nav[id^="sub-"].expanded {
    max-height: 600px;
    opacity: 1;
}

/* ===== 移除一级目录的 ▼ 三角形 (20260624) ===== */
/* 原 HTML 里 .toc-link.has-sub::after { content: "▼"; } 强制覆盖 */
.toc-link.has-sub::after,
.toc-link.has-sub.collapsed::after,
.toc-link.has-sub.expanded::after {
    content: none !important;
    display: none !important;
}