﻿/* 全局容器样式 */

.blog-container {
    max-width: 1200px;
    margin: 100px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 320px; /* 默认显示两列 */
    gap: 30px;
}

/* 主内容区样式 */
.main-content {
    min-width: 0;
}

/* 文章卡片样式 */
.article-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
    padding: 40px;
}

/* 文章头部样式 */
.article-header {
    text-align: center;
    margin-bottom: 40px;
}

/* 文章标题样式 */
.article-title {
    font-size: 1.5rem;
    color: #1a202c;
    line-height: 1.4;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* 分割线样式 */
.article-divider {
  height: 3px;
    background: linear-gradient(to right, #3498db, transparent);
    margin: 20px 0;
}

/* 文章元信息基础样式 */

.article-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    color: #718096;
    font-size: 0.95rem;
    margin-top: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item i {
    color: #a0aec0;
}

.meta-item:hover {
    background: #edf2f7;
}


.meta-text {
    color: #4a5568;
}

/* 分类链接样式 */
.meta-item .category-link {
    color: #3182ce;
    text-decoration: none;
    transition: color 0.3s ease;
}

.meta-item .category-link:hover {
    color: #2c5282;
}

/* 分隔符样式 */
.meta-separator {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #cbd5e0;
    border-radius: 50%;
    margin: 0 8px;
}

/* 文章内容区域 - 保持原始格式 */
.article-content {
    max-width: 100%;
    margin: 0 auto;
    word-wrap: break-word;
}

/* 保持段落格式 */
.article-content p {
    margin: 1em 0;
}

/* 保持图片格式和对齐方式 */
.article-content img {
    max-width: 100%;
    height: auto;
}

.article-content img.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.article-content img.alignleft {
    float: left;
    margin-right: 1em;
}

.article-content img.alignright {
    float: right;
    margin-left: 1em;
}

/* 保持列表格式 */
.article-content ul,
.article-content ol {
    margin-left: 2em;
}

/* 保持表格格式 */
.article-content table {
    width: 100%;
    border-collapse: collapse;
}

.article-content table td,
.article-content table th {
    border: 1px solid #ddd;
    padding: 8px;
}

/* 保持引用块格式 */
.article-content blockquote {
    margin: 1em 0;
    padding-left: 1em;
    border-left: 4px solid #ddd;
}

/* 代码块容器样式 */
pre[class*="language-"] {
    margin: 2em 0;
    padding: 1.5em;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* 工具栏样式 */
div.code-toolbar > .toolbar {
    opacity: 1;
    top: 0.3em;
    right: 0.3em;
}

/* 工具栏按钮样式 */
div.code-toolbar > .toolbar > .toolbar-item > button {
    padding: 0.3em 0.8em;
    background: #2196f3;
    color: white !important;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

/* 工具栏按钮悬停效果 */
div.code-toolbar > .toolbar > .toolbar-item > button:hover {
    background: #1976d2;
    transform: translateY(-1px);
}

/* 复制成功提示样式 */
div.code-toolbar > .toolbar > .toolbar-item > span {
    padding: 0.3em 0.8em;
    background: #4caf50;
    color: white !important;
    border-radius: 3px;
}

/* 行内代码样式 */
:not(pre) > code {
    padding: 2px 5px;
    border-radius: 3px;
    background: #f5f5f5;
    color: #e83e8c;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}
/* 文章标签样式 */
.article-tags {
    margin: 40px 0;
    padding-top: 30px;
    border-top: 1px solid #edf2f7;
}

.article-tags a {
    display: inline-block;
    padding: 6px 16px;
    margin: 4px;
    background: #f7fafc;
    color: #4a5568;
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s;
}

.article-tags a:hover {
    background: #3182ce;
    color: #fff;
}

/* 文章分享按钮 */
.article-share {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.share-title {
    color: #4a5568;
    font-size: 0.95rem;
}

.share-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    transition: transform 0.3s;
}

.share-link:hover {
    transform: translateY(-3px);
}

.share-link.twitter {
    background: #1DA1F2;
}

.share-link.facebook {
    background: #4267B2;
}

/* 文章导航样式 */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 40px 0;
}

.nav-box {
    padding: 20px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.nav-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.nav-label {
    display: block;
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 8px;
    font-weight: 500;
}

.nav-box a {
    color: #2d3748;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.nav-box a:hover {
    color: #3182ce;
}

/* 无文章提示样式 */
.no-post {
    color: #a0aec0;
    font-size: 0.95rem;
    font-style: italic;
    display: block;
    padding: 5px 0;
}

/* 相关文章样式优化 */
.related-posts {
    margin-top: 60px;
    margin-bottom: 40px;
}

.related-title {
    font-size: 1.5rem;
    color: #1a202c;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
    position: relative;
    padding-bottom: 15px;
}

/* 添加标题下方的装饰线 */
.related-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: #3182ce;
    border-radius: 3px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.related-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.related-image {
    position: relative;
    padding-top: 56.25%; /* 16:9 宽高比 */
    overflow: hidden;
}

.related-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-card:hover .related-image img {
    transform: scale(1.05);
}

.related-info {
    padding: 20px;
}

.related-info h4 {
    color: #2d3748;
    margin: 0 0 12px;
    font-size: 1.1rem;
    line-height: 1.4;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.related-card:hover .related-info h4 {
    color: #3182ce;
}

.related-info time {
    color: #718096;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.related-info time i {
    font-size: 0.85em;
}

/* 侧边栏基础样式 */
.sidebar {
    position: sticky;
    top: 30px;
    align-self: start;
}

/* 小部件通用样式 */
.widget {
    background: #fff;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.widget:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* 小部件标题样式 */
.widget-title {
    font-size: 1.2rem;
    color: #1a202c;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #edf2f7;
    position: relative;
    font-weight: 600;
}

/* 标题装饰线 */
.widget-title:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: #3182ce;
    border-radius: 2px;
}

/* 作者卡片样式 */
.author-card {
    text-align: center;
}

.author-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 15px;
    overflow: hidden;
    border: 3px solid #fff;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.author-card:hover .author-avatar img {
    transform: scale(1.05);
}

.author-name {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 10px;
    font-weight: 600;
}

.author-bio {
    color: #718096;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.author-social {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 热门文章列表样式 */
.popular-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.popular-item {
    display: flex;
    gap: 15px;
    text-decoration: none;
    padding-bottom: 15px;
    border-bottom: 1px solid #edf2f7;
    transition: transform 0.3s ease;
}

.popular-item:hover {
    transform: translateX(5px);
}

.popular-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.popular-image {
    flex: 0 0 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
}

.popular-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.popular-item:hover .popular-image img {
    transform: scale(1.08);
}

.popular-info {
    flex: 1;
    min-width: 0; /* 防止文本溢出 */
}

.popular-info h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #2d3748;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.popular-item:hover .popular-info h4 {
    color: #3182ce;
}

.popular-info time {
    font-size: 0.85rem;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 分类列表样式 */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 10px;
}

.category-list a {
    color: #2d3748;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f7fafc;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.category-list a:hover {
    color: #fff;
    background: #3182ce;
    transform: translateX(5px);
}

.category-count {
    background: #edf2f7;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #4a5568;
    transition: all 0.3s ease;
}

.category-list a:hover .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 标签云样式 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud a {
    padding: 6px 12px;
    background: #f7fafc;
    color: #4a5568;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem !important;
    transition: all 0.3s ease;
}

.tag-cloud a:hover {
    background: #3182ce;
    color: #fff;
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .blog-container {
        grid-template-columns: 1fr 280px;
        gap: 20px;
    }
    .related-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .article-title {
        font-size: 1.5rem;
    }
    
      .widget {
        padding: 20px;
    }
    
}

@media (max-width: 768px) {
    .blog-container {
        grid-template-columns: 1fr;
         margin: 100px auto; /* 移动端适当减小边距 */
         
    }

    .meta-group {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .related-info h4 {
        font-size: 1rem;
    }
    .sidebar {
        display: none; /* 隐藏侧边栏 */
    }

    .main-content {
        width: 100%; /* 确保主内容区域占满宽度 */
    }
    
    .widget-title {
        font-size: 1.1rem;
    }
    
      .article-meta {
        justify-content: center; /* 改为居中对齐 */
        overflow-x: auto;
        padding-bottom: 5px;
        flex-wrap: nowrap;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
        /* 添加水平内边距确保滚动时两端有足够空间 */
        padding-left: 20px;
        padding-right: 20px;
        /* 确保整个滚动区域居中 */
        margin-left: -20px;
        margin-right: -20px;
        /* 添加渐变遮罩效果，提示可以滚动 */
        mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    }

    .meta-item {
        font-size: 0.8rem;
        white-space: nowrap;
        gap: 4px;
    }

    .meta-item i {
        font-size: 0.8em;
    }
     .article-meta::-webkit-scrollbar {
        display: none;
    }
    .article-meta {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    
}

@media (max-width: 480px) {
    .blog-container {
         margin: 100px auto; /* 小屏幕再适当减小边距 */
        padding: 0 15px; /* 可以适当减小左右内边距 */
    }

    .article-card {
        padding: 20px;
    }

    .article-title {
        font-size: 1.3rem;
    }

    .article-divider {
        margin: 20px auto;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .post-navigation {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .nav-box {
        padding: 15px;
    }

    .nav-label {
        font-size: 0.85rem;
    }

    .nav-box a {
        font-size: 1rem;
    }

    .no-post {
        font-size: 0.9rem;
    }
 .article-meta {
        margin-top: 15px;
        gap: 10px;
    }

    .meta-item {
        font-size: 0.75rem;
    }

.related-posts {
        margin-top: 40px;
    }

    .related-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    .related-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .related-info {
        padding: 15px;
    }

    /* 隐藏滚动条但保持功能 */
    .article-meta::-webkit-scrollbar {
        display: none;
    }
    .article-meta {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
        .meta-separator {
            display: none; /* 在移动端隐藏分隔符 */
        }
    
}




/* 分享按钮样式 */
.article-share {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.share-title {
    color: #666;
    font-size: 14px;
}

.share-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    border-radius: 4px;
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s;
}

.share-link:hover {
    opacity: 0.8;
}

.share-link i {
    margin-right: 6px;
    font-size: 16px;
}

.share-text {
    font-size: 14px;
}

/* 微信分享按钮 */
.wechat {
    background-color: #07C160;
}

/* QQ分享按钮 */
.qq {
    background-color: #12B7F5;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    width: 300px;
    border-radius: 8px;
    text-align: center;
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #555;
}

#qrcode {
    margin: 20px auto;
    width: 200px;
    height: 200px;
}

.modal-content p {
    color: #666;
    font-size: 14px;
    margin-top: 15px;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .share-text {
        display: none; /* 在移动端只显示图标 */
    }
    
    .share-link {
        padding: 8px;
    }
    
    .share-link i {
        margin: 0;
        font-size: 20px;
    }
    
    .modal-content {
        width: 90%;
        margin: 30% auto;
    }
}
