/* KI-Assistent (src/components/ChatAssistent.astro). Eigene Datei statt <style> in der Komponente:
   so bleibt das gemeinsame Stylesheet unverändert, solange der Chat ausgeschaltet ist. */
.ims-chat-start {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 45;
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1.2rem 0.4rem 0.4rem;
  border-radius: 9999px;
  background: var(--color-olive-dark);
  color: #fff;
  font: 600 0.95rem/1 var(--font-display);
  box-shadow: 0 8px 22px rgba(26, 29, 22, 0.28);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.js .ims-chat-start { display: inline-flex; }
.ims-chat-start:hover { background: var(--color-olive-darker); transform: translateY(-1px); }
.ims-chat-start:focus-visible { outline: 3px solid var(--color-olive); outline-offset: 3px; }
.ims-chat-start[aria-expanded="true"] { display: none; }
.ims-chat-punkt {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 9999px;
  background: var(--color-fresh);
  border: 2px solid #fff;
}
:root:has(.ims-chat-start) .to-top { bottom: 5.4rem; }

.ims-chat {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  width: min(410px, calc(100vw - 2.5rem));
  height: min(680px, calc(100vh - 2.5rem));
  height: min(680px, calc(100dvh - 2.5rem));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: 1.1rem;
  box-shadow: 0 18px 50px rgba(26, 29, 22, 0.25);
  overflow: hidden;
  color: var(--color-ink);
  font-size: 0.95rem;
}
.ims-chat[hidden] { display: none; }
.ims-chat-kopf {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem 0.75rem 0.9rem;
  background: var(--color-ink);
  color: #fff;
  border-bottom: 4px solid var(--color-olive);
}
.ims-chat-titel { font: 600 1.02rem/1.2 var(--font-display); margin: 0; }
.ims-chat-unter { font-size: 0.78rem; color: #c9cfbb; margin: 0.15rem 0 0; }
.ims-chat-kopf-text { flex: 1; min-width: 0; }
.ims-chat-kopf-knoepfe { display: flex; gap: 0.25rem; }

/* Foto im Kreis mit KI-Abzeichen — der Chat soll nicht wie ein Mensch wirken (Art. 50 KI-Verordnung) */
.ims-chat-bild { position: relative; flex: none; display: block; width: 40px; height: 40px; }
.ims-chat-bild img { width: 100%; height: 100%; border-radius: 9999px; object-fit: cover; border: 2px solid #fff; background: #dfe3e8; }
.ims-chat-bild-gross { width: 44px; height: 44px; }
.ims-chat-bild-gross img { border-color: var(--color-olive); }
.ims-chat-ki {
  position: absolute;
  right: -5px;
  bottom: -3px;
  padding: 1px 4px;
  border-radius: 6px;
  background: var(--color-olive);
  color: #fff;
  font: 700 0.6rem/1.2 var(--font-sans);
  letter-spacing: 0.02em;
  border: 1.5px solid #fff;
}
.ims-chat-kopf button {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  color: #fff;
  cursor: pointer;
}
.ims-chat-kopf button:hover { background: rgba(255, 255, 255, 0.12); }
.ims-chat-hinweis {
  margin: 0;
  padding: 0.5rem 1.1rem;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--color-muted);
  background: var(--color-soft);
  border-bottom: 1px solid var(--color-line);
}
.ims-chat-hinweis a { color: var(--color-olive-dark); text-decoration: underline; }
.ims-chat-verlauf {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overscroll-behavior: contain;
}
.ims-chat-blase {
  max-width: 88%;
  padding: 0.65rem 0.9rem;
  border-radius: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.ims-chat-blase p { margin: 0 0 0.5rem; }
.ims-chat-blase p:last-child, .ims-chat-blase ul:last-child, .ims-chat-blase ol:last-child { margin-bottom: 0; }
.ims-chat-blase ul, .ims-chat-blase ol { margin: 0 0 0.5rem; padding-left: 1.2rem; }
.ims-chat-blase ul { list-style: disc; }
.ims-chat-blase ol { list-style: decimal; }
.ims-chat-blase li { margin: 0.15rem 0; }
.ims-chat-blase a { color: var(--color-olive-dark); text-decoration: underline; font-weight: 500; }
.ims-chat-blase strong { font-weight: 600; }
.ims-chat-bot { align-self: flex-start; background: var(--color-soft); border-bottom-left-radius: 0.3rem; }
.ims-chat-nutzer { align-self: flex-end; background: var(--color-olive-dark); color: #fff; border-bottom-right-radius: 0.3rem; white-space: pre-wrap; }
.ims-chat-fehler { align-self: flex-start; background: #fbe9e5; color: #7a2b1f; border-bottom-left-radius: 0.3rem; }
.ims-chat-tippt { color: var(--color-muted); font-size: 0.88rem; display: flex; align-items: center; gap: 0.5rem; }
.ims-chat-tippt i {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  background: var(--color-olive);
  animation: ims-chat-puls 1s infinite ease-in-out;
}
.ims-chat-tippt i:nth-child(2) { animation-delay: 0.15s; }
.ims-chat-tippt i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ims-chat-puls { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.ims-chat-vorschlaege { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ims-chat-vorschlaege button {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: 9999px;
  background: #fff;
  font-size: 0.84rem;
  color: var(--color-ink);
  cursor: pointer;
  text-align: left;
}
.ims-chat-vorschlaege button:hover { border-color: var(--color-olive); background: #f7f9ee; }
.ims-chat-eingabe {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--color-line);
}
.ims-chat-eingabe textarea {
  flex: 1;
  resize: none;
  max-height: 8rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: 0.75rem;
  font: inherit;
  line-height: 1.4;
  color: var(--color-ink);
}
.ims-chat-eingabe textarea:focus { outline: 2px solid var(--color-olive); outline-offset: 0; border-color: transparent; }
.ims-chat-senden {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  border-radius: 0.75rem;
  background: var(--color-olive-dark);
  color: #fff;
  cursor: pointer;
}
.ims-chat-senden:disabled { opacity: 0.45; cursor: default; }
.ims-chat-fuss {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.85rem 0.75rem;
  font-size: 0.82rem;
}
.ims-chat-team {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--color-olive-dark);
  border-radius: 9999px;
  color: var(--color-olive-dark);
  font-weight: 600;
  cursor: pointer;
}
.ims-chat-team:disabled { opacity: 0.4; cursor: default; }
.ims-chat-team:not(:disabled):hover { background: #f7f9ee; }
.ims-chat-termin { color: var(--color-muted); text-decoration: underline; }

@media (max-width: 640px) {
  .ims-chat-start { padding: 0.35rem; }
  .ims-chat-start .ims-chat-bild { width: 48px; height: 48px; }
  .ims-chat-start-text { display: none; }
  .ims-chat { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ims-chat-start { transition: none; }
  .ims-chat-tippt i { animation: none; opacity: 0.7; }
}
@media print {
  .ims-chat-start, .ims-chat { display: none !important; }
}
