/* ===== 博客文章详情页完整样式 - 堆叠式表格自适应版本 ===== */

/* ===== 基础重置 - 只针对博客文章相关元素 ===== */
.blog-post-content,
.blog-post-content *,
.blog-post-container,
.blog-post-layout,
.blog-post-main,
.blog-post-sidebar,
.blog-post-sidebar * {
    box-sizing: border-box !important;
}

/* ===== 全局基础样式 ===== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* ===== 博客文章详情页布局 ===== */
.blog-post-content {
    padding: 80px 0;
    background: #f8f9fa;
    min-height: 600px;
    width: 100%;
}

.blog-post-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.blog-post-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 50px;
    align-items: start;
    width: 100%;
}

.blog-post-main {
    background: white;
    border-radius: 12px;
    padding: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    width: 100%;
}

/* ===== 面包屑导航 ===== */
.blog-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    font-size: 14px;
    color: #64748b;
    flex-wrap: wrap;
}

.blog-breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.blog-breadcrumb a:hover {
    color: #1e3a8a;
}

.blog-breadcrumb i {
    font-size: 12px;
    color: #94a3b8;
}

.blog-breadcrumb span {
    color: #1e293b;
    font-weight: 500;
}

/* ===== 文章头部 ===== */
.post-header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e2e8f0;
}

.post-header .post-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    color: #1e293b;
}

.post-header .post-meta {
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #64748b;
}

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

.meta-item i {
    font-size: 12px;
    color: #94a3b8;
}

.meta-item a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s ease;
}

.meta-item a:hover {
    color: #1e3a8a;
}

.views-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 特色图片 ===== */
.post-featured-image {
    margin: 40px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.post-featured-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.post-featured-image:hover img {
    transform: scale(1.02);
}

/* ===== 文章内容 ===== */
.post-content {
    line-height: 1.8;
    color: #374151;
    font-size: 16px;
    margin-bottom: 40px;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: #1e293b;
    font-weight: 600;
    margin: 30px 0 15px 0;
    line-height: 1.3;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.75rem; }
.post-content h3 { font-size: 1.5rem; }
.post-content h4 { font-size: 1.25rem; }
.post-content h5 { font-size: 1.125rem; }
.post-content h6 { font-size: 1rem; }

.post-content p {
    margin-bottom: 20px;
}

.post-content ul,
.post-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.post-content li {
    margin-bottom: 8px;
}

.post-content blockquote {
    border-left: 4px solid #3b82f6;
    background: #f8fafc;
    padding: 20px 30px;
    margin: 30px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #475569;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.post-content a {
    color: #3b82f6;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.post-content a:hover {
    color: #1e3a8a;
    border-bottom-color: #1e3a8a;
}

.post-content code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.post-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.post-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* ===== 表格样式 - 桌面版 ===== */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.post-content table thead {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.post-content table thead th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 14px;
    letter-spacing: 0.025em;
    border: none;
    text-transform: none;
}

.post-content table thead th:first-child {
    border-top-left-radius: 8px;
}

.post-content table thead th:last-child {
    border-top-right-radius: 8px;
}

.post-content table tbody {
    background: white;
}

.post-content table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.post-content table tbody tr:last-child {
    border-bottom: none;
}

.post-content table tbody tr:hover {
    background: #f9fafb;
}

.post-content table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.post-content table tbody tr:nth-child(even):hover {
    background: #f3f4f6;
}

.post-content table td {
    padding: 16px 20px;
    border: none;
    color: #374151;
    font-weight: 400;
    vertical-align: middle;
    line-height: 1.5;
}

.post-content table td:first-child {
    font-weight: 500;
    color: #111827;
}

.post-content table td:nth-child(2),
.post-content table td:nth-child(3),
.post-content table td:nth-child(4) {
    text-align: center;
    font-weight: 500;
    color: #059669;
}

.post-content table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.post-content table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* ===== 文章标签 ===== */
.post-tags {
    margin: 40px 0;
    padding: 30px 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.post-tags h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1e293b;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: #f1f5f9;
    color: #475569;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-2px);
}

/* ===== 分享按钮 ===== */
.post-share {
    margin: 40px 0;
    padding: 30px 0;
}

.post-share h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e293b;
}

.share-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.share-btn.facebook {
    background: #1877f2;
    color: white;
}

.share-btn.facebook:hover {
    background: #166fe5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.share-btn.twitter {
    background: #1da1f2;
    color: white;
}

.share-btn.twitter:hover {
    background: #1a91da;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.3);
}

.share-btn.linkedin {
    background: #0077b5;
    color: white;
}

.share-btn.linkedin:hover {
    background: #006ba1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 181, 0.3);
}

/* ===== 文章导航 ===== */
.post-navigation {
    margin: 50px 0 0 0;
    padding-top: 40px;
    border-top: 1px solid #e2e8f0;
}

.post-nav-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.post-nav-item {
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.post-nav-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.post-nav-link {
    display: flex;
    align-items: center;
    padding: 25px;
    text-decoration: none;
    color: inherit;
    gap: 20px;
}

.post-nav-icon {
    width: 50px;
    height: 50px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.post-nav-item:hover .post-nav-icon {
    background: #1e3a8a;
    transform: scale(1.1);
}

.post-nav-content {
    flex: 1;
}

.post-nav-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.post-nav-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 5px 0;
    line-height: 1.3;
}

.post-nav-date {
    font-size: 12px;
    color: #94a3b8;
}

.post-next-item .post-nav-link {
    flex-direction: row-reverse;
}

/* ===== 博客文章详情页侧边栏 ===== */
.blog-post-sidebar {
    width: 100%;
}

.sidebar-widget {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1e293b;
    position: relative;
    padding-bottom: 10px;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 3px;
    background: linear-gradient(90deg, #1e3a8a, #3b82f6);
    border-radius: 2px;
}

.related-posts {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.related-post-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.related-post-item:hover {
    background: #f8fafc;
    transform: translateX(5px);
}

/* 移动端相关文章图片样式 - 调整高度 */
.related-post-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px; /* 增加高度，从45px调整到50px */
    border-radius: 6px;
    overflow: hidden;
}

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

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

/* 小屏幕设备进一步优化 */
@media (max-width: 480px) {
    .related-post-image {
        width: 50px;
        height: 42px; /* 增加高度，从38px调整到42px */
        border-radius: 4px;
    }
    
    .related-post-item:hover .related-post-image img {
        transform: scale(1.02);
    }
}

/* 中等屏幕设备 */
@media (min-width: 481px) and (max-width: 768px) {
    .related-post-image {
        width: 70px;
        height: 58px; /* 增加高度，从52px调整到58px */
        border-radius: 6px;
    }
}

/* 平板设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    .related-post-image {
        width: 75px;
        height: 62px; /* 增加高度，从56px调整到62px */
        border-radius: 7px;
    }
}

/* 桌面端保持原比例 */
@media (min-width: 1025px) {
    .related-post-image {
        width: 80px;
        height: 60px;
        border-radius: 8px;
    }
}

.related-post-content h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.related-post-content h4 a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.3s ease;
}

.related-post-content h4 a:hover {
    color: #3b82f6;
}

.related-post-content .post-date {
    font-size: 12px;
    color: #94a3b8;
}

.popular-posts {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.popular-post-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.popular-post-image {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
}

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

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

.popular-post-content h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.popular-post-content h4 a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.3s ease;
}

.popular-post-content h4 a:hover {
    color: #3b82f6;
}

.popular-post-content .post-date {
    font-size: 12px;
    color: #94a3b8;
}

/* ===== 移动端强制全宽显示 ===== */
@media (max-width: 768px) {
    /* 只针对博客文章内容进行移动端重置 */
    .blog-post-content {
        width: 100vw !important;
        max-width: 100vw !important;
        padding: 40px 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    .blog-post-container {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
    }
    
    .blog-post-layout {
        width: 100vw !important;
        max-width: 100vw !important;
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    .blog-post-main {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 25px !important;
        box-sizing: border-box !important;
    }
    
    .blog-post-sidebar {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    .sidebar-widget {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 0 20px 0 !important;
        padding: 20px !important;
        box-sizing: border-box !important;
    }
    
    .post-header .post-title {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }
    
    .post-header .post-meta {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    
    .blog-breadcrumb {
        font-size: 13px !important;
        gap: 8px !important;
    }
    
    .post-content {
        font-size: 15px !important;
        line-height: 1.7 !important;
    }
    
    .post-content h1 { font-size: 1.5rem !important; }
    .post-content h2 { font-size: 1.375rem !important; }
    .post-content h3 { font-size: 1.25rem !important; }
    .post-content h4 { font-size: 1.125rem !important; }
    
    .post-featured-image {
        margin: 25px 0 !important;
    }
    
    .post-tags {
        margin: 25px 0 !important;
        padding: 20px 0 !important;
    }
    
    .post-share {
        margin: 25px 0 !important;
        padding: 20px 0 !important;
    }
    
    .share-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .share-btn {
        justify-content: center !important;
        padding: 15px 20px !important;
    }
    
    .post-navigation {
        margin: 30px 0 0 0 !important;
        padding-top: 25px !important;
    }
    
    .post-nav-container {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .post-nav-link {
        padding: 20px !important;
        gap: 15px !important;
    }
    
    .post-nav-icon {
        width: 40px !important;
        height: 40px !important;
    }
    
    .post-nav-title {
        font-size: 14px !important;
    }
    
    .related-post-item,
    .popular-post-item {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 10px !important;
    }
    
    .related-post-image,
    .popular-post-image {
        width: 100% !important;
        height: 120px !important;
    }
    
    /* 表格移动端堆叠式布局 */
    .post-content table {
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: none !important;
        box-shadow: none !important;
        margin: 20px 0 !important;
    }
    
    .post-content table thead {
        display: none !important;
    }
    
    .post-content table tbody {
        display: block !important;
        width: 100% !important;
    }
    
    .post-content table tr {
        display: block !important;
        width: 100% !important;
        margin-bottom: 15px !important;
        background: white !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
        padding: 0 !important;
    }
    
    .post-content table tr:last-child {
        margin-bottom: 0 !important;
    }
    
    .post-content table td {
        display: block !important;
        width: 100% !important;
        padding: 12px 15px !important;
        border: none !important;
        text-align: left !important;
        position: relative !important;
        padding-left: 50% !important;
        font-size: 14px !important;
        line-height: 1.4 !important;
        border-bottom: 1px solid #f3f4f6 !important;
    }
    
    .post-content table td:last-child {
        border-bottom: none !important;
    }
    
    .post-content table td:before {
        content: attr(data-label) !important;
        position: absolute !important;
        left: 15px !important;
        top: 12px !important;
        width: 45% !important;
        font-weight: 600 !important;
        color: #1e3a8a !important;
        font-size: 12px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }
    
    .post-content table td:first-child {
        background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
        color: white !important;
        font-weight: 600 !important;
        border-radius: 8px 8px 0 0 !important;
        padding: 15px !important;
        text-align: center !important;
        font-size: 15px !important;
        border-bottom: none !important;
    }
    
    .post-content table td:first-child:before {
        display: none !important;
    }
    
    .post-content table td:nth-child(2),
    .post-content table td:nth-child(3),
    .post-content table td:nth-child(4) {
        color: #059669 !important;
        font-weight: 500 !important;
    }
    
    .post-content table tr:last-child td:first-child {
        border-radius: 8px 8px 0 0 !important;
    }
    
    .post-content table tr:last-child td:last-child {
        border-radius: 0 0 8px 8px !important;
    }
}

/* 小屏设备进一步优化 */
@media (max-width: 480px) {
    .blog-post-container {
        padding: 0 10px !important;
    }
    
    .blog-post-main {
        padding: 20px !important;
    }
    
    .sidebar-widget {
        padding: 15px !important;
    }
    
    .post-header .post-title {
        font-size: 1.5rem !important;
    }
    
    .post-content {
        font-size: 14px !important;
    }
    
    .share-btn {
        padding: 12px 15px !important;
        font-size: 13px !important;
    }
    
    .post-nav-link {
        padding: 15px !important;
        gap: 12px !important;
    }
    
    .post-nav-icon {
        width: 35px !important;
        height: 35px !important;
    }
    
    .post-content table {
        margin: 15px 0 !important;
    }
    
    .post-content table td {
        padding: 10px 12px !important;
        padding-left: 45% !important;
        font-size: 13px !important;
    }
    
    .post-content table td:before {
        left: 12px !important;
        top: 10px !important;
        width: 40% !important;
        font-size: 11px !important;
    }
    
    .post-content table td:first-child {
        padding: 12px !important;
        font-size: 14px !important;
    }
}

/* 超小屏幕设备 */
@media (max-width: 360px) {
    .post-content table td {
        padding: 8px 10px !important;
        padding-left: 40% !important;
        font-size: 12px !important;
    }
    
    .post-content table td:before {
        left: 10px !important;
        top: 8px !important;
        width: 35% !important;
        font-size: 10px !important;
    }
    
    .post-content table td:first-child {
        padding: 10px !important;
        font-size: 13px !important;
    }
}

/* ===== 动画效果 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tableFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.blog-post-main {
    animation: fadeInUp 0.6s ease-out;
}

.sidebar-widget {
    animation: fadeInUp 0.6s ease-out;
}

.sidebar-widget:nth-child(1) { animation-delay: 0.1s; }
.sidebar-widget:nth-child(2) { animation-delay: 0.2s; }

.post-content table {
    animation: tableFadeIn 0.4s ease-out;
}