/* 
   弱电知识库页面样式
   Knowledge Base Page Styles
*/

/* 第一部分：页面介绍区域 */
.knowledge-intro-section {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.intro-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 60px 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.intro-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-primary);
}

.intro-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.3);
}

.intro-icon i {
    font-size: 3rem;
    color: #ffffff;
}

.intro-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--text-primary);
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.intro-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: left;
}

/* 投稿区域 */
.contribution-box {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
    border-radius: 15px;
    border: 2px solid rgba(0, 123, 255, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 25px;
    text-align: left;
}

.contribution-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.2);
}

.contribution-icon i {
    font-size: 1.8rem;
    color: #ffffff;
}

.contribution-content {
    flex: 1;
}

.contribution-content h4 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.contribution-content p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.contribution-btn {
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.2);
}

.contribution-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
}

/* 第二部分：分类筛选和文章列表 */
.knowledge-list-section {
    padding: 80px 0;
}

/* 左侧：分类导航侧边栏容器 - 确保左右间距 */
.knowledge-list-section .row {
    margin-left: 0;
    margin-right: 0;
}

.knowledge-list-section .row > .col-lg-3 {
    padding-right: 25px; /* 保持与右侧内容的间距 */
}

.knowledge-list-section .row > .col-lg-9 {
    padding-left: 25px; /* 保持与左侧侧边栏的间距 */
}

/* 桌面端确保有足够的间距 */
@media (min-width: 992px) {
    .knowledge-list-section .row > .col-lg-3 {
        padding-right: 30px;
    }

    .knowledge-list-section .row > .col-lg-9 {
        padding-left: 30px;
    }
}

/* 左侧：分类导航侧边栏 */
.knowledge-sidebar {
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    padding: 0;
    position: sticky;
    top: 120px; /* 距离顶部的位置，考虑导航栏高度 */
    transition: none; /* 移除transition，避免宽度变化时的闪烁 */
    z-index: 100;
    max-width: 100%; /* 确保不超过父容器宽度 */
    width: 100%; /* 确保在sticky状态下占满容器宽度 */
    box-sizing: border-box; /* 包含padding和border，确保宽度计算一致 */
    min-width: 0; /* 允许flex收缩 */
    will-change: transform; /* 提示浏览器优化 */
}

/* 确保fixed状态下也使用相同的box-sizing */
.knowledge-sidebar.fixed {
    box-sizing: border-box !important;
    transition: none; /* 固定状态下不使用transition */
}

.knowledge-sidebar.sticky {
    top: 100px; /* 滚动后调整位置 */
}

/* 当侧边栏固定时，确保保持正确的宽度和位置 */
.knowledge-sidebar.fixed {
    position: fixed;
    box-sizing: border-box; /* 确保宽度计算一致 */
    transition: none; /* 避免宽度变化时的闪烁 */
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 2px solid #f1f5f9;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 15px 15px 0 0;
}

.sidebar-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
    padding: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-item:hover {
    background: #f8fafc;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    padding-left: 25px;
}

.sidebar-item.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-item span {
    flex: 1;
    font-size: 0.95rem;
}

/* 文章列表 */
.articles-container {
    min-height: 400px;
}

.article-card {
    background: #ffffff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    margin-bottom: 30px;
    display: flex;
    flex-direction: row;
    height: auto;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
}

.article-image-wrapper {
    flex-shrink: 0;
    width: 320px;
    height: 220px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--primary-color) 0%, rgba(139, 92, 246, 0.8) 100%);
}

.article-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.article-card:hover .article-image-wrapper::after {
    opacity: 1;
}

.article-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-card:hover .article-image {
    transform: scale(1.08);
}

.article-card:hover .article-image {
    transform: scale(1.05);
}

.article-category-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    z-index: 2;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
}

.article-body {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.article-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.article-title a:hover {
    color: var(--primary-color);
}

.article-description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 25px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
}

.article-meta-item i {
    font-size: 0.9rem;
    color: var(--primary-color);
}

.article-link {
    margin-top: 15px;
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-wrap: nowrap;
    width: fit-content;
    max-width: 100%;
}

.article-link:hover {
    gap: 12px;
    color: rgba(139, 92, 246, 0.9);
}

.article-link i {
    transition: transform 0.3s ease;
    flex-shrink: 0;
    display: inline-block;
    line-height: 1;
}

.article-link:hover i {
    transform: translateX(5px);
}

/* 分页样式 */
.pagination-wrapper {
    margin-top: 50px;
}

.pagination {
    gap: 10px;
}

.pagination .page-item {
    margin: 0 3px;
}

.pagination .page-link {
    padding: 10px 18px;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(118, 75, 162, 0.03) 100%);
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, rgba(139, 92, 246, 0.8) 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}

.pagination .page-item.disabled .page-link:hover {
    transform: none;
    border-color: #e2e8f0;
    color: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    font-size: 5rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state-text {
    font-size: 1rem;
    color: var(--text-muted);
}

/* 响应式设计 */
@media (max-width: 991.98px) {
    .knowledge-list-section .row > .col-lg-3,
    .knowledge-list-section .row > .col-lg-9 {
        padding-left: 15px;
        padding-right: 15px;
    }

    .knowledge-sidebar {
        position: relative !important;
        top: 0 !important;
        width: 100% !important;
        left: auto !important;
        margin-bottom: 30px;
    }

    .knowledge-sidebar.sticky,
    .knowledge-sidebar.fixed {
        position: relative !important;
        width: 100% !important;
        left: auto !important;
    }

    .article-card {
        flex-direction: column;
    }

    .article-image-wrapper {
        width: 100%;
        height: 220px;
    }
}

@media (max-width: 768px) {
    .intro-card {
        padding: 40px 30px;
    }

    .intro-title {
        font-size: 2rem;
    }

    .intro-description {
        font-size: 1rem;
    }

    .contribution-box {
        flex-direction: column;
        text-align: center;
    }

    .contribution-icon {
        margin: 0 auto;
    }

    .sidebar-header {
        padding: 20px 15px;
    }

    .sidebar-header h3 {
        font-size: 1.1rem;
    }

    .article-body {
        padding: 20px;
    }

    .article-title {
        font-size: 1.15rem;
    }

    .article-image-wrapper {
        height: 180px;
    }

    .pagination .page-link {
        padding: 8px 14px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .intro-card {
        padding: 30px 20px;
    }

    .intro-icon {
        width: 80px;
        height: 80px;
    }

    .intro-icon i {
        font-size: 2.5rem;
    }

    .intro-title {
        font-size: 1.75rem;
    }

    .sidebar-item {
        padding: 12px 15px;
    }

    .sidebar-item i {
        width: 18px;
        margin-right: 10px;
        font-size: 0.9rem;
    }

    .sidebar-item span {
        font-size: 0.85rem;
    }

    .article-image-wrapper {
        height: 180px;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .page-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}
