/* =========================================================
   Kontakt-Widgets: WhatsApp-Knopf + KI-Assistentin
   Eigene Farbtokens, damit das Widget auf jedem Entwurf
   funktioniert; der Akzent kommt aus der jeweiligen Seite.
   ========================================================= */
.wg{
  --wg-accent:var(--accent,#d1b45a);
  --wg-wa:#25d366;
  --wg-radius:3px;
  --wg-ease:cubic-bezier(.16,1,.3,1);

  --wg-surface:#ffffff;
  --wg-surface-2:#f4f1ec;
  --wg-ink:#1a1714;
  --wg-ink-2:#6a6259;
  --wg-line:#e2ddd4;
  --wg-bubble:#f0ece5;

  position:fixed;right:clamp(.9rem,2.5vw,1.6rem);bottom:clamp(.9rem,2.5vw,1.6rem);
  z-index:70;display:flex;flex-direction:column;align-items:flex-end;gap:.6rem;
  font-family:inherit;font-size:16px;line-height:1.55;
}
.wg[data-widget-theme="dark"]{
  --wg-surface:#141519;
  --wg-surface-2:#1c1e24;
  --wg-ink:#f2f0ed;
  --wg-ink-2:#9d9b99;
  --wg-line:#2a2e37;
  --wg-bubble:#22252c;
}

/* ---------- Knoepfe ---------- */
.wg__btn{
  width:3.4rem;height:3.4rem;display:grid;place-items:center;cursor:pointer;
  border:0;border-radius:999px;padding:0;color:#fff;
  box-shadow:0 12px 28px -10px rgb(10 10 10 / .55);
  transition:transform .35s var(--wg-ease),filter .35s var(--wg-ease)}
.wg__btn:hover{transform:translateY(-3px) scale(1.04)}
.wg__btn:focus-visible{outline:2px solid var(--wg-ink);outline-offset:3px}
.wg__btn svg{width:1.65rem;height:1.65rem;fill:currentColor}
.wg__wa{background:var(--wg-wa)}
.wg__chat{background:var(--wg-accent);position:relative}
.wg__chat .x{display:none}
.wg.is-open .wg__chat .bubble{display:none}
.wg.is-open .wg__chat .x{display:block}

/* kleiner Hinweis, der einmal aufploppt */
.wg__nudge{
  position:absolute;right:calc(100% + .7rem);top:50%;translate:0 -50%;
  white-space:nowrap;background:var(--wg-surface);color:var(--wg-ink);
  border:1px solid var(--wg-line);border-radius:var(--wg-radius);
  padding:.5rem .8rem;font-size:.78rem;box-shadow:0 12px 24px -14px rgb(10 10 10 / .5);
  opacity:0;pointer-events:none;transition:opacity .5s var(--wg-ease),translate .5s var(--wg-ease)}
.wg__nudge.on{opacity:1;translate:0 -50%}
.wg.is-open .wg__nudge{display:none}

/* ---------- Panel ---------- */
.wg__panel{
  position:absolute;right:0;bottom:calc(100% + .7rem);
  width:min(22.5rem,calc(100vw - 1.8rem));
  max-height:min(32rem,calc(100dvh - 8rem));
  display:none;flex-direction:column;overflow:hidden;
  background:var(--wg-surface);color:var(--wg-ink);
  border:1px solid var(--wg-line);border-radius:var(--wg-radius);
  box-shadow:0 40px 70px -28px rgb(10 10 10 / .6)}
.wg.is-open .wg__panel{display:flex;animation:wgIn .38s var(--wg-ease)}
@keyframes wgIn{from{opacity:0;transform:translateY(12px) scale(.985)}to{opacity:1;transform:none}}

.wg__head{display:flex;align-items:center;gap:.7rem;padding:.85rem 1rem;
  border-bottom:1px solid var(--wg-line);background:var(--wg-surface-2)}
.wg__ava{width:2.2rem;height:2.2rem;flex:none;border-radius:999px;display:grid;place-items:center;
  background:var(--wg-accent);color:#fff;font-weight:700;font-size:.85rem}
.wg__who{display:grid;gap:.05rem;min-width:0}
.wg__who b{font-size:.9rem;font-weight:600}
.wg__who span{font-size:.7rem;color:var(--wg-ink-2);display:flex;align-items:center;gap:.35rem}
.wg__dot{width:.42rem;height:.42rem;border-radius:999px;background:var(--wg-wa);flex:none}
.wg__close{margin-left:auto;width:2rem;height:2rem;display:grid;place-items:center;flex:none;
  background:none;border:0;border-radius:999px;color:var(--wg-ink-2);cursor:pointer;transition:color .3s}
.wg__close:hover{color:var(--wg-ink)}
.wg__close svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:2}

.wg__log{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.6rem;
  overscroll-behavior:contain}
.wg__msg{max-width:85%;padding:.6rem .8rem;border-radius:var(--wg-radius);font-size:.86rem;
  animation:wgMsg .35s var(--wg-ease)}
.wg__msg--bot{background:var(--wg-bubble);align-self:flex-start;border-bottom-left-radius:0}
.wg__msg--me{background:var(--wg-accent);color:#fff;align-self:flex-end;border-bottom-right-radius:0}
@keyframes wgMsg{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

.wg__typing{display:flex;gap:.25rem;align-self:flex-start;padding:.7rem .8rem;
  background:var(--wg-bubble);border-radius:var(--wg-radius);border-bottom-left-radius:0}
.wg__typing i{width:.35rem;height:.35rem;border-radius:999px;background:var(--wg-ink-2);
  animation:wgBlink 1.2s infinite}
.wg__typing i:nth-child(2){animation-delay:.15s}
.wg__typing i:nth-child(3){animation-delay:.3s}
@keyframes wgBlink{0%,60%,100%{opacity:.25}30%{opacity:1}}

.wg__chips{display:flex;flex-wrap:wrap;gap:.35rem;padding:0 1rem .7rem}
.wg__chip{background:none;border:1px solid var(--wg-line);color:var(--wg-ink-2);
  border-radius:999px;padding:.35rem .7rem;font:inherit;font-size:.74rem;cursor:pointer;
  transition:border-color .3s,color .3s}
.wg__chip:hover{border-color:var(--wg-accent);color:var(--wg-ink)}

.wg__form{display:flex;gap:.5rem;padding:.7rem;border-top:1px solid var(--wg-line);
  background:var(--wg-surface-2)}
.wg__form input{flex:1;min-width:0;font:inherit;font-size:.86rem;color:var(--wg-ink);
  background:var(--wg-surface);border:1px solid var(--wg-line);border-radius:var(--wg-radius);
  padding:.6rem .7rem}
.wg__form input:focus{outline:none;border-color:var(--wg-accent)}
.wg__send{flex:none;width:2.4rem;border:0;border-radius:var(--wg-radius);cursor:pointer;
  background:var(--wg-accent);color:#fff;display:grid;place-items:center}
.wg__send svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:2}

.wg__note{padding:.5rem 1rem .7rem;font-size:.66rem;line-height:1.5;color:var(--wg-ink-2);
  background:var(--wg-surface-2);border-top:1px solid var(--wg-line)}

@media (max-width:520px){
  .wg__panel{width:calc(100vw - 1.8rem);max-height:calc(100dvh - 7rem)}
  .wg__btn{width:3.1rem;height:3.1rem}
  .wg__nudge{display:none}
}
@media (prefers-reduced-motion:reduce){
  .wg__btn,.wg__panel,.wg__msg,.wg__nudge{animation:none!important;transition:none!important}
  .wg__typing i{animation:none;opacity:.6}
}

.wg .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
