/* FOKALiS CMS – KI-Chatbot der Website (Phase 3). Neutral gehalten; jede Website passt es über die Variablen an. */
:root {
  --fk-chat-akzent: #222323;
  --fk-chat-akzent-text: #ffffff;
  --fk-chat-flaeche: #ffffff;
  --fk-chat-text: #1f1f1f;
  --fk-chat-leise: #5f6368;
  --fk-chat-rand: rgba(0, 0, 0, 0.12);
  --fk-chat-besucher: #f1f1f1;
  --fk-chat-schrift: inherit;
  --fk-chat-radius: 14px;
  --fk-chat-schatten: 0 18px 50px rgba(0, 0, 0, 0.22);
}
.fk-chat-knopf {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0 1.1em;
  border: 0;
  border-radius: 999px;
  background: var(--fk-chat-akzent);
  color: var(--fk-chat-akzent-text);
  font: 600 15px/1 var(--fk-chat-schrift);
  box-shadow: var(--fk-chat-schatten);
  cursor: pointer;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.fk-chat-knopf:hover { transform: translateY(-2px); }
.fk-chat-knopf:focus-visible, .fk-chat button:focus-visible, .fk-chat a:focus-visible, .fk-chat-eingabe:focus-visible {
  outline: 2px solid var(--fk-chat-akzent);
  outline-offset: 2px;
}
.fk-chat-knopf:focus-visible { outline-color: var(--fk-chat-text); }
.fk-chat-offen .fk-chat-knopf { display: none; }

.fk-chat {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 9001;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 32px));
  height: min(600px, calc(100dvh - 32px));
  border: 1px solid var(--fk-chat-rand);
  border-radius: var(--fk-chat-radius);
  background: var(--fk-chat-flaeche);
  color: var(--fk-chat-text);
  font: 400 15px/1.55 var(--fk-chat-schrift);
  box-shadow: var(--fk-chat-schatten);
  overflow: hidden;
  animation: fk-chat-auf 0.5s ease both;
}
.fk-chat[hidden] { display: none; }
@keyframes fk-chat-auf { from { opacity: 0; transform: translateY(12px); } }
.fk-chat *, .fk-chat *::before, .fk-chat *::after { box-sizing: border-box; }

.fk-chat-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  padding: 14px 14px 14px 18px;
  border-bottom: 1px solid var(--fk-chat-rand);
}
.fk-chat-ansage { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fk-chat-kopftext { min-width: 0; }
.fk-chat-kizeile { margin: 3px 0 0; font-size: 12px; line-height: 1.2; color: var(--fk-chat-leise); }
.fk-chat-wer { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fk-chat-bild { flex: none; width: 36px; height: 36px; border-radius: 999px; object-fit: cover; background: var(--fk-chat-besucher); }
.fk-chat-titel { margin: 0; font: 600 16px/1.2 var(--fk-chat-schrift); color: inherit; letter-spacing: normal; text-transform: none; }
.fk-chat-zu {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.fk-chat-zu:hover { background: var(--fk-chat-besucher); }

.fk-chat-verlauf {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fk-chat-blase { max-width: 88%; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.fk-chat-blase p { margin: 0; }
.fk-chat-blase p + p, .fk-chat-blase ul + p, .fk-chat-blase p + ul { margin-top: 0.5em; }
.fk-chat-blase ul { margin: 0; padding-left: 1.2em; }
.fk-chat-bot { align-self: flex-start; background: var(--fk-chat-flaeche); border: 1px solid var(--fk-chat-rand); border-bottom-left-radius: 4px; }
.fk-chat-besucher { align-self: flex-end; background: var(--fk-chat-besucher); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.fk-chat-tippt { color: var(--fk-chat-leise); font-style: italic; }
.fk-chat-fehler { color: #b3261e; }
.fk-chat-hinweis { margin: 4px 0 0; font-size: 13px; color: var(--fk-chat-leise); text-align: center; }
.fk-chat-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.fk-chat-aktionen { align-self: flex-start; }

.fk-chat-start { padding: 0 18px 18px; font-size: 14px; color: var(--fk-chat-leise); }
.fk-chat-start p { margin: 0 0 0.75em; }
.fk-chat-start[hidden], .fk-chat-form[hidden], .fk-chat-fuss[hidden] { display: none; }
.fk-chat-haupt {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.3em;
  border: 0;
  border-radius: 999px;
  background: var(--fk-chat-akzent);
  color: var(--fk-chat-akzent-text);
  font: 600 14px/1 var(--fk-chat-schrift);
  text-decoration: none;
  cursor: pointer;
}

.fk-chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--fk-chat-rand); }
.fk-chat-eingabe {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 14px;
  border: 1px solid var(--fk-chat-rand);
  border-radius: 22px;
  background: var(--fk-chat-flaeche);
  color: inherit;
  font: inherit;
  resize: none;
}
.fk-chat-senden {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--fk-chat-akzent);
  color: var(--fk-chat-akzent-text);
  cursor: pointer;
}
.fk-chat-senden:disabled, .fk-chat-eingabe:disabled { opacity: 0.5; cursor: not-allowed; }
.fk-chat-fuss { display: flex; justify-content: space-between; gap: 1em; padding: 0 16px 10px; font-size: 12px; color: var(--fk-chat-leise); }
.fk-chat-neu { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

@media (max-width: 520px) {
  .fk-chat { right: 0; bottom: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .fk-chat-knopf span { display: none; }
  .fk-chat-knopf { width: 52px; height: 52px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .fk-chat, .fk-chat-knopf { animation: none; transition: none; }
}
