/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --text: #121417;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #0078ff;
  --primary-press: #005fcc;
  --radius: 18px;
  --pad: clamp(12px, 1.6vw, 20px);
}

/* ---------- Body ---------- */
html, body {
  height: 100%;
  margin: 0;
  font: 400 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f1f3f5; /* leichtes Grau als Seitenhintergrund */
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---------- Weißes Fenster ---------- */
.chat-wrapper {
  width: min(96vw, 1000px);
  height: min(95vh, 900px);
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 20px 48px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Chat-Inhalt ---------- */
.chat-container {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
}

/* Titel mittig oben */
.chat-title {
  margin: clamp(20px, 3vh, 36px) 0 0 0;
  text-align: center;
  font-weight: 600;
  font-size: 1.4rem;
  opacity: 0.9;
  animation: fade-in 0.25s ease-out both;
}

/* Chat-Verlauf */
.chat-box {
  flex: 1;
  padding: clamp(10px, 2vw, 20px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: #fff;
}

/* Nachrichten */
.message {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: min(72ch, 92%);
  animation: msg-in 0.18s ease-out both;
}
.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.message.bot {
  align-self: flex-start;
  background: #f4f6f8;
  color: var(--text);
  border-bottom-left-radius: 6px;
}

/* Streaming Cursor */
.message.bot.streaming::after {
  content: " ";
  display: inline-block;
  width: 6px;
  height: 1em;
  margin-left: 2px;
  background: currentColor;
  animation: blink 1s steps(1) infinite;
}

/* Eingabe */
.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: var(--pad);
  border-top: 1px solid var(--border);
  background: linear-gradient(to top, rgba(0,0,0,0.03), transparent 40%);
}
.chat-input input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  font-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary), #fff 85%);
}

/* Buttons */
.btns {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.btn {
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease;
  height: 44px;
  padding: 0 16px;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-press);
}
.btn-muted {
  background: #9aa3af;
  color: #fff;
}
.btn-muted:hover {
  background: #7b8390;
}

/* ---------- Animationen ---------- */
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .chat-wrapper {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}