/* ============================================
   TOC Anchor Widget
   ============================================ */
.bai_toc_wrap {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
}

/* ========== 标题 ========== */
.bai_toc_title {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

/* ========== 导航列表 ========== */
.bai_toc_nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bai_toc_list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ========== H2 导航项 ========== */
.bai_toc_item {
    margin-bottom: 8px;
}

.bai_toc_item-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bai_toc_link {
    position: relative;
    display: block;
    padding: 4px 0 4px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    flex: 1;
    line-height: 1.5;
}

.bai_toc_link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background-color: #126cb5;
    border-radius: 2px;
    transition: height 0.2s;
}

.bai_toc_link:hover {
    color: #126cb5;
    text-decoration: none;
}

.bai_toc_link.active {
    color: #126cb5;
    font-weight: 600;
}

.bai_toc_link.active::before {
    height: 60%;
}

/* ========== 展开/收起箭头 ========== */
.bai_toc_toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    color: #999;
    flex-shrink: 0;
    transition: color 0.2s, transform 0.3s;
    border: none;
    background: none;
    padding: 0;
}

.bai_toc_toggle svg {
    width: 14px;
    height: 14px;
}

.bai_toc_toggle:hover {
    color: #333;
}

.bai_toc_toggle.expanded {
    transform: rotate(180deg);
}

/* ========== 子项列表 (h3) ========== */
.bai_toc_sub-list {
    list-style: none;
    margin: 4px 0 0 0;
    padding-left: 16px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s;
}

.bai_toc_sub-list.collapsed {
    max-height: 0;
    opacity: 0;
}

.bai_toc_sub-list.expanded {
    max-height: 500px;
    opacity: 1;
}

.bai_toc_sub-item {
    margin-bottom: 4px;
}

.bai_toc_sub-link {
    display: block;
    padding: 3px 0 3px 12px;
    font-size: 13px;
    font-weight: 400;
    color: #666;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    line-height: 1.5;
}

.bai_toc_sub-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background-color: #126cb5;
    border-radius: 2px;
    transition: height 0.2s;
}

.bai_toc_sub-link:hover {
    color: #126cb5;
    text-decoration: none;
}

.bai_toc_sub-link.active {
    color: #126cb5;
    font-weight: 500;
}

.bai_toc_sub-link.active::before {
    height: 50%;
}
