/* 知识库页面样式 */

.knowledge-base-container {
    min-height: calc(100vh - 200px);
    padding: 120px 0 60px;
    background: var(--bg-body);
}

.page-header {
    text-align: center;
    margin-bottom: 48px;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* 工具栏 */
.toolbar-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.toolbar-left {
    display: flex;
    gap: 12px;
}

.toolbar-btn {
    padding: 8px 16px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.toolbar-right {
    display: flex;
    align-items: center;
}

.stats-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stats-info strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* 搜索区域 */
.search-section {
    margin-bottom: 48px;
}

.search-box {
    display: flex;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.category-filter {
    padding: 14px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--bg-body);
    color: var(--text-main);
    cursor: pointer;
    min-width: 140px;
    outline: none;
    border: 1px solid var(--border-color);
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    font-size: 1rem;
    outline: none;
    background: transparent;
    color: var(--text-main);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    padding: 14px 32px;
    background: var(--gradient-brand);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.search-suggestions {
    max-width: 800px;
    margin: 12px auto 0;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--bg-body);
}

.suggestion-item.highlight {
    background: var(--bg-body);
    color: var(--primary-color);
}

/* 分类区域 */
.categories-section {
    margin-bottom: 48px;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-brand);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.category-card:hover::before {
    transform: scaleX(1);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    line-height: 1;
}

.category-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.category-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.category-count {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-body);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* 知识列表区域 */
.knowledge-list-section {
    margin-top: 48px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.back-btn {
    padding: 10px 20px;
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.knowledge-list {
    display: grid;
    gap: 16px;
}

.knowledge-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.knowledge-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.knowledge-header {
    display: flex;
    align-items: start;
    gap: 16px;
    margin-bottom: 12px;
}

.knowledge-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.knowledge-title {
    flex: 1;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.5;
}

.knowledge-content {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.knowledge-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.knowledge-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.knowledge-tag {
    padding: 4px 12px;
    background: var(--bg-body);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.8rem;
}

/* 知识详情模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalFadeIn 0.3s ease;
    border: 1px solid var(--border-light);
}

.modal-large {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    justify-content: flex-end;
    background: var(--bg-body);
    border-radius: 0 0 16px 16px;
}

.modal-action-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.modal-action-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.knowledge-detail-content {
    line-height: 1.8;
    color: var(--text-secondary);
}

.knowledge-detail-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 24px;
    margin-bottom: 12px;
}

.knowledge-detail-content h3:first-child {
    margin-top: 0;
}

.knowledge-detail-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
}

.knowledge-detail-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.knowledge-detail-content ul,
.knowledge-detail-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
    color: var(--text-secondary);
}

.knowledge-detail-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.knowledge-detail-content strong {
    color: var(--text-main);
    font-weight: 600;
}

/* 加载提示 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.empty-state-hint {
    font-size: 0.9rem;
    color: var(--text-light);
}


/* 响应式设计 */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }

    .toolbar-section {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .toolbar-left {
        flex-direction: column;
    }

    .toolbar-btn {
        width: 100%;
        justify-content: center;
    }

    .search-box {
        flex-direction: column;
    }

    .category-filter {
        width: 100%;
    }

    .search-btn {
        width: 100%;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-action-btn {
        flex: 1;
        min-width: calc(50% - 6px);
    }
}

