/* 标题外层布局 */
.title_wrap_box {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    margin-bottom: 10px;
}
.article_titlebor {
    margin: 0;
    flex: 1;
}

/* 目录触发按钮样式 */
.catalog-float-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
    z-index: 998;
}
.catalog-float-btn:hover {
    background: #f6f9ff;
    border-color: #1677ff;
    box-shadow: 0 3px 12px rgba(22, 119, 255, 0.12);
}
.catalog-float-btn.active {
    background: #1677ff;
    border-color: #1677ff;
}
.catalog-float-btn i {
    color: #1677ff;
    font-size: 18px;
}
.catalog-float-btn.active i {
    color: #fff;
}

/* 弹窗面板基础 */
.catalog-popup-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 280px;
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 16px;
    z-index: 999;
    display: none;
}
.catalog-popup-panel.show {
    display: block;
}
/* 美化滚动条 */
.catalog-popup-panel::-webkit-scrollbar {
    width: 6px;
}
.catalog-popup-panel::-webkit-scrollbar-thumb {
    background: #dcdcdc;
    border-radius: 3px;
}
.catalog-popup-panel::-webkit-scrollbar-track {
    background: #f7f7f7;
}

/* 弹窗头部 */
.catalog-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.catalog-popup-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #222;
}
.catalog-close-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    color: #999;
    transition: 0.2s;
}
.catalog-close-btn:hover {
    background: #f5f7fa;
    color: #333;
}

/* 目录最外层容器 */
.catalog-wrap {
    width: 100%;
}
/* 单行目录项 */
.catalog-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
}
/* 目录文字区域 */
.catalog-item-content {
    width: 100%;
    padding: 5px 8px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.catalog-item-content:hover {
    background: #f0f6ff;
    color: #1677ff;
}

/* H2一级标题 */
.catalog-item-content.level-h2 {
    font-weight: 600;
    color: #222;
}
/* H3二级标题，缩进形成树形 */
.catalog-item-content.level-h3 {
    padding-left: 26px;
    color: #666;
}
/* 滚动高亮激活样式 */
.catalog-item-content.active {
    background: #e8f3ff;
    color: #1677ff;
    border-left: 3px solid #1677ff;
}

/* 锚点滚动留白，防止被导航栏遮挡 */

.ab_img h2,
.ab_img h3 {
    scroll-margin-top: 70px;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .title_wrap_box {
        gap: 8px;
    }
    .catalog-float-btn {
        width: 32px;
        height: 32px;
    }
    .catalog-float-btn i {
        font-size: 16px;
    }
    .catalog-popup-panel {
        width: calc(100vw - 32px);
        left: auto;
        right: -8px;
        max-height: 52vh;
    }
    .catalog-item-content {
        font-size: 13px;
    }
}