/* 知识库管理容器样式 */
.kb-knowledge-base-container {
    width: 80%;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
}

/* 菜单网格布局 - 一行三个 */
.kb-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

/* 菜单项样式 - 确保可点击、视觉反馈 */
.kb-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    /* 防止点击事件被遮挡 */
    position: relative;
    z-index: 1;
}

.kb-menu-item:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.kb-menu-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.kb-menu-text {
    font-size: 14px;
    color: #333;
}

/* 已选文件列表样式 */
.kb-selected-files {
    margin-bottom: 20px;
}

.kb-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.kb-file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kb-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background-color: #f9fafb;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.kb-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-file-icon {
    font-size: 16px;
}

.kb-file-name {
    font-size: 14px;
    color: #333;
}

.kb-delete-btn {
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    background-color: #ef4444;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    /* 防止点击穿透 */
    pointer-events: auto;
}

.kb-file-type, .kb-file-type-upload {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.kb-file-type {
    background-color: #e0f2fe;
    color: #0369a1;
}

.kb-file-type-upload {
    background-color: #fef3c7;
    color: #d97706;
}

.kb-pending-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background-color: #fee2e2;
    color: #dc2626;
    margin-left: 8px;
}



/* 按钮组样式 */
.kb-btn-group {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.kb-cancel-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 14px;
}

.kb-confirm-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

/* 上传input样式 - 确保可触发 */
.kb-upload-input {
    cursor: pointer;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 2;
}

/* 空列表提示 */
.kb-empty-tip {
    padding: 10px;
    color: #999;
    font-size: 14px;
    text-align: center;
}

/* ====================================== */
/* 调整：上传模块样式（和云盘/企微文档统一） */
/* ====================================== */
/* 上传容器外层 - 适配kb-menu-item的图标+文字布局 */
.add-form-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* 上传按钮容器（核心）- 调整为和其他菜单图标同尺寸 */
.headimg-uploader {
    position: relative;
    width: 24px; /* 和kb-menu-icon同尺寸 */
    height: 24px;
    margin: 0 auto 8px; /* 图标和文字间距和其他菜单一致 */
    text-align: center;
    cursor: pointer;
}

/* 参考样式的上传input（隐藏覆盖） */
.kb-uploader-input {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 44px; /* 扩大点击区域，避免点不到 */
    height: 44px;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* 上传图标按钮 - 完全匹配kb-menu-icon样式 */
.kb-uploader-plus {
    width: 24px; /* 和云盘/企微文档图标同尺寸 */
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent; /* 移除背景，和其他菜单图标一致 */
    border-radius: 0; /* 移除圆角 */
    transition: none;
}

/* 上传图标样式 - 完全匹配kb-menu-icon */
.upload-icon {
    font-size: 24px; /* 和kb-menu-icon字体大小一致 */
    color: #333; /* 和其他菜单图标颜色一致 */
    font-weight: normal;
    /* 用上传箭头更贴合语义，和其他图标风格统一 */
    content: "⬆️";
}

/* 上传提示文字 - 匹配kb-menu-text样式 */
.know-desc {
    font-size: 14px; /* 和kb-menu-text字体大小一致 */
    color: #333; /* 和其他菜单文字颜色一致 */
    margin-top: 0; /* 移除额外间距 */
    text-align: center;
    padding-left: 0 !important;
}

/* 上传进度条 - 调整位置，不影响整体布局 */
.kb-assets-progress-percent {
    position: absolute;
    bottom: -20px; /* 移到文字下方，不遮挡图标/文字 */
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
    color: #1890ff;
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
    z-index: 5;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

/* 移除多余样式（避免冲突） */
.kb-uploader-plus img {
    display: none;
}
.kb-uploader-plus:hover {
    background: transparent;
}
.kb-uploader-plus:hover .kb-upload-icon {
    color: #333; /* 移除hover变色，和其他菜单hover逻辑统一 */
}

/* ====================================== */
/* 文件选择列表样式 */
/* ====================================== */
.kb-checkbox-list {
    max-height: 400px;
    overflow-y: auto;
}

.kb-checkbox-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.kb-checkbox-item:last-child {
    border-bottom: none;
}

.kb-checkbox-item:hover {
    background-color: #fafafa;
}

.kb-checkbox-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kb-file-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007bff;
}

.kb-checkbox-left .kb-file-icon {
    font-size: 18px;
}

.kb-checkbox-left .kb-file-name {
    font-size: 14px;
    color: #333;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-file-size {
    font-size: 12px;
    color: #999;
    min-width: 60px;
    text-align: right;
}

.kb-empty-tip {
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    text-align: center;
}

/* 知识库tab布局样式 - kn-前缀 */
.kn-kb-layout {
    display: flex;
    height: 100%;
    min-height: 500px;
}

.kn-kb-sidebar {
    width: 200px;
    min-width: 200px;
    background-color: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 15px 0;
}

.kn-kb-sidebar-title {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kn-kb-create-btn {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: normal;
    color: #fff;
    background: #409eff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.kn-kb-create-btn:hover {
    background: #66b1ff;
}

.kn-kb-nav-delete {
    margin-left: auto;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.kn-kb-nav-delete:hover {
    background: #f56c6c;
    color: #fff;
}

.kn-kb-nav-list {
    padding: 0 10px;
}

.kn-kb-nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.kn-kb-nav-item:hover {
    background-color: #f0f0f0;
}

.kn-kb-nav-active {
    background-color: #e6f4ff;
}

.kn-kb-nav-active .kn-kb-nav-name {
    color: #1890ff;
    font-weight: 500;
}

.kn-kb-nav-icon {
    font-size: 16px;
    margin-right: 10px;
}

.kn-kb-nav-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.kn-kb-nav-count {
    font-size: 12px;
    color: #999;
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.kn-kb-nav-active .kn-kb-nav-count {
    background-color: #1890ff;
    color: #fff;
}

.kn-kb-main {
    flex: 1;
    max-width: calc(100% - 200px);
    padding: 20px;
    overflow: auto;
    background-color: #fff;
}

.kn-kb-layout-no-sidebar .kn-kb-main {
    max-width: 100%;
    flex: 1;
    border-radius: 8px;
}

#kn-kb-table-container,
#kn-kb-table-container-0,
#kn-kb-table-container-1,
#kn-kb-table-container-3 {
    height: 100%;
}

/* 知识库加载状态样式 */
.kn-kb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 200px;
    background-color: #ffffff;
    color: #909399;
}

.kn-kb-loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid #e4e7ed;
    border-top-color: #409eff;
    border-radius: 50%;
    animation: kn-kb-spin 0.8s linear infinite;
}

.kn-kb-loading-text {
    margin-top: 8px;
    font-size: 12px;
}

@keyframes kn-kb-spin {
    to {
        transform: rotate(360deg);
    }
}

.kn-kb-loading-placeholder {
    background: linear-gradient(90deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: kn-kb-loading-shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes kn-kb-loading-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.kn-kb-sidebar.kn-kb-loading-sidebar {
    background-color: #ffffff;
    border-right-color: #e4e7ed;
}

.kn-kb-main.kn-kb-loading-main {
    background-color: #ffffff;
}

.kn-kb-sidebar-loading {
    padding: 10px;
}

.kn-kb-sidebar-loading-item {
    height: 32px;
    margin-bottom: 6px;
}

.kn-kb-main-loading {
    padding: 15px;
}

.kn-kb-main-loading-item {
    height: 24px;
    margin-bottom: 10px;
}

.kn-kb-main-loading-item:last-child {
    width: 60%;
}

.kn-kb-empty-tip {
    padding: 20px;
    color: #999;
    font-size: 14px;
    text-align: center;
    background-color: transparent;
}
