:root {
    --main-color: #5D3FD3;
    --light-purple: #f0edff;
    --dark-purple: #4a2fb8;
    --gradient-primary: linear-gradient(135deg, #5D3FD3 0%, #8D71FF 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* 主要内容区域 */
.main-container {
    max-width: 1200px;
    width: 100%;
    margin: 15px auto;
    padding: 0 20px 60px 20px;
    box-sizing: border-box;
}

/* 页面头部 */
.knowledge-v3-header {
    background: var(--gradient-primary);
    border-radius: 20px;
    padding: 20px 40px;
    margin-bottom: 30px;
    color: white;
    text-align: center;
    box-shadow: 0 8px 30px rgba(93, 63, 211, 0.2);
}

.knowledge-v3-header h1 {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.knowledge-v3-header h1 i {
    font-size: 30px;
}

.knowledge-v3-header p {
    font-size: 16px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* 内容布局 */
.knowledge-v3-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

/* 主内容区域 */
.knowledge-v3-main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
}

/* 侧边栏 */
.knowledge-v3-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h3::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* 分类导航 */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-radius: 12px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.category-item:hover {
    background-color: var(--light-purple);
    color: var(--main-color);
    text-decoration: none;
    transform: translateX(5px);
}

.category-item.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--main-color);
    box-shadow: 0 4px 15px rgba(93, 63, 211, 0.3);
}

.category-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* 知识分区 */
.knowledge-section {
    display: none;
    animation: fadeInUp 0.6s ease;
}

.knowledge-section.active {
    display: block;
}

.section-header {
    margin-bottom: 30px;
    padding: 20px 24px;
    border-bottom: none;
    background: var(--gradient-primary);
    border-radius: 14px;
    color: #fff !important;
}

.section-header h2 {
    font-size: 24px;
    font-weight: bold;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.section-header h2::before {
    content: '';
    width: 5px;
    height: 24px;
    background: rgba(255,255,255,0.8);
    border-radius: 3px;
}

.section-header p {
    color: rgba(255,255,255,0.95) !important;
    font-size: 16px;
    margin-left: 0;
}



/* 文章网格 */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

/* 文章卡片 */
.article-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--main-color);
}

.article-card.featured {
    border: 2px solid var(--main-color);
    background: linear-gradient(135deg, #fff 0%, #f8f6ff 100%);
}

.article-image {
    position: relative;
    width: 100%;
    height: 240px; /* 加高并固定，避免留白 */
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #eef1f7 100%);
    border-bottom: 1px solid #f0f0f0;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: fill !important; /* 强制拉伸填满容器，防止裁切 */
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
    background: #f5f7fa;
}



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

.article-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    background: var(--gradient-primary);
    box-shadow: 0 2px 8px rgba(93, 63, 211, 0.3);
}

.article-badge.featured {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
}

.article-badge.important {
    background: linear-gradient(135deg, #ffa726 0%, #ffb74d 100%);
}

.article-badge.practical {
    background: linear-gradient(135deg, #26a69a 0%, #4db6ac 100%);
}

.article-content {
    padding: 25px;
}

.article-content h3 {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-content p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-meta i {
    color: var(--main-color);
}

/* 热门文章 */
.popular-articles {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.popular-article {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.popular-article:hover {
    background-color: var(--light-purple);
    color: var(--main-color);
    text-decoration: none;
    transform: translateX(5px);
}

.popular-article .article-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #eef1f7 100%);
    border: 1px solid #f0f0f0;
}

.popular-article .article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #f5f7fa;
}

.popular-article .article-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-article .article-meta {
    font-size: 12px;
    color: #999;
}

/* 搜索框 */
.knowledge-search {
    margin-bottom: 25px;
}

.search-container {
    position: relative;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    background-color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--main-color);
    box-shadow: 0 4px 15px rgba(93, 63, 211, 0.15);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--main-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background-color: var(--dark-purple);
}

/* 统计信息 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-card {
    background: var(--gradient-primary);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(93, 63, 211, 0.2);
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
}

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

.fade-in {
    animation: fadeInUp 0.6s ease;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .knowledge-v3-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .knowledge-v3-sidebar {
        order: -1;
    }
    
    .category-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .category-item {
        flex: 0 0 auto;
        min-width: 120px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 0 15px;
    }
    
    .knowledge-v3-header {
        padding: 15px 20px;
    }
    
    .knowledge-v3-header h1 {
        font-size: 22px;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 6px;
    }
    
    .knowledge-v3-header p {
        font-size: 14px;
    }
    
    .knowledge-v3-main {
        padding: 25px 20px;
    }
    
    .article-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .knowledge-v3-header h1 {
        font-size: 20px;
    }
    
    .knowledge-v3-header p {
        font-size: 14px;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
    
    .article-content {
        padding: 20px;
    }
    
    .article-content h3 {
        font-size: 16px;
    }
}