/* ==================== 重置样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    background-color: #f8fafc;
    background-image: linear-gradient(120deg, #fdfbfb 0%, #f9fafc 100%);
}

/* ==================== 主容器 ==================== */
.container {
    width: 1366px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

/* ==================== 头部样式 ==================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0 25px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: cover;
}

.logo-area {
    display: flex;
    align-items: center;
    padding: 0 40px;
    position: relative;
    z-index: 1;
}

.logo {
    font-size: 32px;
    font-weight: 700;
    margin-right: 25px;
    letter-spacing: 1px;
}

.logo a {
    color: white;
    text-decoration: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.logo a:hover {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.site-desc {
    font-size: 15px;
    opacity: 0.9;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* ==================== 导航样式 ==================== */
.navbar {
    background: linear-gradient(to right, #4a6ee0, #6a82fb);
    padding: 0 40px;
    position: relative;
    box-shadow: 0 2px 15px rgba(106, 130, 251, 0.2);
}

.nav-list {
    display: flex;
    list-style: none;
    position: relative;
    z-index: 1;
}

.nav-list li {
    position: relative;
}

.nav-list a {
    display: block;
    padding: 17px 25px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-list a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.nav-list a:hover::before {
    left: 100%;
}

.nav-list a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* ==================== 搜索框 ==================== */
.search-box {
    background: #f1f5f9;
    padding: 20px 40px;
    border-bottom: 1px solid #e2e8f0;
}

.search-form {
    display: flex;
    max-width: 450px;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.search-form:focus-within {
    box-shadow: 0 5px 20px rgba(106, 130, 251, 0.3);
    transform: translateY(-1px);
}

.search-input {
    flex: 1;
    padding: 12px 25px;
    border: none;
    outline: none;
    font-size: 15px;
    background: transparent;
    color: #444;
}

.search-input::placeholder {
    color: #94a3b8;
}

.search-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    min-width: 100px;
}

.search-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a408f 100%);
    transform: translateY(-1px);
}

/* ==================== 面包屑导航 ==================== */
.breadcrumb {
    padding: 20px 40px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    color: #64748b;
}

.breadcrumb a {
    color: #4a6ee0;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    padding: 2px 5px;
    border-radius: 3px;
}

.breadcrumb a:hover {
    color: #764ba2;
    background: rgba(106, 130, 251, 0.1);
}

.breadcrumb span {
    color: #94a3b8;
}

.breadcrumb a + a::before,
.breadcrumb a + span::before {
    content: "›";
    margin: 0 10px;
    color: #cbd5e1;
}

/* ==================== 主要内容区域 ==================== */
.main-content {
    display: flex;
    padding: 30px 40px;
    min-height: 600px;
    gap: 40px;
}

.content {
    flex: 1;
    min-width: 0; /* 防止内容溢出 */
}

.sidebar {
    flex: 0 0 300px;
    border-left: 1px solid #e2e8f0;
    padding-left: 40px;
}

/* ==================== 文章列表样式 ==================== */
.article-list {
    margin-top: 10px;
}

.section-title {
    font-size: 22px;
    color: #334155;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
    font-weight: 600;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.article-item {
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.article-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-item:hover::before {
    opacity: 1;
}

.article-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border-color: #c7d2fe;
}

.article-title {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-title a {
    color: #334155;
    text-decoration: none;
    transition: all 0.2s ease;
}

.article-title a:hover {
    color: #4a6ee0;
}

.article-meta {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.article-meta span::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 50%;
    margin-right: 5px;
}

.article-meta span:first-child::before {
    display: none;
}

.article-excerpt {
    color: #475569;
    line-height: 1.8;
    font-size: 14.5px;
}

/* ==================== 分页样式 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0 20px;
    gap: 8px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    color: #64748b;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.pagination a:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #4a6ee0;
    transform: translateY(-1px);
}

.pagination .current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    font-weight: 500;
}

/* ==================== 侧边栏样式 ==================== */
.widget {
    margin-bottom: 30px;
    padding: 25px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.widget:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.widget-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    color: #334155;
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.widget-list {
    list-style: none;
}

.widget-list li {
    padding: 10px 0;
    border-bottom: 1px dashed #e2e8f0;
    position: relative;
    padding-left: 15px;
}

.widget-list li:last-child {
    border-bottom: none;
}

.widget-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #94a3b8;
    font-size: 16px;
}

.widget-list a {
    color: #475569;
    text-decoration: none;
    font-size: 14.5px;
    line-height: 1.5;
    transition: all 0.2s ease;
    display: block;
}

.widget-list a:hover {
    color: #4a6ee0;
    transform: translateX(3px);
}

/* ==================== 文章详情页样式 ==================== */
.article-detail {
    background: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 30px;
}

.article-detail .article-title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 20px;
    color: #1e293b;
}

.article-detail .article-meta {
    background: #f8fafc;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 25px;
    border-left: 4px solid #667eea;
}

/* ========== 关键修改：限制内容图片宽度 ========== */
.article-content {
    line-height: 1.8;
    color: #334155;
    font-size: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 限制文章内容中所有图片的最大宽度 */
.article-content img {
    max-width: 100% !important;  /* 强制限制最大宽度 */
    height: auto !important;     /* 保持比例 */
    display: block;
    margin: 25px auto;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    padding: 3px;
    background: white;
    transition: all 0.3s ease;
}

.article-content img:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* 处理可能存在的inline图片样式 */
.article-content p img,
.article-content div img {
    max-width: 100% !important;
    height: auto !important;
}

/* 特别处理那些可能已经设置了宽度的图片 */
.article-content img[width],
.article-content img[style*="width"] {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* 处理可能存在的内联样式覆盖 */
.article-content *[style*="width"] img {
    max-width: 100% !important;
}

/* 文章内容的段落样式 */
.article-content p {
    margin-bottom: 1.2em;
    text-align: justify;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    margin: 1.5em 0 0.8em;
    color: #1e293b;
    font-weight: 600;
}

.article-content h2 {
    font-size: 22px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.article-content h3 {
    font-size: 19px;
}

.article-content ul,
.article-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.article-content li {
    margin-bottom: 0.5em;
}

.article-content blockquote {
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    margin: 20px 0;
    background: #f8fafc;
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

.article-content pre,
.article-content code {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.article-content pre {
    padding: 15px;
    overflow-x: auto;
    margin: 20px 0;
}

.article-tags {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.article-tags strong {
    color: #334155;
    margin-right: 10px;
}

.article-tags a {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    margin-right: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.article-tags a:hover {
    background: #4a6ee0;
    color: white;
    transform: translateY(-1px);
}

/* 上一篇下一篇 */
.prev-next {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    gap: 20px;
}

.prev-next > div {
    flex: 1;
}

.prev-next strong {
    display: block;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 8px;
}

.prev-next a {
    color: #4a6ee0;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.5;
    display: block;
    transition: all 0.2s ease;
}

.prev-next a:hover {
    color: #764ba2;
    transform: translateX(2px);
}

/* 相关文章 */
.related-articles {
    background: white;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.related-articles h3 {
    font-size: 18px;
    color: #334155;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.related-articles ul {
    list-style: none;
}

.related-articles li {
    padding: 10px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.related-articles li:last-child {
    border-bottom: none;
}

.related-articles a {
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    display: block;
}

.related-articles a:hover {
    color: #4a6ee0;
    transform: translateX(3px);
}

/* ==================== 封面模板样式 ==================== */
.cover-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.cover-title {
    font-size: 28px;
    color: #1e293b;
    margin-bottom: 15px;
    font-weight: 700;
}

.cover-description {
    color: #475569;
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.sub-classes {
    margin: 30px 0;
}

.sub-class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.sub-class-item {
    background: white;
    padding: 25px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sub-class-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: #c7d2fe;
}

.sub-class-item h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.sub-class-item h4 a {
    color: #334155;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sub-class-item h4 a:hover {
    color: #4a6ee0;
}

.sub-class-item p {
    color: #64748b;
    font-size: 14.5px;
    line-height: 1.6;
}

/* ==================== 页脚样式 ==================== */
.footer {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #cbd5e1;
    padding: 50px 40px 30px;
    margin-top: 50px;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-title {
    font-size: 18px;
    color: white;
    margin-bottom: 20px;
    font-weight: 600;
    position: relative;
    padding-bottom: 10px;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.footer p {
    line-height: 1.7;
    margin-bottom: 15px;
    color: #94a3b8;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
    padding: 2px 0;
}

.footer-links a:hover {
    color: white;
    transform: translateX(5px);
}

.copyright {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 13px;
}

.copyright p {
    margin-bottom: 5px;
}

/* ==================== 返回顶部按钮 ==================== */
.back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    font-size: 20px;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-item,
.widget,
.article-detail,
.cover-content {
    animation: fadeIn 0.5s ease-out;
}