/*
 * The visitor chat's stylesheet (decision 0010, D10-14).
 *
 * Served from our own origin, because the live Content-Security-Policy is `style-src 'self'`:
 * there is no inline `<style>` on this site and no `style=""` attribute, so the widget cannot
 * carry its own CSS in the page. For the same reason every icon is inline SVG markup rather than
 * a `data:` image, which `img-src 'self'` would refuse.
 *
 * Colours, fonts and radii are taken from the site's own tokens with a fallback, so the widget
 * follows the site if it is restyled and still looks right if it is ever embedded without them.
 */

.fida-chat {
  --fida-night: var(--night, #0b0f17);
  --fida-surface: var(--surface, #121b25);
  --fida-paper: var(--paper, #f3f0ea);
  --fida-grey: var(--grey, #b9c1c8);
  --fida-copper: var(--copper, #d08a5a);
  --fida-copper-hover: var(--copper-hover, #dda073);
  --fida-on-copper: var(--on-copper, #1a1108);
  --fida-line: var(--line, rgba(243, 240, 234, 0.12));
  --fida-display: var(--display, 'Syne', 'Syne Fallback', sans-serif);
  --fida-text: var(--text, 'Instrument Sans', 'Instrument Fallback', sans-serif);
  --fida-ease: var(--ease, cubic-bezier(0.16, 1, 0.3, 1));
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  /* The box shrinks to its content, but a wide child (the mail line) can stretch it, and the
     panel then sits at its left edge instead of over the button. Seen at 1920 px on 14.11.2026:
     the container measured 799 px and the 400 px panel hung 430 px away from the right edge. */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--fida-text);
  color: var(--fida-paper);
}

.fida-chat *,
.fida-chat *::before,
.fida-chat *::after {
  box-sizing: border-box;
}

/* The only thing on the page until a visitor asks for the chat. */
.fida-knopf {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  min-height: 52px;
  padding: 0 1.3em;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fida-copper);
  color: var(--fida-on-copper);
  font: 600 1.0625rem/1 var(--fida-text);
  cursor: pointer;
  box-shadow: 0 14px 40px -14px rgba(0, 0, 0, 0.7);
  transition: background-color 0.25s var(--fida-ease);
}

.fida-knopf:hover {
  background: var(--fida-copper-hover);
}

.fida-knopf svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.fida-chat[data-offen='ja'] .fida-knopf {
  display: none;
}

.fida-panel {
  display: none;
  width: min(calc(100vw - 32px), 400px);
  max-height: min(78dvh, 640px);
  flex-direction: column;
  border: 1px solid var(--fida-line);
  border-radius: 20px;
  background: var(--fida-surface);
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.fida-chat[data-offen='ja'] .fida-panel {
  display: flex;
}

@media (prefers-reduced-motion: no-preference) {
  .fida-chat[data-offen='ja'] .fida-panel {
    animation: fida-auf 0.3s var(--fida-ease);
  }
}

@keyframes fida-auf {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fida-kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 18px;
  border-bottom: 1px solid var(--fida-line);
  background: rgba(11, 15, 23, 0.4);
}

.fida-kopf h2 {
  margin: 0;
  font: 700 1.0625rem/1.2 var(--fida-display);
  letter-spacing: -0.01em;
  color: var(--fida-paper);
}

.fida-kopf p {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--fida-grey);
}

.fida-kopf-text {
  margin-right: auto;
}

.fida-zu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--fida-line);
  border-radius: 999px;
  background: transparent;
  color: var(--fida-paper);
  cursor: pointer;
}

.fida-zu:hover {
  border-color: var(--fida-paper);
}

.fida-zu svg {
  width: 16px;
  height: 16px;
}

.fida-verlauf {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}

.fida-blase {
  max-width: 92%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fida-blase--fida {
  align-self: flex-start;
  background: rgba(243, 240, 234, 0.07);
  border: 1px solid var(--fida-line);
  color: var(--fida-paper);
}

.fida-blase--ich {
  align-self: flex-end;
  background: var(--fida-copper);
  border: 1px solid transparent;
  color: var(--fida-on-copper);
}

.fida-quellen {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8125rem;
}

.fida-quellen-titel {
  display: block;
  margin-top: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fida-grey);
}

.fida-quellen a {
  color: var(--fida-paper);
  text-decoration: underline;
  text-decoration-color: var(--fida-copper);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.fida-quellen a:hover {
  color: var(--fida-copper);
}

.fida-laedt {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--fida-grey);
}

.fida-punkte {
  display: inline-flex;
  gap: 4px;
}

.fida-punkte span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fida-copper);
  opacity: 0.45;
}

@media (prefers-reduced-motion: no-preference) {
  .fida-punkte span {
    animation: fida-puls 1.1s ease-in-out infinite;
  }
  .fida-punkte span:nth-child(2) {
    animation-delay: 0.18s;
  }
  .fida-punkte span:nth-child(3) {
    animation-delay: 0.36s;
  }
}

@keyframes fida-puls {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.fida-eingabe {
  border-top: 1px solid var(--fida-line);
  padding: 12px 14px 14px;
  background: rgba(11, 15, 23, 0.4);
}

.fida-zeile {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.fida-eingabe textarea {
  flex: 1 1 auto;
  min-height: 46px;
  max-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--fida-line);
  border-radius: 14px;
  background: rgba(11, 15, 23, 0.55);
  color: var(--fida-paper);
  font: 400 0.9375rem/1.4 var(--fida-text);
  resize: none;
  /* The box grows with the text up to max-height, so it only ever needs to scroll beyond that. */
  overflow-y: auto;
}

.fida-eingabe textarea::placeholder {
  color: var(--fida-grey);
}

.fida-senden {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fida-copper);
  color: var(--fida-on-copper);
  cursor: pointer;
}

.fida-senden:hover:not(:disabled) {
  background: var(--fida-copper-hover);
}

.fida-senden:disabled {
  opacity: 0.55;
  cursor: default;
}

.fida-senden svg {
  width: 18px;
  height: 18px;
}

.fida-hinweis {
  margin: 8px 2px 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--fida-grey);
}

.fida-hinweis a {
  color: var(--fida-grey);
  text-decoration: underline;
  text-decoration-color: var(--fida-copper);
  text-underline-offset: 0.2em;
}

.fida-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Windows draws a classic scrollbar with stepper arrows, which looked like a number spinner on
   the input and put two arrowheads into the history (seen 14.11.2026). Thin, no buttons. */
.fida-chat * {
  scrollbar-width: thin;
  scrollbar-color: var(--fida-line) transparent;
}

.fida-chat *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.fida-chat *::-webkit-scrollbar-button {
  display: none;
}

.fida-chat *::-webkit-scrollbar-track {
  background: transparent;
}

.fida-chat *::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--fida-line);
}

.fida-chat :focus-visible {
  outline: 2px solid var(--fida-copper);
  outline-offset: 2px;
  border-radius: 8px;
}

/* On a phone the panel takes the width it needs and sits above the thumb. */
@media (max-width: 560px) {
  .fida-chat {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  .fida-panel {
    width: 100%;
    max-height: 72dvh;
  }
  .fida-knopf {
    float: right;
  }
}

/* The FIDA figure: the same character a customer meets inside FIDARYN (owner, 2026-11-13). The
   images come from the product's own assets, trimmed and scaled, and are served by this service
   because `img-src 'self'` allows images from nowhere else. */
.fida-avatar {
  width: auto;
  height: 44px;
  flex: none;
  object-fit: contain;
}

.fida-mini {
  width: auto;
  height: 28px;
  flex: none;
  object-fit: contain;
}

.fida-knopf .fida-mini {
  height: 30px;
  margin-left: -4px;
}

/* "Answer not quite right? Ask by e-mail" and the little form behind it. */
.fida-weiter {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--fida-line);
}

.fida-weiter-oeffnen {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fida-grey);
  font: 500 0.8125rem/1.3 var(--fida-text);
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--fida-copper);
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.fida-weiter-oeffnen:hover {
  color: var(--fida-paper);
}

.fida-weiter-text {
  margin: 4px 0 10px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--fida-grey);
}

.fida-weiter-feld {
  flex: 1 1 auto;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--fida-line);
  border-radius: 12px;
  background: rgba(11, 15, 23, 0.55);
  color: var(--fida-paper);
  font: 400 0.9375rem/1.4 var(--fida-text);
}

.fida-weiter-feld::placeholder {
  color: var(--fida-grey);
}

.fida-weiter-feld:disabled {
  opacity: 0.6;
}

.fida-weiter-senden {
  flex: none;
  min-height: 42px;
  padding: 0 1.05em;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fida-copper);
  color: var(--fida-on-copper);
  font: 600 0.875rem/1 var(--fida-text);
  white-space: nowrap;
  cursor: pointer;
}

.fida-weiter-senden:hover:not(:disabled) {
  background: var(--fida-copper-hover);
}

.fida-weiter-senden:disabled {
  opacity: 0.6;
  cursor: default;
}

.fida-weiter-meldung {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--fida-paper);
}
