/* static\css\blogpost_detail.css */
/* 主CSS文件 - 仅包含导入 */

@import url("blogpost_variables.css");
@import url("blogpost_base.css");
@import url("blogpost_layout.css");
@import url("blogpost_content.css");
@import url("blogpost_components.css");
@import url("blogpost_responsive.css");
@import url("blogpost_print.css");
@import url("blogpost_utilities.css");

/* 全局图片基础样式 */
.post-content img,
.markdown-body img,
.editor-md-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0; /* 1rem auto|1rem 0| */
}

/* static/css/blogpost_detail.css - 添加以下样式 */

/* 目录高亮效果 */
.toc-highlight {
    background-color: rgba(255, 235, 59, 0.3) !important;
    transition: background-color 2s ease;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    position: relative;
}

.toc-highlight::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 80%;
    background-color: var(--bs-primary);
    border-radius: 2px;
}

/* 目录样式 */
.toc-container {
    background-color: var(--bs-light-bg-subtle);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--bs-border-color);
    position: relative;
    transition: all 0.3s ease;
}

.toc-container.floating {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 300px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.toc-container h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toc-toggle {
    background: none;
    border: none;
    color: var(--bs-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toc-toggle:hover {
    background-color: var(--bs-secondary-bg-subtle);
    color: var(--bs-primary);
}

.toc {
    max-height: 400px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.toc.collapsed {
    max-height: 0;
    overflow: hidden;
}

/* 目录列表 */
.toc-list {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
}

.toc-list ul {
    list-style-type: none;
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.toc-item {
    margin-bottom: 0.25rem;
    position: relative;
}

.toc-link {
    display: block;
    padding: 0.375rem 0.75rem;
    color: var(--bs-body-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toc-link:hover {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    text-decoration: none;
    padding-left: 1rem;
}

.toc-link.active {
    background-color: var(--bs-primary);
    color: white;
    font-weight: 500;
}

.toc-level-1 .toc-link { padding-left: 0.75rem; }
.toc-level-2 .toc-link { padding-left: 1.5rem; }
.toc-level-3 .toc-link { padding-left: 2.25rem; }
.toc-level-4 .toc-link { padding-left: 3rem; }
.toc-level-5 .toc-link { padding-left: 3.75rem; }
.toc-level-6 .toc-link { padding-left: 4.5rem; }

.toc-link-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 中文目录链接特殊样式 */
.chinese-toc-link {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 标题锚点 */
.header-anchor {
    opacity: 0;
    margin-left: 0.5rem;
    color: var(--bs-secondary);
    text-decoration: none;
    font-size: 0.8em;
    transition: opacity 0.2s ease, color 0.2s ease;
}

h1:hover .header-anchor,
h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor,
h5:hover .header-anchor,
h6:hover .header-anchor {
    opacity: 1;
}

.header-anchor:hover {
    color: var(--bs-primary);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .toc-container.floating {
        position: static;
        width: 100%;
        max-height: 300px;
        margin-bottom: 1rem;
    }
    
    .toc {
        max-height: 250px;
    }
}

/* 打印样式 */
@media print {
    .toc-container,
    .toc-toggle,
    .header-anchor {
        display: none !important;
    }
}


/* 确保目录和标题样式正确 */
.toc-container {
    background-color: var(--bs-light-bg-subtle);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--bs-border-color);
    position: relative;
    transition: all 0.3s ease;
}

.toc-container.floating {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 300px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.toc {
    max-height: 400px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.toc.collapsed {
    max-height: 0;
    overflow: hidden;
}

.toc-list {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
}

.toc-list ul {
    list-style-type: none;
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.toc-item {
    margin-bottom: 0.25rem;
    position: relative;
}

.toc-link {
    display: block;
    padding: 0.375rem 0.75rem;
    color: var(--bs-body-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toc-link:hover {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    text-decoration: none;
    padding-left: 1rem;
}

.toc-link.active {
    background-color: var(--bs-primary);
    color: white !important;
    font-weight: 500;
}


/* 标题锚点 */
.header-anchor {
    opacity: 0;
    margin-left: 0.5rem;
    color: var(--bs-secondary);
    text-decoration: none;
    font-size: 0.8em;
    transition: opacity 0.2s ease, color 0.2s ease;
}

h1:hover .header-anchor,
h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor,
h5:hover .header-anchor,
h6:hover .header-anchor {
    opacity: 1;
}

.header-anchor:hover {
    color: var(--bs-primary);
}

/* 高亮效果 */
.toc-highlight {
    animation: highlight-pulse 2s ease;
    position: relative;
    background-color: rgba(255, 235, 59, 0.3) !important;
}

@keyframes highlight-pulse {
    0% { background-color: rgba(255, 235, 59, 0.8); }
    100% { background-color: rgba(255, 235, 59, 0.3); }
}


/* 统一目录激活样式 */
.toc a.active,
.toc-link.active,
.toc-container .toc a.active,
.toc-container .toc-link.active {
    /* 背景样式 */
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    
    /* 文字样式 */
    color: #ffffff !important;
    font-weight: 600;
    
    /* 边框样式 */
    border-left: 4px solid #ffd700;
    
    /* 圆角 */
    border-radius: 8px 8px 8px 8px;
    
    /* 阴影效果 */
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    
    /* 动画效果 */
    transition: all 0.3s ease;
    
    /* 内边距调整 */
    padding: 0.5rem 1rem;
}

/* 悬停效果 */
.toc a:hover,
.toc-link:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(2px);
}