/* KI-Assistent */

.ki-assistent-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

.chat-container {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-status {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 10px;
}

.chat-messages {
  height: 450px;
  overflow-y: auto;
  padding: 20px;
  background: #f9f9f9;
}

.message {
  margin-bottom: 15px;
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.message-content {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.message.user .message-content {
  background: #667eea;
  color: white;
  border-bottom-right-radius: 4px;
}

.message.bot .message-content {
  background: white;
  color: #333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
}

.message.bot .message-content a {
  color: #667eea;
  text-decoration: underline;
}

.message.bot .message-content ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.message.bot .message-content li {
  margin-bottom: 4px;
}

.suggestions {
  margin: 10px 0 0 0;
  padding-left: 20px;
}

.suggestions li {
  color: #667eea;
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 13px;
}

.suggestions li:hover {
  text-decoration: underline;
}

.chat-input-area {
  display: flex;
  padding: 10px;
  background: white;
  border-top: 1px solid #e0e0e0;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
  border-radius: 20px;
  padding: 10px 16px;
  border: 1px solid #ddd;
}

.chat-input-area button {
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media print {
  .navbar,
  .footer,
  .site-header,
  .site-footer,
  .chat-input-area {
    display: none;
  }
}

/* Source chips from RAG context */
.message-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e0e0e0;
}

.sources-title {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.sources-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #f0f4ff;
  color: #4a6fe0;
  border: 1px solid #d0daff;
  border-radius: 14px;
  font-size: 12px;
  text-decoration: none;
  transition: background 0.2s;
}

.source-chip:hover {
  background: #dae4ff;
}

.source-curriculum {
  background: #f3e8ff;
  color: #7b2dc5;
  border-color: #d8c2f0;
}

.source-curriculum:hover {
  background: #e8d5ff;
}

.source-didaktik {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #a5d6a7;
}

.source-didaktik:hover {
  background: #c8e6c9;
}

.source-cat {
  font-size: 9px;
  opacity: 0.7;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

.message.bot .message-sources {
  margin-left: 0;
  max-width: 100%;
}

@media (prefers-color-scheme: dark) {
  .message-sources {
    border-top-color: #444;
  }
  .sources-title {
    color: #999;
  }
  .source-chip {
    background: #1a1a3e;
    color: #7cb3ff;
    border-color: #2a2a5e;
  }
  .source-chip:hover {
    background: #2a2a5e;
  }
  .source-curriculum {
    background: #2a1040;
    color: #b388ff;
    border-color: #4a2070;
  }
  .source-curriculum:hover {
    background: #3a1860;
  }
  .source-didaktik {
    background: #1b3a1b;
    color: #81c784;
    border-color: #2e7d32;
  }
  .source-didaktik:hover {
    background: #2a4a2a;
  }
  .source-cat {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* ── Sidebar Styles ─────────────────────────── */
.learning-profile {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.learning-profile h3 {
  font-size: 16px;
  color: #667eea;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #667eea;
}

.profile-section {
  margin-bottom: 12px;
}

.profile-section h4 {
  font-size: 13px;
  color: #555;
  margin: 0 0 6px 0;
  font-weight: 600;
}

.profile-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.profile-list li {
  font-size: 13px;
  padding: 4px 8px;
  margin-bottom: 3px;
  border-radius: 4px;
  background: #f8f9fa;
  color: #333;
}

.profile-empty {
  color: #999;
  font-style: italic;
}

#weak-areas .profile-list li {
  border-left: 3px solid #e74c3c;
}

#strong-areas .profile-list li {
  border-left: 3px solid #27ae60;
}

/* ── Chat Search ────────────────────────────── */
.chat-search {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-search h3 {
  font-size: 16px;
  color: #667eea;
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #667eea;
}

.chat-search-input-group {
  display: flex;
  gap: 6px;
}

.chat-search-input-group input {
  flex: 1;
  font-size: 13px;
  height: 34px;
}

.chat-search-input-group button {
  white-space: nowrap;
  height: 34px;
  font-size: 13px;
}

.chat-search-results {
  margin-top: 10px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
}

.chat-search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #f0f0f0;
  font-size: 12px;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
}

.chat-search-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}

.chat-search-close:hover {
  color: #333;
}

.chat-search-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background 0.15s;
}

.chat-search-item:hover {
  background: #e8f0fe;
}

.chat-search-item:last-child {
  border-bottom: none;
}

.chat-search-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.chat-search-item-preview {
  font-size: 12px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-search-loading,
.chat-search-empty,
.chat-search-error {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: #888;
}

.chat-search-error {
  color: #e74c3c;
}

/* ── Export Button ──────────────────────────── */
.export-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: auto;
  white-space: nowrap;
}

.export-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Session Info Display ───────────────────── */
#session-info-display {
  padding: 6px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  margin-bottom: 6px;
  color: #6c757d;
  font-size: 12px;
  text-align: center;
}

/* ── Hint Button Styles ─────────────────────── */
.hint-button {
  display: inline-block;
  padding: 6px 14px;
  background: #f0f4ff;
  color: #4a6fe0;
  border: 1px solid #d0daff;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.hint-button:hover {
  background: #dae4ff;
  border-color: #4a6fe0;
}

.hint-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint-content {
  margin-top: 8px;
  padding: 12px;
  background: #fffde7;
  border: 1px solid #ffe082;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
}

.hint-loading {
  color: #888;
  font-style: italic;
  margin: 0;
}

.hint-error {
  color: #e74c3c;
  margin: 0;
}

.hint-result {
  margin: 0;
}

/* ── Mobile responsive ──────────────────────── */
@media (max-width: 768px) {
  .ki-assistent-container {
    padding: 10px;
  }

  .chat-messages {
    height: calc(100vh - 260px);
    min-height: 200px;
    padding: 15px;
  }

  .message-content {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 15px;
  }

  .suggestions li {
    font-size: 14px;
    padding: 8px 0;
  }

  .chat-input-area button {
    width: 44px;
    height: 44px;
  }

  .learning-profile,
  .chat-search {
    padding: 12px;
  }
}

/* ── Dark mode ──────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .learning-profile {
    background: #1a1a3e;
    border-color: #333;
  }
  .learning-profile h3 {
    color: #7cb3ff;
    border-bottom-color: #7cb3ff;
  }
  .profile-section h4 {
    color: #aaa;
  }
  .profile-list li {
    background: #2a2a4e;
    color: #e0e0e0;
  }
  .profile-empty {
    color: #777;
  }

  .chat-search {
    background: #1a1a3e;
    border-color: #333;
  }
  .chat-search h3 {
    color: #7cb3ff;
    border-bottom-color: #7cb3ff;
  }
  .chat-search-results {
    background: #2a2a4e;
    border-color: #444;
  }
  .chat-search-header {
    background: #333;
    color: #aaa;
  }
  .chat-search-item {
    border-bottom-color: #444;
  }
  .chat-search-item:hover {
    background: #3a3a6e;
  }
  .chat-search-item-title {
    color: #e0e0e0;
  }

  .export-btn {
    color: #e0e0e0;
  }

  .hint-button {
    background: #2a3a5e;
    color: #7cb3ff;
    border-color: #3a5a8e;
  }
  .hint-button:hover {
    background: #3a4a7e;
  }
  .hint-content {
    background: #3a3a1e;
    border-color: #6a6a2e;
    color: #e0e0e0;
  }
}
