/* ================================
   GRUNDEINSTELLUNGEN
   ================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* CSS Custom Properties = Variablen für Farben und Abstände
   Vorteil: Einmal ändern, überall wirksam */
:root {
  --farbe-primaer:     #4a90d9;
  --farbe-hintergrund: #f0f2f5;
  --farbe-weiss:       #ffffff;
  --farbe-text:        #1a1a2e;
  --farbe-text-hell:   #666;
  --farbe-antwort:     #f8f9ff;
  --radius:            12px;
}

body {
  font-family: Arial, sans-serif;
  background-color: var(--farbe-hintergrund);
  color: var(--farbe-text);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}


/* ================================
   HAUPTCONTAINER
   ================================ */

.container {
  background-color: var(--farbe-weiss);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 32px;
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;  /* Elemente untereinander */
  gap: 24px;               /* Abstand zwischen allen direkten Kindelementen */
  height: fit-content;
}


/* ================================
   KOPFBEREICH
   ================================ */

header h1 {
  font-size: 24px;
  color: var(--farbe-text);
  margin-bottom: 4px;
}

.untertitel {
  color: var(--farbe-text-hell);
  font-size: 14px;
}


/* ================================
   CHATVERLAUF
   ================================ */

#chatverlauf {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 60px;
}

/* Jede Nachricht im Chat */
.nachricht {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.6;
  max-width: 90%;
}

/* Frage des Benutzers – rechts ausgerichtet */
.nachricht.frage {
  background-color: var(--farbe-primaer);
  color: var(--farbe-weiss);
  align-self: flex-end;               /* Rechtsbündig */
  border-bottom-right-radius: 4px;    /* Sprechblasen-Effekt */
}

/* Antwort des Assistenten – links ausgerichtet */
.nachricht.antwort {
  background-color: var(--farbe-antwort);
  color: var(--farbe-text);
  align-self: flex-start;             /* Linksbündig */
  border: 1px solid #e8eaf0;
  border-bottom-left-radius: 4px;     /* Sprechblasen-Effekt */
}


/* ================================
   LADEANIMATION
   Drei Punkte die nacheinander auf- und abspringen
   ================================ */

.laden {
  display: flex;
  gap: 6px;
  padding: 8px 0;
}

.laden span {
  width: 8px;
  height: 8px;
  background-color: var(--farbe-primaer);
  border-radius: 50%;                 /* Kreis */
  animation: huepfen 1s infinite;
}

/* Jeder Punkt startet die Animation leicht versetzt */
.laden span:nth-child(2) { animation-delay: 0.15s; }
.laden span:nth-child(3) { animation-delay: 0.30s; }

@keyframes huepfen {
  0%, 100% { transform: translateY(0);    opacity: 0.4; }
  50%       { transform: translateY(-8px); opacity: 1;   }
}


/* ================================
   FEHLERMELDUNG
   ================================ */

.fehler {
  background-color: #fff0f0;
  border-left: 4px solid #e05555;
  color: #c0392b;
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
}


/* ================================
   HILFSKLASSE: VERSTECKT
   JavaScript fügt/entfernt diese Klasse um Elemente ein- und auszublenden
   ================================ */

.versteckt {
  display: none !important;
}


/* ================================
   EINGABEBEREICH
   ================================ */

.eingabe-bereich {
  display: flex;
  gap: 10px;
  align-items: flex-end;             /* Button am unteren Rand ausrichten */
  border-top: 2px solid var(--farbe-hintergrund);
  padding-top: 16px;
}

textarea {
  flex: 1;                           /* Nimmt den gesamten verfügbaren Platz */
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  font-family: Arial, sans-serif;
  resize: none;
  transition: border-color 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--farbe-primaer);
}

button {
  padding: 12px 24px;
  background-color: var(--farbe-primaer);
  color: var(--farbe-weiss);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
  white-space: nowrap;               /* Text nicht umbrechen */
}

button:hover {
  background-color: #357abd;
}

/* Deaktivierter Button während Anfrage läuft */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
