/**
 * Knowledge Graph UI Styles
 */

/* Override body flex centering from style-enhanced.css */
body {
  display: block !important;
  padding: 0 !important;
  background: #f0f2f5 !important;
}

/* Container */
.kg-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.kg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.kg-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
}

/* View Switcher */
.kg-view-switcher {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.kg-view-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  transition: all 0.2s;
}

.kg-view-btn:hover {
  color: #333;
  background: #f5f5f5;
}

.kg-view-btn.active {
  color: #1976d2;
  border-bottom-color: #1976d2;
  font-weight: 500;
}

/* Buttons */
.kg-btn-primary,
.kg-btn-secondary,
.kg-btn-small,
.kg-btn-back {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.kg-btn-primary {
  background: #1976d2;
  color: white;
}

.kg-btn-primary:hover {
  background: #1565c0;
}

.kg-btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.kg-btn-secondary:hover {
  background: #e0e0e0;
}

.kg-btn-small {
  padding: 5px 12px;
  font-size: 0.85rem;
  background: #e3f2fd;
  color: #1976d2;
}

.kg-btn-small:hover {
  background: #bbdefb;
}

.kg-btn-back {
  padding: 8px 16px;
  background: #f5f5f5;
  color: #666;
}

.kg-btn-back:hover {
  background: #e0e0e0;
}

/* Loading & Empty States */
.kg-loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 1.1rem;
}

.kg-loading::before {
  content: '⏳ ';
  font-size: 1.5rem;
}

.kg-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 1rem;
  line-height: 1.6;
}

.kg-error {
  padding: 20px;
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid #c62828;
  border-radius: 4px;
  margin: 20px 0;
}

/* Themes View */
.kg-themes-list {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.kg-category {
  background: #fafafa;
  padding: 20px;
  border-radius: 8px;
}

.kg-category-title {
  margin: 0 0 15px 0;
  color: #555;
  font-size: 1.2rem;
  font-weight: 500;
}

.kg-theme-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.kg-theme-card {
  background: white;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.2s;
}

.kg-theme-card:hover {
  border-color: #1976d2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.kg-theme-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kg-theme-name {
  font-weight: 500;
  color: #333;
  font-size: 1rem;
}

.kg-theme-count {
  background: #e3f2fd;
  color: #1976d2;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.kg-theme-desc {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-top: 8px;
}

/* Documents View */
.kg-documents-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.kg-doc-card {
  background: white;
  padding: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s;
}

.kg-doc-card:hover {
  border-color: #1976d2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.kg-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kg-doc-name {
  font-weight: 500;
  color: #333;
  font-size: 1.05rem;
}

.kg-doc-summary {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 10px;
  background: #f9f9f9;
  border-left: 3px solid #1976d2;
  border-radius: 4px;
}

.kg-doc-themes,
.kg-doc-concepts {
  margin-top: 10px;
  font-size: 0.9rem;
}

.kg-doc-themes strong,
.kg-doc-concepts strong {
  color: #555;
  margin-right: 8px;
}

/* Tags */
.kg-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin: 2px 4px 2px 0;
}

.kg-tag-theme {
  background: #e3f2fd;
  color: #1976d2;
}

.kg-tag-concept {
  background: #f3e5f5;
  color: #7b1fa2;
}

/* Search Input */
.kg-search-input {
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  width: 300px;
  transition: border-color 0.2s;
}

.kg-search-input:focus {
  outline: none;
  border-color: #1976d2;
}

/* Query Form */
.kg-query-form {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.kg-form-group {
  margin-bottom: 15px;
}

.kg-form-group label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: 500;
}

.kg-form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}

.kg-form-group textarea:focus {
  outline: none;
  border-color: #1976d2;
}

/* RAG Results */
.kg-rag-results {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.kg-answer {
  background: #e8f5e9;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #4caf50;
}

.kg-answer h4 {
  margin: 0 0 12px 0;
  color: #2e7d32;
  font-size: 1.1rem;
}

.kg-answer-text {
  color: #333;
  line-height: 1.6;
  font-size: 1rem;
}

.kg-metadata {
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid #c8e6c9;
  color: #558b2f;
  font-size: 0.9rem;
}

/* Sources */
.kg-sources {
  background: #fff3e0;
  padding: 20px;
  border-radius: 8px;
}

.kg-sources h4 {
  margin: 0 0 15px 0;
  color: #e65100;
  font-size: 1.1rem;
}

.kg-source {
  background: white;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 12px;
  border-left: 3px solid #ff9800;
}

.kg-source:last-child {
  margin-bottom: 0;
}

.kg-source-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.kg-source-number {
  background: #ff9800;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.kg-source-name {
  flex: 1;
  font-weight: 500;
  color: #333;
}

.kg-source-relevance {
  background: #ffe0b2;
  color: #e65100;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.kg-source-summary {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 8px;
  line-height: 1.5;
}

.kg-source-reasoning {
  color: #757575;
  font-size: 0.85rem;
  font-style: italic;
  padding: 8px 12px;
  background: #fafafa;
  border-radius: 4px;
}

/* Reasoning Chain */
.kg-reasoning {
  background: #e1f5fe;
  padding: 20px;
  border-radius: 8px;
}

.kg-reasoning h4 {
  margin: 0 0 15px 0;
  color: #01579b;
  font-size: 1.1rem;
}

.kg-reasoning-chain {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kg-reasoning-step {
  background: white;
  padding: 12px;
  border-radius: 4px;
  border-left: 3px solid #03a9f4;
  font-size: 0.9rem;
  color: #555;
}

.kg-reasoning-step strong {
  color: #01579b;
}

/* Responsive */
@media (max-width: 768px) {
  .kg-theme-cards {
    grid-template-columns: 1fr;
  }

  .kg-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .kg-search-input {
    width: 100%;
  }

  .kg-doc-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
