/* ===== Knowledge Base ===== */

.kb-page {
  max-width: 800px;
  margin: 0 auto;
}

/* Upload card */
.kb-upload-card textarea.input {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
  padding: var(--space-md);
}

.kb-upload-card textarea.input:focus {
  border-color: var(--color-primary);
  outline: none;
}

/* Document list */
.kb-doc-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
}

.kb-doc-item:hover {
  border-color: var(--color-primary-light);
  transform: translateX(2px);
}

.kb-doc-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
}

.kb-doc-info {
  flex: 1;
  min-width: 0;
}

.kb-doc-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 2px;
}

.kb-doc-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.kb-doc-preview {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.kb-doc-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* Search results */
.kb-search-result {
  padding: var(--space-md);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  border-left: 3px solid var(--color-primary);
}

.kb-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
}

.kb-result-source {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-primary-dark);
}

.kb-result-score {
  font-size: var(--text-xs);
  font-weight: 600;
}

.kb-result-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-height: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Loading / empty */
.kb-empty {
  text-align: center;
  padding: var(--space-2xl);
}

.kb-empty .icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* Responsive */
@media (max-width: 768px) {
  .kb-doc-item {
    flex-wrap: wrap;
  }
  .kb-doc-preview {
    max-width: 200px;
  }
  .kb-doc-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: var(--space-xs);
  }
}
