/**
 * 知识库列表页面增强样式
 * 包含：文档列表、操作菜单、空状态、搜索高亮等样式
 */

/* ========== 文档列表卡片样式 ========== */
.doc-card {
    padding: 16px 0;
    border-bottom: 1px solid #ebeef5;
    transition: background 0.2s;
    position: relative;
}

.doc-card:hover {
    background: rgba(10, 93, 231, 0.06);
}

.doc-card-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    /*gap: 8px;*/
}

.doc-card-index {
    color: #409eff;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 24px;
    text-align: center;
}

.doc-card-file-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.doc-card-title {
    flex: 1;
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* 关键词高亮 */
.doc-card-title span[style*="color: red"] {
    color: #f56c6c !important;
    font-weight: bold;
}

.doc-card-more {
    color: #c0c4cc;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    user-select: none;
}

.doc-card-more:hover {
    background: #f5f7fa;
    color: #409eff;
}

/* 摘要区域 - 显示2行内容 */
.doc-card-abstract {
    /*padding-left: 48px;*/
    color: #606266;
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}

/* 搜索结果时显示 3 行 */
.search-result .doc-card-abstract {
    -webkit-line-clamp: 3;
}

/* 文件信息底部 */
.doc-card-footer {
    /*padding-left: 48px;*/
    display: flex;
    gap: 24px;
    color: #909399;
    font-size: 12px;
    line-height: 1.5;
    flex-wrap: wrap;
}

.doc-card-footer span {
    background: #f5f5f8;
    padding: 1px 5px;
}

/* 所在位置链接样式 */
.file-location {
    cursor: pointer;
    color: #606266;
    transition: color 0.2s;
}

.file-location:hover {
    color: #409eff;
    text-decoration: underline;
}

/* ========== 文件操作菜单样式 ========== */
.file-action-menu {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.file-action-item i,
.file-action-item span {
    vertical-align: middle;
}

/* ========== 空状态样式 ========== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
    color: #909399;
    margin-top: 16px;
}

.empty-state-subtext {
    font-size: 12px;
    color: #c0c4cc;
    margin-top: 8px;
}

/* 暂无数据空状态专用样式 */
#docList .empty-state {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ========== 搜索结果统计样式 ========== */
.result-info strong {
    color: #f56c6c;
    font-size: 16px;
    font-weight: 600;
}

.filter-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #ecf5ff;
    color: #409eff;
    border-radius: 3px;
    font-size: 12px;
    margin-left: 6px;
}

/* ========== 加载状态样式 ========== */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #909399;
    font-size: 14px;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e4e7ed;
    border-top-color: #409eff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Toast 提示样式增强 ========== */
.kb-toast {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.kb-toast-success {
    background: rgba(103, 194, 58, 0.9) !important;
}

.kb-toast-error {
    background: rgba(245, 108, 108, 0.9) !important;
}

.kb-toast-info {
    background: rgba(64, 158, 255, 0.9) !important;
}

/* ========== 分页样式增强 ========== */
.pagination-container .page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #dcdfe6;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #606266;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    user-select: none;
}

.pagination-container .page-btn:hover {
    color: #0a5de7;
    border-color: #0a5de7;
}

.pagination-container .page-btn.active {
    background: #0a5de7;
    border-color: #0a5de7;
    color: #fff;
    font-weight: 600;
}

.pagination-container .page-btn.active:hover {
    background: #0a5de7;
    border-color: #0a5de7;
    color: #fff;
}

.pagination-container .page-num {
    padding: 0 10px;
    border: 1px solid #0a5de7;
    background: #0a5de7;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.pagination-container .pagination-info {
    color: #606266;
    font-size: 14px;
    user-select: none;
}

.pagination-container .page-input,
.pagination-container .page-size-input {
    width: 45px;
    height: 32px;
    padding: 4px 6px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.pagination-container .page-input:focus,
.pagination-container .page-size-input:focus {
    border-color: #0a5de7;
}

.pagination-container .page-ellipsis {
    color: #909399;
    padding: 0 4px;
    user-select: none;
}

/* ========== 响应式布局 ========== */
@media screen and (max-width: 1200px) {
    .doc-card-footer {
        gap: 16px;
    }
    
    .doc-card-footer span {
        font-size: 11px;
    }
}

@media screen and (max-width: 768px) {
    .doc-card-header {
        flex-wrap: wrap;
    }
    
    .doc-card-title {
        width: 100%;
        font-size: 14px;
    }
    
    .doc-card-footer {
        padding-left: 32px;
        gap: 12px;
    }
    
    .doc-card-abstract {
        /*padding-left: 32px;*/
    }
}

#sidebarNav .nav-children > .tree-item {
    width: calc(100% - 10px);
    border-radius: 6px;
}

#sidebarNav .nav-children > .tree-item .item-label,
#sidebarNav .nav-children > .tree-item .item-count,
#sidebarNav .nav-children > .project-load-more {
    color: #666666;
}

#sidebarNav .nav-children > .tree-item.active {
    background: #ffffff;
}

#sidebarNav .nav-children > .tree-item.active .item-label,
#sidebarNav .nav-children > .tree-item.active .item-count {
    color: #0a5de7;
    font-weight: 400;
}

#sidebarNav .nav-children > .tree-item:hover .item-label,
#sidebarNav .nav-children > .tree-item:hover .item-count {
    color: #0a5de7;
    font-weight: 400;
}

#sidebarNav .nav-children > .project-load-more {
    justify-content: center;
    padding-left: 0;
    text-align: center;
}

/* ========== 辅助类 ========== */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ========== 打印样式 ========== */
@media print {
    .doc-card-more,
    .file-action-menu,
    .sidebar-search,
    .main-search,
    .header-right {
        display: none !important;
    }
    
    .doc-card {
        page-break-inside: avoid;
    }
}
