/* ============================================================
   Chat-Dialog Styles – dai.guru
   Nachbildung einer AI-Agenten-Konversation
   ============================================================ */

.chat-dialog {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Benutzer-Sprechblase (hellblau, rechtsbündig) */
.chat-bubble {
  margin-bottom: 1.25rem;
}

.chat-bubble.chat-user {
  display: flex;
  justify-content: flex-end;
}

.chat-bubble.chat-user .chat-bubble-inner {
  background: #dff3ff;
  color: #1a1a1a;
  border-radius: 18px 18px 0 18px;
  padding: 0.75rem 1.1rem;
  max-width: 80%;
  white-space: pre-wrap;
}

/* Mehrzeilige Chatnachrichten mit vollständiger Markdown-Unterstützung */
.chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 1.35rem 0;
}

.chat-message--user {
  align-items: flex-end;
}

.chat-message-name {
  margin: 0 0 0.3rem 0.8rem;
  color: var(--text-muted, #555);
  font-size: 0.82rem;
  font-weight: 600;
}

.chat-message--user .chat-message-name {
  margin-right: 0.8rem;
}

.chat-message-bubble {
  position: relative;
  max-width: 85%;
  padding: 0.85rem 1.1rem;
  color: var(--text, #1a1a1a);
  background: #fff;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 18px 18px 18px 0;
  box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
}

.chat-message--user .chat-message-bubble {
  max-width: 80%;
  background: #dff3ff;
  border-color: #b9ddf2;
  border-radius: 18px 18px 0 18px;
}

.chat-message--success .chat-message-bubble {
  background: #e8f7ec;
  border-color: #a9d7b5;
  border-left: 4px solid #3c9b58;
  border-radius: 0 18px 18px 0;
}

.chat-message-bubble > :first-child {
  margin-top: 0;
}

.chat-message-bubble > :last-child {
  margin-bottom: 0;
}

.chat-message-bubble pre {
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

/* Agenten-Antwort (weiß, linksbündig) */
.chat-bubble.chat-agent {
  display: flex;
  justify-content: flex-start;
}

.chat-bubble.chat-agent .chat-bubble-inner {
  background: #ffffff;
  color: #1a1a1a;
  border: 1px solid #ddd;
  border-radius: 18px 18px 18px 0;
  padding: 0.75rem 1.1rem;
  max-width: 85%;
  white-space: pre-wrap;
}

/* Denkzeit-Anzeige ("1m 40s lang gearbeitet") */
.chat-think {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1rem 0;
  padding: 0.35rem 0.8rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #555;
  cursor: default;
}

.chat-think-icon {
  font-size: 0.7rem;
  color: #888;
}

/* Datei-Links */
.chat-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.2rem 0.4rem 0.2rem 0;
  font-size: 0.88rem;
  color: #2a6496;
}

.chat-file-icon {
  font-size: 0.9rem;
}

.chat-file-name {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

/* Inline-Badges (z. B. Prozentwerte, Feldnamen) */
.chat-badge {
  display: inline-block;
  margin: 0.15rem 0.25rem;
  padding: 0.15rem 0.55rem;
  background: #efefef;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #333;
}

/* Anmerkung */
.chat-note {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: #666;
  font-style: italic;
}

/* Responsive: auf kleinen Bildschirmen volle Breite */
@media (max-width: 600px) {
  .chat-bubble.chat-user .chat-bubble-inner,
  .chat-bubble.chat-agent .chat-bubble-inner {
    max-width: 95%;
  }

  .chat-message-bubble,
  .chat-message--user .chat-message-bubble {
    max-width: 94%;
  }
}
