/**
 * 知识库页面样式
 */

/* 页面背景 */
.knowledge-body {
    background: #fff;
}

.knowledge-body .bg-decorations {
    display: none;
}

/* 页面主容器 */
.knowledge-page {
    padding-top: 90px;
    position: relative;
    z-index: 1;
    background: #fff;
}

/* 两栏布局 */
.knowledge-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 80px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 40px;
    align-items: start;
}

/* 左侧边栏 */
.knowledge-sidebar {
    position: sticky;
    top: 100px;
    background: #f2f3f5;
    border-radius: 8px;
    padding: 16px 12px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
    padding: 8px 10px;
    cursor: pointer;
}

.sidebar-title-icon {
    font-size: 10px;
    color: #666;
}

/* 分类列表 - Discourse 风格 */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #646464;
    text-decoration: none;
    transition: all 0.15s ease;
}

.category-item:hover {
    background: #e8e8e8;
    color: #333;
}

.category-item.active {
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
}

/* 分类小方块 - 恢复方块 */
.category-dot {
    width: 12px;
    height: 12px;
    border-radius: 0px;
    background: var(--color-primary);
    flex-shrink: 0;
}

/* 不同分类使用不同颜色 - 参考上传图 (方块样式) */
.category-item:nth-child(1) .category-dot {
    background-color: #FF5722;
}

.category-item:nth-child(2) .category-dot {
    background-color: #4FC3F7;
}

.category-item:nth-child(3) .category-dot {
    background-color: #4CAF50;
}

.category-item:nth-child(4) .category-dot {
    background-color: #FF9800;
}

.category-item:nth-child(5) .category-dot {
    background-color: #BA68C8;
}

.category-item:nth-child(6) .category-dot {
    background-color: #009688;
}

.category-item:nth-child(7) .category-dot {
    background-color: #FFEB3B;
}

.category-item:nth-child(8) .category-dot {
    background-color: #F06292;
}

.category-item:nth-child(9) .category-dot {
    background-color: #0056b3;
}

.category-item:nth-child(10) .category-dot {
    background-color: #9e9e9e;
}

.category-item.active .category-dot {
    /* 保持原有颜色，或者稍微加亮 */
    filter: brightness(1.2) contrast(1.1);
}

.category-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 分类图标 */
.category-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* 右侧主内容区 */
.knowledge-main {
    min-width: 0;
}

/* 文章元信息行 - 分类、作者、日期放一行 */
.article-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.meta-divider {
    color: #ccc;
}

.article-meta-row .author-name {
    font-size: 14px;
    color: #333;
}

.article-meta-row .publish-date {
    font-size: 14px;
    color: #999;
}

.article-tag-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    padding: 4px 10px;
    background: rgba(0, 136, 204, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.article-tag-link:hover {
    background: rgba(0, 136, 204, 0.2);
}

.article-tag-link .category-dot {
    width: 8px;
    height: 8px;
}

/* 返回列表链接 */
.back-to-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-to-list:hover {
    background: rgba(0, 102, 255, 0.06);
    color: var(--color-primary);
}

/* 右侧内容区 - 列表页 */

.knowledge-header {
    padding-bottom: 16px;
    border-bottom: 1px solid #e9e9e9;
    margin-bottom: 8px;
}

.knowledge-title {
    font-size: 20px;
    font-weight: 600;
    color: #222;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.knowledge-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 2px;
}

.knowledge-desc {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* 文章列表 - Discourse 极简风格 */
.article-list {
    display: flex;
    flex-direction: column;
}

.article-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
    border-bottom: 1px solid #e9e9e9;
    text-decoration: none;
    transition: background 0.15s ease;
}

.article-item:hover {
    background: #f8f9fa;
    margin: 0 -12px;
    padding: 16px 12px;
}

.article-info {
    flex: 1;
    min-width: 0;
}

.article-title {
    font-size: 16px;
    font-weight: 400;
    color: #222;
    margin: 0 0 6px;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.article-item:hover .article-title {
    color: var(--color-primary);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 分类小点 - 列表页 */
.article-meta .category-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--color-primary);
    flex-shrink: 0;
}

.article-category-name {
    font-size: 13px;
    color: #646464;
}

.article-stats {
    flex-shrink: 0;
    text-align: right;
}

.article-date {
    font-size: 14px;
    color: #919191;
}

/* 元信息图标 - 详情页 */
.meta-icon {
    font-size: 12px;
    margin-right: 2px;
}

/* ========================================
   右侧内容区域 - 详情页
   ======================================== */
.article-header {
    margin-bottom: 32px;
}

.article-breadcrumb {
    margin-bottom: 16px;
}

.breadcrumb-category {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    padding: 6px 12px;
    background: rgba(0, 102, 255, 0.08);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.breadcrumb-category:hover {
    background: rgba(0, 102, 255, 0.15);
}

.breadcrumb-category .category-dot {
    width: 8px;
    height: 8px;
}

.article-main-title {
    font-size: 24px;
    font-weight: 600;
    color: #222;
    margin: 0 0 16px;
    line-height: 1.4;
}

.article-author-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.publish-date {
    font-size: 13px;
    color: #999;
}

.article-views {
    font-size: 13px;
    color: #999;
}

/* 文章正文 */
.article-body {
    margin-bottom: 48px;
}

.article-summary {
    background: #f8f9fa;
    border-left: 4px solid var(--color-primary);
    padding: 20px 24px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 32px;
}

.article-summary p {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
    margin: 0;
}

/* AI摘要样式 - 渐变背景 */
.article-summary-box {
    background-image: linear-gradient(180deg, rgba(247, 232, 255, .54), rgba(191, 223, 255, .35));
    border-radius: 9px;
    padding: 15px 20px;
    margin-bottom: 32px;
}

.summary-header {
    color: #6e4bfa;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
}

.summary-content {
    font-size: 15px;
    line-height: 1.7;
    color: #333;
}

.summary-footer {
    font-size: 13px;
    color: #848691;
    margin-top: 10px;
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    color: #1a1a2e;
    margin-top: 32px;
    margin-bottom: 16px;
}

.article-content h1 {
    font-size: 28px;
}

.article-content h2 {
    font-size: 24px;
}

.article-content h3 {
    font-size: 20px;
}

.article-content h4 {
    font-size: 18px;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content ul,
.article-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

.article-content blockquote {
    background: #f8f9fa;
    border-left: 4px solid #ddd;
    padding: 16px 20px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.article-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

.article-content pre {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}

.article-content pre code {
    background: transparent;
    padding: 0;
}

/* 相关文章 */
.related-articles {
    border-top: 1px solid #e5e7eb;
    padding-top: 32px;
}

.related-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-item:hover {
    background: rgba(0, 102, 255, 0.08);
}

.related-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--color-primary);
    flex-shrink: 0;
}

.related-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.related-name {
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-item:hover .related-name {
    color: var(--color-primary);
}

/* 空内容提示 */
.knowledge-page .empty-content {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    background: #f9f9f9;
    border-radius: 8px;
}

/* ========================================
   响应式布局
   ======================================== */
@media (max-width: 1024px) {
    .knowledge-layout {
        grid-template-columns: 200px 1fr;
        gap: 32px;
        padding: 32px 24px 60px;
    }

    .knowledge-title {
        font-size: 28px;
    }

    .article-main-title {
        font-size: 30px;
    }
}

@media (max-width: 768px) {
    .knowledge-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .knowledge-sidebar {
        position: static;
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
    }

    .sidebar-section {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .sidebar-title {
        display: none;
    }

    .category-list {
        flex-direction: row;
        gap: 8px;
    }

    .category-item {
        white-space: nowrap;
        padding: 8px 14px;
    }

    .category-count {
        display: none;
    }

    .knowledge-title {
        font-size: 24px;
    }

    .article-main-title {
        font-size: 26px;
    }

    .article-item {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .article-info {
        width: 100%;
        text-align: left;
    }

    .article-stats {
        align-self: flex-start;
        width: 100%;
        text-align: left;
    }

    .article-excerpt {
        display: none;
    }

    .category-list {
        gap: 6px;
    }

    .category-item {
        padding: 6px 12px;
        font-size: 13px;
    }

    .article-item {
        padding: 14px 0;
    }
}

@media (max-width: 576px) {
    .knowledge-page {
        padding-top: 80px;
    }

    .knowledge-layout {
        padding: 24px 16px 40px;
    }

    .knowledge-title {
        font-size: 22px;
    }

    .article-main-title {
        font-size: 22px;
    }

    .article-title {
        font-size: 15px;
    }

    .article-author-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .article-content {
        font-size: 15px;
    }
}