/* Grundlayout */
body {
  font-family: system-ui, sans-serif;
  background: #0e0e0e;
  color: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
}

.chat-container {
  background: #1a1a1a;
  width: 100%;
  max-width: 700px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
  overflow: hidden;
}

/* Header */
header {
  text-align: center;
  padding: 1rem;
  background: #222;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

h1 {
  font-size: 1.3rem;
  margin: 0;
}

/* Chatbereich */
.chat-box {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* Nachrichten */
.message {
  display: flex;
  width: 100%;
}

.message.user {
  justify-content: flex-end;
}

.message.ai {
  justify-content: flex-start;
}

.bubble {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  max-width: 80%;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.4;
  font-size: 1rem;
}

.user .bubble {
  background: #0078ff;
  color: white;
  border-bottom-right-radius: 0;
}

.ai .bubble {
  background: #333;
  color: #fff;
  border-bottom-left-radius: 0;
}

/* Eingabebereich */
.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem;
  border-top: 1px solid #333;
  background: #222;
  flex-shrink: 0;
}

.chat-form input {
  flex: 1;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 8px;
  background: #333;
  color: #f2f2f2;
  font-size: 1rem;
  outline: none;
}

.chat-form button {
  background: #0078ff;
  color: white;
  border: none;
  padding: 0 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.chat-form button:hover {
  background: #3399ff;
}

/* Ladeanimation */
.loading {
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 🔹 Mobile Optimierungen */
@media (max-width: 600px) {
  body {
    align-items: stretch;
    justify-content: stretch;
  }

  .chat-container {
    height: 100dvh;
    width: 100vw;
    border-radius: 0;
  }

  header h1 {
    font-size: 1.1rem;
  }

  .chat-box {
    padding: 0.8rem;
    gap: 8px;
  }

  .bubble {
    font-size: 0.95rem;
    max-width: 90%;
  }

  .chat-form {
    flex-direction: row;
    padding: 0.6rem;
    gap: 0.4rem;
  }

  .chat-form input {
    font-size: 1rem;
    padding: 0.7rem 0.9rem;
  }

  .chat-form button {
    padding: 0.7rem 1rem;
    font-size: 1rem;
  }
}

/* 🔹 Sehr kleine Geräte */
@media (max-width: 380px) {
  .bubble {
    font-size: 0.9rem;
    max-width: 95%;
  }

  .chat-form input {
    font-size: 0.9rem;
  }

  .chat-form button {
    font-size: 0.9rem;
  }
}
