/* Knowledge 页面样式 */

/* 按钮样式 */
.btn-primary {
  background-color: #f97316;
  border: none;
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-primary:hover {
  background-color: #ea580c;
}

/* 搜索框 */
.search-input {
  background-color: #171922;
  border: 1px solid #374151;
  color: white;
  padding: 10px 12px 10px 36px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: #ffffff;
}

.search-input::placeholder {
  color: #6b7280;
}

/* 表格样式 */
.bg-dark-700 {
  background-color: #171922;
}

.bg-dark-600 {
  background-color: #1a1c25;
}

.table-row {
  border-bottom: 1px solid #374151;
}

/* 空状态 */
.empty-box {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-icon {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f2937, #111827);
  border-radius: 24px;
  margin-bottom: 20px;
}

.empty-icon i {
  font-size: 40px;
  color: #6b7280;
}

.empty-text {
  color: #d1d5db;
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.empty-tip {
  color: #6b7280;
  font-size: 0.875rem;
}

/* 基础弹窗样式 */
.kb-dialog :deep(.el-dialog) {
  background-color: #1f2937;
  border-radius: 12px;
  border: 1px solid #374151;
}

.kb-dialog :deep(.el-dialog__header) {
  padding: 20px 24px;
  border-bottom: 1px solid #374151;
}

.kb-dialog :deep(.el-dialog__title) {
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.kb-dialog :deep(.el-dialog__headerbtn) {
  top: 20px;
  right: 20px;
}

.kb-dialog :deep(.el-dialog__headerbtn .el-dialog__close) {
  color: #9ca3af;
}

.kb-dialog :deep(.el-dialog__headerbtn:hover .el-dialog__close) {
  color: #ffffff;
}

.kb-dialog :deep(.el-dialog__body) {
  padding: 24px;
}

.kb-dialog :deep(.el-dialog__footer) {
  padding: 16px 24px;
  border-top: 1px solid #374151;
}

.dialog-desc {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 20px;
}

.kb-dialog :deep(.el-button--primary) {
  background-color: #ffffff;
  border-color: #ffffff;
}

.kb-dialog :deep(.el-button--primary:hover) {
  background-color: #ea580c;
  border-color: #ea580c;
}

/* 创建弹窗样式 */
.kb-create-dialog :deep(.el-dialog) {
  background-color: #0f1419;
  border-radius: 16px;
  border: 1px solid #1e2832;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.kb-create-dialog :deep(.el-dialog__header) {
  padding: 20px 24px;
  border-bottom: 1px solid #1e2832;
}

.kb-create-dialog :deep(.el-dialog__title) {
  color: #e8eaed;
  font-size: 18px;
  font-weight: 600;
}

.kb-create-dialog :deep(.el-dialog__headerbtn) {
  top: 18px;
  right: 18px;
}

.kb-create-dialog :deep(.el-dialog__headerbtn .el-dialog__close) {
  color: #5f6368;
  font-size: 18px;
}

.kb-create-dialog :deep(.el-dialog__headerbtn:hover .el-dialog__close) {
  color: #e8eaed;
}

.kb-create-dialog :deep(.el-dialog__body) {
  padding: 0;
}

.kb-create-dialog :deep(.el-dialog__footer) {
  padding: 20px 24px;
  border-top: 1px solid #1e2832;
  background-color: #0d1117;
  border-radius: 0 0 16px 16px;
}

/* 创建内容布局 */
.create-layout {
  display: flex;
  min-height: 600px;
}

/* 左侧 sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  border-right: 1px solid #1e2832;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

.menu-item:hover {
  background-color: rgba(54, 191, 250, 0.06);
  border-color: rgba(54, 191, 250, 0.1);
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(54, 191, 250, 0.12) 0%, rgba(14, 165, 233, 0.08) 100%);
  border-color: rgba(54, 191, 250, 0.25);
}

.menu-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.menu-item.disabled .menu-content {
  opacity: 0.5;
}

.menu-check {
  color: #22c55e;
  font-size: 14px;
}

.menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: #1e2832;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #5f6368;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.menu-item.active .menu-icon {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.menu-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-title {
  font-size: 14px;
  font-weight: 600;
  color: #e8eaed;
  transition: color 0.2s;
  white-space: nowrap;
}

.menu-item.active .menu-title {
  color: #ffffff;
}

.menu-desc {
  font-size: 12px;
  color: #5f6368;
}

.menu-arrow {
  font-size: 12px;
  color: #ffffff;
}

/* 右侧内容区 */
.content {
  flex: 1;
  padding: 36px 48px;
  background-color: #0f1419;
}

.form-content {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 区块标题 */
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid #1e2832;
}

.section-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(234, 88, 12, 0.12) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: #e8eaed;
}

/* 表单样式 */
.kb-form :deep(.el-form-item__label) {
  color: #9aa0a6;
  font-size: 13px;
  font-weight: 500;
  padding-bottom: 8px;
}

.kb-form :deep(.el-input__wrapper) {
  background-color: #161b22;
  border: 1px solid #2d3640;
  border-radius: 8px;
  box-shadow: none;
  padding: 4px 12px;
}

.kb-form :deep(.el-input__wrapper:hover) {
  border-color: #ffffff;
}

.kb-form :deep(.el-input__wrapper.is-focus) {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(54, 191, 250, 0.15);
}

.kb-form :deep(.el-input__wrapper input) {
  color: #e8eaed !important;
  -webkit-text-fill-color: #e8eaed !important;
  font-size: 14px;
}

.kb-form :deep(.el-input__wrapper input::placeholder) {
  color: #6b7280 !important;
  -webkit-text-fill-color: #6b7280 !important;
}

.kb-form :deep(.el-input__wrapper) {
  background-color: #161b22 !important;
}

.kb-form :deep(.el-input__wrapper input) {
  background-color: transparent !important;
}

.kb-form :deep(.el-textarea__inner) {
  background-color: #161b22;
  border: 1px solid #2d3640;
  border-radius: 8px;
  color: #e8eaed !important;
  -webkit-text-fill-color: #e8eaed !important;
  font-size: 14px;
  box-shadow: none;
  padding: 12px;
}

.kb-form :deep(.el-textarea__inner::placeholder) {
  color: #6b7280 !important;
  -webkit-text-fill-color: #6b7280 !important;
}

.kb-form :deep(.el-textarea__inner:hover) {
  border-color: #ffffff;
}

.kb-form :deep(.el-textarea__inner:focus) {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(54, 191, 250, 0.15);
}

.kb-form :deep(.el-select) {
  width: 100%;
}

.kb-form :deep(.el-select .el-input__wrapper) {
  background-color: #161b22;
  border: 1px solid #2d3640;
  border-radius: 8px;
  box-shadow: none;
  padding: 4px 12px;
}

.kb-form :deep(.el-select .el-input__wrapper:hover) {
  border-color: #ffffff;
}

.kb-form :deep(.el-select .el-input__wrapper.is-focus) {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(54, 191, 250, 0.15);
}

/* 提供商选项 */
.provider-option {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e8eaed;
}

.provider-option i {
  color: #ffffff;
}

/* 模型选项 */
.model-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #e8eaed;
}

.model-option .model-name {
  font-weight: 500;
}

.model-option .model-info {
  font-size: 12px;
  color: #9ca3af;
}

/* Parsing 配置样式 */
.parsing-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.parsing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #161b22;
  border-radius: 8px;
  border: 1px solid #2d3640;
}

.parsing-label {
  font-size: 14px;
  color: #e8eaed;
  font-weight: 500;
}

.parsing-select {
  width: 200px;
}

.parsing-select :deep(.el-input__wrapper) {
  background-color: #1e2832;
  border-color: #2d3640;
}

.parsing-input {
  width: 200px;
}

.parsing-input :deep(.el-input__wrapper) {
  background-color: #1e2832;
  border-color: #2d3640;
}

/* Switch 样式 */
:deep(.el-switch.is-checked .el-switch__core) {
  background-color: #ffffff;
  border-color: #ffffff;
}

.parsing-divider {
  height: 1px;
  background-color: #2d3640;
  margin: 8px 0;
}

/* Post-processing 列表 */
.postprocess-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.postprocess-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background-color: #161b22;
  border-radius: 8px;
  border: 1px solid #2d3640;
  transition: all 0.2s;
}

.postprocess-item.active {
  border-color: rgba(54, 191, 250, 0.3);
  background: linear-gradient(135deg, rgba(54, 191, 250, 0.05) 0%, transparent 100%);
}

.postprocess-toggle {
  flex-shrink: 0;
  padding-top: 2px;
}

.postprocess-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.postprocess-title {
  font-size: 14px;
  color: #e8eaed;
  font-weight: 500;
}

.postprocess-desc {
  font-size: 12px;
  color: #5f6368;
}

/* 底部按钮区域 */
.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left {
  display: flex;
  align-items: center;
}

.step-hint {
  font-size: 12px;
  color: #5f6368;
}

/* 文件上传弹窗布局 */
.file-upload-dialog .el-dialog {
  position: absolute !important;
  top: 8px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin-bottom: 8px !important;
  max-height: calc(100vh - 16px);
}

.file-upload-dialog .el-dialog__body {
  padding: 0;
}

.file-upload-layout {
  display: flex;
  flex-direction: column;
  height: 85vh;
  background-color: #0f1419;
}

/* 顶部导航 */
.file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: #121218;
  border-bottom: 1px solid #2a2a3a;
}

.back-btn {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
}

.back-btn:hover {
  background-color: #1e2832;
  color: #ffffff;
}

.file-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

/* 标签栏 */
.file-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  background-color: #121218;
  border-bottom: 1px solid #2a2a3a;
}

.file-tab {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
}

.file-tab:hover {
  background-color: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

.file-tab.active {
  background-color: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

/* 主内容区 */
.file-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 左侧文件列表 */
.file-list {
  width: 420px;
  background-color: #0f1419;
  border-right: 1px solid #2a2a3a;
  overflow-y: auto;
  padding: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
  border: 2px solid transparent;
}

.file-item:hover {
  background-color: rgba(249, 115, 22, 0.08);
}

.file-item.selected {
  background-color: rgba(249, 115, 22, 0.12);
  border-color: #f97316;
}

.file-item-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-item-icon i {
  font-size: 18px;
  color: white;
}

.file-item-info {
  flex: 1;
  min-width: 0;
}

.file-item-name {
  font-size: 14px;
  color: #e8eaed;
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-meta {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  gap: 8px;
}

.file-item-status {
  flex-shrink: 0;
}

.file-item-status i {
  font-size: 14px;
}

.file-item-status.success i {
  color: #22c55e;
}

.file-item-status.failed i {
  color: #ef4444;
}

.file-item-status.parsing i {
  color: #f59e0b;
}

/* 右侧预览面板 */
.file-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #121218;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a3a;
  flex-wrap: wrap;
  gap: 12px;
}

.preview-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-header-left i {
  font-size: 28px;
  color: #3b82f6;
}

.preview-filename {
  font-size: 15px;
  color: #e8eaed;
  font-weight: 500;
}

.preview-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.info-tag {
  font-size: 12px;
  color: #9ca3af;
  background-color: #1e2832;
  padding: 4px 10px;
  border-radius: 4px;
}

.info-tag.success {
  background-color: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.preview-content {
  flex: 1;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.pdf-preview {
  flex: 1;
  min-height: 0;
  background-color: #1a1a1a;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.preview-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 12px;
  color: #6b7280;
}

.info-value {
  font-size: 14px;
  color: #e8eaed;
}

.info-value.success {
  color: #22c55e;
}

.preview-text {
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  overflow: hidden;
}

.preview-section-title {
  font-size: 13px;
  font-weight: 500;
  color: #e8eaed;
  padding: 12px 16px;
  background-color: #1a1c25;
  border-bottom: 1px solid #2a2a3a;
}

.preview-text-content {
  padding: 16px;
  background-color: #0f1419;
  max-height: 320px;
  overflow-y: auto;
}

.preview-text-content p {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.7;
  margin: 0 0 8px 0;
}

.preview-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #2a2a3a;
  background-color: #1a1c25;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  border-color: #f97316;
  color: #f97316;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-size: 13px;
  color: #9ca3af;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #2a2a3a;
  background-color: #0f1419;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.action-btn.delete {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.action-btn.delete:hover {
  background-color: rgba(239, 68, 68, 0.25);
}

.action-btn.reparse {
  background-color: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.action-btn.reparse:hover {
  background-color: rgba(249, 115, 22, 0.25);
}

.action-btn.confirm {
  background-color: #f97316;
  color: white;
}

.action-btn.confirm:hover {
  background-color: #ea580c;
}

.file-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.file-menu-item:hover {
  background-color: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

.file-menu-item.active {
  background-color: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border-right: 3px solid #f97316;
}

.file-menu-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.file-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.content-title {
  font-size: 18px;
  font-weight: 600;
  color: #e8eaed;
  margin-bottom: 20px;
}

/* 上传区域 */
.upload-area {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.upload-box {
  flex: 1;
  border: 2px dashed #3a3a4a;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.upload-box:hover {
  border-color: #f97316;
  background-color: rgba(249, 115, 22, 0.05);
}

.upload-btn {
  position: absolute;
  bottom: 20px;
  left: 20px;
}

.upload-icon {
  font-size: 48px;
  color: #5f6368;
  margin-bottom: 16px;
}

.upload-text {
  font-size: 16px;
  color: #e8eaed;
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 13px;
  color: #6b7280;
}

.upload-btn {
  margin-top: 8px;
}

.file-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  color: #9ca3af;
  font-size: 14px;
}

.doc-list,
.doc-chunks,
.parsing-config,
.storage-config {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.footer-right {
  display: flex;
  gap: 10px;
}

.cancel-btn {
  background-color: transparent;
  border: 1px solid #2d3640;
  color: #9aa0a6;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.cancel-btn:hover {
  border-color: #5f6368;
  color: #e8eaed;
  background-color: rgba(255, 255, 255, 0.03);
}

.prev-btn {
  background-color: #1e2832;
  border: none;
  color: #9aa0a6;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.prev-btn:hover {
  background-color: #2d3640;
  color: #e8eaed;
}

.next-btn {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.next-btn:hover {
  background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35);
}

.confirm-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.confirm-btn:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}
