/* FS Chat – gekapselt, damit nix am Layout kaputt geht */

:root{
  /* Abstand vom Browser-Rand bis zum Container-Rand */
  --fs-chat-edge: max(0px, calc((100vw - var(--container-max, 1120px)) / 2));
}

.fs-chat, .fs-chat * { box-sizing: border-box; }

.fs-chat-tab {
  position: fixed;
  top: 55%;
  z-index: 9998;

  border: 0;
  border-radius: 14px 0 0 14px;
  padding: 12px 10px;

  cursor: pointer;
  background: #d11f2a;
  color: #fff;

  writing-mode: vertical-rl;
  text-orientation: mixed;

  box-shadow: 0 10px 24px rgba(0,0,0,.18);

  /* sofort sichtbar */
  opacity: 1;
  pointer-events: auto;

  /* am Container-Rand */
  right: calc(var(--fs-chat-edge) + 10px);

  /* Mittelpunkt-Positionierung */

  /* wenn JS top/right setzt, “fährt” er weich mit */
  transition: top .28s ease, left .28s ease, opacity .25s ease, transform .25s ease;


  --fs-float-y: 0px;
  transform: translate3d(0, calc(-50% + var(--fs-float-y)), 0);

}


/* darf bleiben (falls dein JS trotzdem is-visible setzt) */
.fs-chat.is-visible .fs-chat-tab {
  opacity: 1;
  pointer-events: auto;
  --fs-float-y: 0px;

  transform: translate3d(0, calc(-50% + var(--fs-float-y)), 0);
}

.fs-chat-panel {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9998;

  width: min(390px, calc(100vw - 36px));
  max-height: min(560px, calc(100vh - 120px));

  background: #fff;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
  overflow: hidden;

  display: none;

  right: calc(var(--fs-chat-edge) + 18px);
}

.fs-chat.is-open .fs-chat-panel { display: block; }

.fs-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  background: #003366;
  color: #fff;
}

.fs-chat-title {
  margin: 0;
  font-size: 14px;
}

.fs-chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.fs-chat-body {
  padding: 10px;
  overflow: auto;
  max-height: 380px;
}

.fs-chat-msg {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  white-space: pre-wrap;
}

.fs-chat-msg.user { background: #e9f1ff; margin-left: 18px; }
.fs-chat-msg.ai   { background: #f3f4f6; margin-right: 18px; }

.fs-chat-footer {
  border-top: 1px solid #eee;
  padding: 10px;
  display: flex;
  gap: 8px;
}

.fs-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  outline: none;
}

.fs-chat-send {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  background: #d11f2a;
  color: #fff;
}

.fs-chat-msg a{
  text-decoration: underline;
  color: #003366;
}

/* Chat-Link als ovales "Pill" */
/* Links im Chat als ovale Pills */
.fs-chat .fs-chat-msg a{
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.1;
  margin: 6px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* AI-Nachricht: Pill in Blau */
.fs-chat .fs-chat-msg.ai a{
  background: #003366;
  color: #fff;
}

/* User (falls mal Links vorkommen): neutral */
.fs-chat .fs-chat-msg.user a{
  background: #111;
  color: #fff;
}

/* Hover */
.fs-chat .fs-chat-msg a:hover{
  filter: brightness(1.05);
}



