/* 收藏知识页面样式 - 与主页面保持一致 */

/* 全局样式 */
body .knowledge-container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
    background-color: transparent;
    min-height: calc(100vh - 200px);
    box-sizing: border-box;
}

/* 页面头部 */
body .knowledge-header {
    background: linear-gradient(135deg, #5D3FD3, #7B68EE);
    border-radius: 20px;
    padding: 50px 40px;
    margin-bottom: 40px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 32px rgba(93, 63, 211, 0.2);
    position: relative;
    overflow: hidden;
}

body .knowledge-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"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

body .page-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

body .page-title i {
    font-size: 2.5rem;
    opacity: 0.9;
    animation: pulse 2s infinite;
}

body .page-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
    position: relative;
    z-index: 1;
    line-height: 1.6;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* 主要内容区域 - 与主页面保持一致 */
body .knowledge-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    margin-bottom: 50px;
}

/* 左侧主内容区域 */
body .knowledge-main {
    background: white;
    border-radius: 20px;
    padding: 35px 40px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    min-height: 600px;
}

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

body .sidebar-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body .sidebar-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

body .sidebar-header {
    background: linear-gradient(135deg, #5D3FD3, #7B68EE);
    color: white;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

body .sidebar-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"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

body .sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

/* 分类列表 */
body .category-list {
    padding: 0;
}

body .category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
}

body .category-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #5D3FD3, #7B68EE);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

body .category-item:hover::before {
    transform: scaleY(1);
}

body .category-item:hover {
    background: rgba(93, 63, 211, 0.05);
    color: #5D3FD3;
    transform: translateX(5px);
}

body .category-item.active {
    background: linear-gradient(135deg, #5D3FD3, #7B68EE);
    color: white;
    border-left: 4px solid #fff;
}

body .category-item.active::before {
    display: none;
}

body .category-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

body .category-item:hover i {
    transform: scale(1.1);
}

/* 热门文章 */
body .popular-articles {
    padding: 20px;
}

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

body .popular-article:hover {
    background: rgba(93, 63, 211, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin: 0 -20px;
    transform: translateX(5px);
}

body .popular-article:last-child {
    border-bottom: none;
}

body .article-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

body .popular-article:hover .article-image img {
    transform: scale(1.1);
}

body .article-info {
    flex: 1;
}

body .article-info h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    transition: color 0.3s ease;
}

body .popular-article:hover .article-info h4 {
    color: #5D3FD3;
}

body .article-meta {
    font-size: 0.8rem;
    color: #666;
    transition: color 0.3s ease;
}

body .popular-article:hover .article-meta {
    color: #5D3FD3;
}

/* 知识分类区域 */
body .knowledge-section {
    display: none;
}

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

body .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

body .section-header h2 {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

body .section-header h2::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #5D3FD3, #7B68EE);
    border-radius: 2px;
}

body .section-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
    flex: 1;
    text-align: center;
}

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

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

body .article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #5D3FD3, #7B68EE);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

body .article-card:hover::before {
    transform: scaleX(1);
}

body .article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(93, 63, 211, 0.15);
    border-color: #5D3FD3;
}

body .article-card.featured {
    border: 2px solid #5D3FD3;
    box-shadow: 0 6px 20px rgba(93, 63, 211, 0.15);
}

body .article-card.featured::before {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    transform: scaleX(1);
}

body .article-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}

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

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

body .article-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(93, 63, 211, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body .article-badge.featured {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

body .article-content {
    padding: 20px;
}

body .article-content h3 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    transition: color 0.3s ease;
}

body .article-card:hover .article-content h3 {
    color: #5D3FD3;
}

body .article-content p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 15px 0;
}

body .article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #999;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

body .article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

body .article-card:hover .article-meta span {
    color: #5D3FD3;
}

/* 搜索功能 */
body .search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

body .search-modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

body .search-header {
    background: linear-gradient(135deg, #5D3FD3, #7B68EE);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body .search-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

body .close-search {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

body .close-search:hover {
    background: rgba(255, 255, 255, 0.2);
}

body .search-input-container {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
}

body .search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

body .search-input:focus {
    outline: none;
    border-color: #5D3FD3;
}

body .search-btn {
    background: #5D3FD3;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

body .search-btn:hover {
    background: #4a32a8;
}

body .search-results {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

body .search-result-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s ease;
}

body .search-result-item:hover {
    background: rgba(93, 63, 211, 0.05);
}

body .search-result-item h4 {
    margin: 0 0 5px 0;
    color: #5D3FD3;
    font-size: 1rem;
}

body .search-result-item p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    body .knowledge-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    body .article-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    body .knowledge-container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    body .knowledge-header {
        padding: 30px 20px;
        border-radius: 16px;
    }
    
    body .page-title {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    body .knowledge-main {
        padding: 25px 20px;
    }
    
    body .article-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    body .section-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    body .section-header h2 {
        font-size: 1.5rem;
    }
    
    body .search-modal {
        width: 95%;
        margin: 20px;
    }
}

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

body .article-card {
    animation: fadeInUp 0.6s ease-out forwards;
}

body .article-card:nth-child(2) {
    animation-delay: 0.1s;
}

body .article-card:nth-child(3) {
    animation-delay: 0.2s;
}

/* 滚动条样式 */
body .search-results::-webkit-scrollbar {
    width: 6px;
}

body .search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

body .search-results::-webkit-scrollbar-thumb {
    background: #5D3FD3;
    border-radius: 3px;
}

body .search-results::-webkit-scrollbar-thumb:hover {
    background: #4a32a8;
}