/**
 * 基础美化效果 - 实用功能样式
 */

/* 图片懒加载效果 */
.article-content img,
.post-content img,
.entry-content img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-content img.loaded,
.post-content img.loaded,
.entry-content img.loaded {
    opacity: 1;
}

/* 代码块样式 */
.code-block {
    position: relative;
    background: #f6f8fa;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.code-block code {
    background: transparent;
    padding: 0;
    border: none;
}

/* 代码主题 - GitHub */
.code-theme-github {
    background: #f6f8fa;
    color: #24292e;
}

/* 代码主题 - Monokai */
.code-theme-monokai {
    background: #272822;
    color: #f8f8f2;
}

/* 代码主题 - Dracula */
.code-theme-dracula {
    background: #282a36;
    color: #f8f8f2;
}

/* 代码主题 - Tomorrow Night */
.code-theme-tomorrow {
    background: #1d1f21;
    color: #c5c8c6;
}

/* 行号 */
.line-numbers {
    position: absolute;
    left: 0;
    top: 15px;
    padding: 0 10px;
    color: #999;
    border-right: 1px solid #ddd;
    user-select: none;
    line-height: 1.6;
}

.code-block.code-theme-monokai .line-numbers,
.code-block.code-theme-dracula .line-numbers,
.code-block.code-theme-tomorrow .line-numbers {
    border-right-color: #444;
    color: #666;
}

.code-block code {
    padding-left: 50px;
    display: block;
}

/* 复制按钮 */
.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.copy-button:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.copy-button.copied {
    background: #28a745;
}

/* 返回顶部按钮 */
#back-to-top {
    position: fixed;
    bottom: 30px;
    width: 50px;
    height: 50px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#back-to-top.back-to-top-right {
    right: 30px;
}

#back-to-top.back-to-top-left {
    left: 30px;
}

#back-to-top.back-to-top-square {
    border-radius: 8px;
}

#back-to-top.back-to-top-rocket i {
    transform: rotate(-45deg);
}

#back-to-top i {
    font-size: 20px;
    position: relative;
    z-index: 2;
}

/* 进度环 */
.progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-90deg);
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.2s ease;
}

/* 文章目录 */
#table-of-contents {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

#table-of-contents.toc-sidebar {
    position: sticky;
    top: 20px;
}

#table-of-contents.toc-float {
    position: fixed;
    right: 20px;
    top: 100px;
    max-width: 300px;
    z-index: 999;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.toc-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #667eea;
    font-size: 16px;
    padding: 5px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.toc-list.collapsed {
    max-height: 0;
    overflow: hidden;
}

.toc-list li {
    margin: 8px 0;
}

.toc-list a {
    color: #666;
    text-decoration: none;
    display: block;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.toc-list a:hover {
    background: #f0f2f5;
    color: #667eea;
    padding-left: 15px;
}

.toc-list a.active {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.toc-level-2 {
    padding-left: 0;
}

.toc-level-3 {
    padding-left: 20px;
}

.toc-level-4 {
    padding-left: 40px;
}

/* 阅读进度条 */
#reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: #667eea;
    z-index: 9999;
    transition: width 0.2s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
    }
    
    #back-to-top.back-to-top-right {
        right: 20px;
    }
    
    #back-to-top.back-to-top-left {
        left: 20px;
    }
    
    #table-of-contents.toc-float {
        display: none;
    }
    
    .code-block {
        font-size: 12px;
        padding: 10px;
    }
    
    .line-numbers {
        padding: 0 5px;
        font-size: 12px;
    }
    
    .code-block code {
        padding-left: 40px;
    }
}

/* 滚动条美化 */
.toc-list::-webkit-scrollbar {
    width: 6px;
}

.toc-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.toc-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.toc-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}
