/* ==========================================================================
   DATAFINANCE — KI-Assistent (Widget)
   Nutzt die Farben, Radien, Schatten und Schriften aus style.css.
   Vor dem Klick auf den Knopf verbindet sich nichts mit irgendwem.
   ========================================================================== */

/* --- Der Knopf --- */
.df-chat-knopf{
  position:fixed;right:22px;bottom:22px;z-index:120;
  width:56px;height:56px;border-radius:50%;border:0;cursor:pointer;
  background:var(--gold-bright);color:#0B1B33;
  box-shadow:0 6px 22px rgba(11,27,51,.28),0 0 0 1px rgba(200,151,63,.35);
  display:grid;place-items:center;padding:0;
  transition:transform .25s cubic-bezier(.32,.72,0,1),box-shadow .25s ease,opacity .25s ease;
}
.df-chat-knopf svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.df-chat-knopf:hover{transform:translateY(-2px) scale(1.04);box-shadow:0 10px 28px rgba(11,27,51,.34),0 0 0 1px rgba(200,151,63,.5)}
.df-chat-knopf:active{transform:scale(.97)}
.df-chat-knopf[data-offen="true"]{opacity:0;pointer-events:none;transform:scale(.8)}
/* Beschriftung, die beim Überfahren erscheint */
.df-chat-knopf::after{
  content:attr(data-label);position:absolute;right:calc(100% + 12px);top:50%;transform:translateY(-50%) translateX(6px);
  white-space:nowrap;font-family:var(--sans);font-size:14px;font-weight:500;color:var(--text);
  background:var(--surface);border:1px solid var(--rule);border-radius:var(--r-pill);padding:8px 14px;
  box-shadow:var(--shadow-s);opacity:0;pointer-events:none;transition:opacity .2s ease,transform .25s cubic-bezier(.32,.72,0,1);
}
.df-chat-knopf:hover::after,.df-chat-knopf:focus-visible::after{opacity:1;transform:translateY(-50%) translateX(0)}
@media (max-width:700px){
  .df-chat-knopf{right:16px;bottom:max(16px,env(safe-area-inset-bottom));width:50px;height:50px}
  .df-chat-knopf svg{width:23px;height:23px}
  .df-chat-knopf::after{display:none}
}

/* --- Das Fenster --- */
.df-chat{
  position:fixed;right:22px;bottom:22px;z-index:130;
  width:min(400px,calc(100vw - 32px));height:min(640px,calc(100dvh - 44px));
  display:flex;flex-direction:column;overflow:hidden;
  background:var(--ground);color:var(--text);border:1px solid var(--rule);border-radius:var(--r-l);
  box-shadow:var(--shadow-l),0 0 0 1px rgba(200,151,63,.18);
  font-family:var(--sans);font-size:15.5px;line-height:1.5;letter-spacing:-.008em;
  opacity:0;transform:translate3d(0,18px,0) scale(.98);pointer-events:none;visibility:hidden;
  transition:opacity .28s ease,transform .32s cubic-bezier(.32,.72,0,1),visibility .32s;
}
.df-chat[data-offen="true"]{opacity:1;transform:none;pointer-events:auto;visibility:visible}
@media (max-width:700px){
  .df-chat{
    right:0;bottom:0;left:0;width:100%;height:min(88dvh,100dvh - 40px);
    border-radius:var(--r-l) var(--r-l) 0 0;border-bottom:0;
    transform:translate3d(0,100%,0);
  }
  .df-chat[data-offen="true"]{transform:none}
}

/* Kopf */
.df-chat-kopf{
  position:relative;flex:none;display:flex;align-items:center;gap:12px;
  padding:16px 16px 14px 20px;border-bottom:1px solid var(--rule-2);
  background:var(--glass);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);
}
.df-chat-kopf::after{
  content:"";position:absolute;left:0;right:0;bottom:-1px;height:1px;
  background:linear-gradient(90deg,transparent,rgba(200,151,63,.6) 40%,rgba(200,151,63,.6) 60%,transparent);
}
.df-chat-mark{
  width:36px;height:36px;border-radius:50%;flex:none;display:grid;place-items:center;
  background:linear-gradient(145deg,#0B1B33,#1D3A66);color:var(--gold-bright);
  box-shadow:inset 0 0 0 1px rgba(200,151,63,.4);
}
.df-chat-mark svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.df-chat-titel{flex:1;min-width:0}
.df-chat-titel b{display:block;font-family:var(--display);font-weight:600;font-size:16px;letter-spacing:-.014em;color:var(--text)}
.df-chat-titel span{display:block;font-size:12.5px;color:var(--muted);margin-top:2px}
.df-chat-zu{
  flex:none;width:36px;height:36px;border-radius:50%;border:0;background:transparent;color:var(--muted);
  cursor:pointer;display:grid;place-items:center;transition:background .2s ease,color .2s ease;
}
.df-chat-zu:hover{background:var(--rule-2);color:var(--text)}
.df-chat-zu svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}

/* Verlauf */
.df-chat-verlauf{
  flex:1;overflow-y:auto;overscroll-behavior:contain;padding:18px 16px 8px;
  display:flex;flex-direction:column;gap:10px;scroll-behavior:smooth;
}
.df-chat-msg{
  max-width:86%;padding:11px 15px;border-radius:18px;white-space:pre-wrap;word-wrap:break-word;
  animation:df-chat-auf .32s cubic-bezier(.16,1,.3,1) both;
}
.df-chat-msg--a{
  align-self:flex-start;background:var(--surface);border:1px solid var(--rule);color:var(--text-2);
  border-bottom-left-radius:6px;box-shadow:var(--shadow-s);
}
.df-chat-msg--b{
  align-self:flex-end;background:var(--navy);color:var(--ground);border-bottom-right-radius:6px;
}
:root[data-theme="dark"] .df-chat-msg--b{background:#16294A;color:#F5F5F7}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .df-chat-msg--b{background:#16294A;color:#F5F5F7}}
.df-chat-msg a{color:var(--gold);text-decoration:underline;text-underline-offset:2px;font-weight:500}
.df-chat-msg--hinweis{
  align-self:center;max-width:100%;background:transparent;border:0;box-shadow:none;
  font-size:13px;color:var(--muted);text-align:center;padding:4px 10px;
}
@keyframes df-chat-auf{from{opacity:0;transform:translate3d(0,10px,0)}to{opacity:1;transform:none}}

/* Drei Punkte, solange die Antwort unterwegs ist */
.df-chat-tippt{display:inline-flex;gap:4px;align-items:center;height:18px;padding:0 2px}
.df-chat-tippt i{width:6px;height:6px;border-radius:50%;background:var(--gold-bright);opacity:.35;animation:df-chat-punkt 1.1s ease-in-out infinite}
.df-chat-tippt i:nth-child(2){animation-delay:.18s}
.df-chat-tippt i:nth-child(3){animation-delay:.36s}
@keyframes df-chat-punkt{0%,100%{opacity:.3;transform:translateY(0)}50%{opacity:1;transform:translateY(-3px)}}

/* Aktionsknöpfe unter einer Antwort */
.df-chat-aktion{align-self:flex-start;display:flex;flex-wrap:wrap;gap:8px;margin:-2px 0 4px;animation:df-chat-auf .32s cubic-bezier(.16,1,.3,1) both}
.df-chat-aktion .btn{font-size:14px;padding:10px 18px}
.df-chat-aktion .btn--ghost{background:var(--surface)}

/* Weiterleiten: Name und E-Mail */
.df-chat-form{
  align-self:stretch;display:grid;gap:8px;padding:14px;border:1px solid var(--rule);border-radius:var(--r-m);
  background:var(--surface);animation:df-chat-auf .32s cubic-bezier(.16,1,.3,1) both;
}
.df-chat-form p{font-size:13.5px;color:var(--muted);margin:0 0 2px}
.df-chat-form input{font-size:15px;padding:11px 12px}
.df-chat-form .btn{width:100%;font-size:15px;padding:12px 18px}

/* Eingabe */
.df-chat-eingabe{
  flex:none;border-top:1px solid var(--rule-2);padding:10px 12px 8px;background:var(--ground);
  display:flex;gap:8px;align-items:flex-end;
}
.df-chat-eingabe textarea{
  flex:1;resize:none;min-height:44px;max-height:120px;padding:11px 14px;font-size:15.5px;line-height:1.4;
  border-radius:22px;border:1px solid var(--rule);background:var(--surface);color:var(--text);
}
.df-chat-eingabe textarea:focus{border-color:var(--gold-bright);box-shadow:0 0 0 4px rgba(200,151,63,.15);outline:none}
.df-chat-senden{
  flex:none;width:44px;height:44px;border-radius:50%;border:0;cursor:pointer;
  background:var(--navy);color:var(--ground);display:grid;place-items:center;
  transition:transform .2s cubic-bezier(.32,.72,0,1),opacity .2s ease,background .2s ease;
}
.df-chat-senden:hover{transform:translateY(-1px);background:var(--navy-2)}
.df-chat-senden:disabled{opacity:.45;cursor:default;transform:none}
.df-chat-senden svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.df-chat-fuss{
  flex:none;padding:0 16px 10px;font-size:11.5px;line-height:1.45;color:var(--muted);
  display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;background:var(--ground);
}
.df-chat-fuss a{color:var(--muted);text-decoration:underline;text-underline-offset:2px}
.df-chat-fuss a:hover{color:var(--gold)}
.df-chat-honig{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}

/* Bewegung reduzieren */
@media (prefers-reduced-motion:reduce){
  .df-chat,.df-chat-knopf,.df-chat-msg,.df-chat-aktion,.df-chat-form{transition:none;animation:none}
  .df-chat-tippt i{animation:none;opacity:.7}
}
/* Ohne JavaScript gibt es keinen Knopf — das Element wird erst per Skript erzeugt. */
