/* Software-Wegweiser KI-Assistent — Farben und Schrift kommen aus dem Site-Kit der Website. */

#swwai-trigger, #swwai-chat {
  --sw-ink: var(--sww-ink, #0F172A);
  --sw-ink2: var(--sww-ink2, #475569);
  --sw-blue: var(--sww-primary, #4F46E5);
  --sw-deep: var(--sww-deep, #4338CA);
  --sw-amber: var(--sww-accent, #22C55E);
  --sw-amber-d: var(--sww-accent-d, #16A34A);
  --sw-amber-ink: var(--sww-accent-ink, #04210F);
  --sw-line: var(--sww-line, #E2E6F5);
  --sw-mist: var(--sww-mist, #F5F7FF);
  --sw-muted: var(--sww-ink2, #475569);
  font-family: var(--sww-font-body, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
#swwai-chat *, #swwai-chat *::before, #swwai-chat *::after { box-sizing: border-box; }

/* ── Floating trigger ── */
#swwai-trigger {
  position: fixed; bottom: 20px; right: 20px; z-index: 9990;
  display: inline-flex !important; align-items: center !important; gap: 10px;
  height: 54px !important; min-height: 54px !important; padding: 0 20px 0 16px !important; margin: 0 !important;
  background: var(--sw-ink) !important; background-image: none !important; color: #fff !important;
  border: 2px solid var(--sw-amber) !important; border-radius: 999px !important;
  font-size: 15px !important; font-weight: 700 !important; line-height: 1 !important; letter-spacing: 0 !important; text-transform: none !important;
  cursor: pointer; -webkit-appearance: none !important; appearance: none !important;
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, .6), 0 2px 6px rgba(15, 23, 42, .2);
  transition: transform .18s ease, box-shadow .18s ease;
  animation: swwai-pop .35s cubic-bezier(.34, 1.4, .64, 1) both;
}
#swwai-trigger.left { right: auto; left: 20px; }
#swwai-trigger:hover { transform: translateY(-2px); background: var(--sw-ink) !important; color: #fff !important; box-shadow: 0 12px 28px -8px rgba(15, 23, 42, .7), 0 2px 8px rgba(15, 23, 42, .25); }
#swwai-trigger:focus-visible { outline: 3px solid var(--sw-blue); outline-offset: 3px; }
#swwai-trigger svg { width: 24px !important; height: 24px !important; fill: var(--sw-amber) !important; display: block !important; flex: none; pointer-events: none; }
#swwai-trigger.hide { display: none !important; }
#swwai-trigger { position: fixed; }
#swwai-trigger .swwai-online { position: absolute; left: 32px; top: 9px; }
.swwai-online { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 2px var(--sw-ink); flex: none; }
.swwai-online::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #22C55E; animation: swwai-pulse 2s ease-out infinite; }
.swwai-online { position: relative; }
@keyframes swwai-pulse { 0% { transform: scale(.8); opacity: .9; } 70% { transform: scale(2.1); opacity: 0; } 100% { opacity: 0; } }
#swwai-chat .swwai-status { display: flex !important; align-items: center; gap: 6px; }
#swwai-chat .swwai-status .swwai-online { width: 8px; height: 8px; box-shadow: none; }
#swwai-chat .swwai-avatar { position: relative; }
#swwai-chat .swwai-online--av { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; box-shadow: 0 0 0 2px var(--sw-ink); }
#swwai-chat .swwai-online--av::after { display: none; }
@keyframes swwai-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Chat window ── */
#swwai-chat {
  position: fixed; bottom: 20px; right: 20px; z-index: 9991;
  width: 380px; height: min(600px, calc(100vh - 40px));
  display: none; flex-direction: column; overflow: hidden;
  background: var(--sw-mist); color: var(--sw-ink);
  border: 1px solid var(--sw-line); border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .55), 0 4px 14px rgba(15, 23, 42, .12);
  font-size: 15px; line-height: 1.5; text-align: left;
  transform-origin: bottom right;
  animation: swwai-open .2s ease both;
}
#swwai-chat.left { right: auto; left: 20px; transform-origin: bottom left; }
#swwai-chat.open { display: flex; }
#swwai-chat.inline { position: relative; bottom: auto; right: auto; left: auto; width: 100%; max-width: 520px; height: 600px; margin: 0 auto; animation: none; box-shadow: 0 10px 30px -18px rgba(15, 23, 42, .5); }
@keyframes swwai-open { from { transform: scale(.94) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 500px) {
  #swwai-trigger { bottom: 14px; right: 14px; width: 54px !important; padding: 0 !important; justify-content: center !important; }
  #swwai-trigger.left { left: 14px; }
  #swwai-trigger .swwai-trigger-label { display: none; }
  #swwai-trigger .swwai-online { left: auto; right: 8px; top: 8px; }
  #swwai-chat:not(.inline) {
    bottom: 0 !important; right: 0 !important; left: 0 !important;
    width: 100% !important; height: 72vh !important; max-height: 72vh !important;
    border-radius: 16px 16px 0 0 !important; border-bottom: 0;
  }
}

/* ── Header ── */
#swwai-chat .swwai-header { display: flex; align-items: center; gap: 10px; flex: none; padding: 12px 12px 12px 14px; background: var(--sw-ink); color: #fff; border-bottom: 3px solid var(--sw-amber); }
#swwai-chat .swwai-avatar { width: 38px; height: 38px; flex: none; border-radius: 10px; background: transparent; display: grid; place-items: center; }
#swwai-chat .swwai-avatar svg { width: 36px; height: 36px; display: block; }
#swwai-chat .swwai-header-info { flex: 1; min-width: 0; }
#swwai-chat .swwai-header-info strong { display: block; font-size: 15.5px; font-weight: 700; line-height: 1.2; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#swwai-chat .swwai-header-info span { display: block; margin-top: 2px; font-size: 12.5px; color: rgba(255,255,255,.78); }
#swwai-chat .swwai-header-actions { display: flex; gap: 4px; flex: none; }
#swwai-chat .swwai-header-btn {
  width: 36px !important; height: 36px !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important;
  display: grid !important; place-items: center !important;
  background: transparent !important; background-image: none !important; color: rgba(255,255,255,.85) !important;
  border: 0 !important; border-radius: 9px !important; box-shadow: none !important; cursor: pointer;
  -webkit-appearance: none !important; appearance: none !important; transition: background-color .15s ease;
}
#swwai-chat .swwai-header-btn:hover { background: rgba(255, 255, 255, .14) !important; color: #fff !important; }
#swwai-chat .swwai-header-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
#swwai-chat .swwai-header-btn svg { width: 20px; height: 20px; fill: currentColor; display: block; pointer-events: none; }

/* ── Messages ── */
#swwai-chat .swwai-msgs { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 8px; background: var(--sw-mist); }
#swwai-chat .swwai-msgs::-webkit-scrollbar { width: 6px; }
#swwai-chat .swwai-msgs::-webkit-scrollbar-thumb { background: var(--sw-line); border-radius: 3px; }
#swwai-chat .swwai-row { display: flex; animation: swwai-msg .18s ease both; }
#swwai-chat .swwai-row.bot { justify-content: flex-start; }
#swwai-chat .swwai-row.user { justify-content: flex-end; }
@keyframes swwai-msg { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

#swwai-chat .swwai-bub { max-width: 84%; padding: 9px 12px 7px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; word-break: break-word; overflow-wrap: anywhere; }
#swwai-chat .swwai-row.bot .swwai-bub { background: #fff; color: var(--sw-ink); border: 1px solid var(--sw-line); border-bottom-left-radius: 4px; }
#swwai-chat .swwai-row.user .swwai-bub { background: var(--sw-blue); color: #fff; border-bottom-right-radius: 4px; }
#swwai-chat .swwai-bub strong { font-weight: 700; color: inherit; }
#swwai-chat .swwai-time { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1; text-align: right; color: var(--sw-muted); }
#swwai-chat .swwai-row.user .swwai-time { color: rgba(255, 255, 255, .75); }

#swwai-chat .swwai-link { color: var(--sw-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; box-shadow: none; }
#swwai-chat .swwai-link:hover { color: var(--sw-ink); }
#swwai-chat .swwai-link--aff { padding: 2px 7px; background: var(--sw-amber); color: var(--sw-amber-ink); border-radius: 6px; font-weight: 700; text-decoration: none; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#swwai-chat .swwai-link--aff::after { content: " ↗"; }
#swwai-chat .swwai-link--aff:hover { background: var(--sw-amber-d); color: var(--sw-ink); }
#swwai-chat .swwai-affnote { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--sw-line); font-size: 11.5px; line-height: 1.4; color: var(--sw-muted); }
#swwai-chat .swwai-affnote a { color: var(--sw-deep); text-decoration: underline; }

#swwai-chat .swwai-typing-bub { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; background: #fff; border: 1px solid var(--sw-line); border-radius: 14px; border-bottom-left-radius: 4px; }
#swwai-chat .swwai-typing-bub span { width: 7px; height: 7px; background: var(--sw-ink2); opacity: .6; border-radius: 50%; animation: swwai-dot 1.2s infinite; }
#swwai-chat .swwai-typing-bub span:nth-child(2) { animation-delay: .2s; }
#swwai-chat .swwai-typing-bub span:nth-child(3) { animation-delay: .4s; }
@keyframes swwai-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ── Quick replies ── */
#swwai-chat .swwai-chips { flex: none; flex-wrap: wrap; gap: 6px; padding: 4px 12px 8px; background: var(--sw-mist); }
#swwai-chat .swwai-chip {
  padding: 7px 12px !important; margin: 0 !important; min-height: 0 !important;
  background: #fff !important; background-image: none !important; color: var(--sw-deep) !important;
  border: 1.5px solid var(--sw-blue) !important; border-radius: 999px !important; box-shadow: none !important;
  font-family: inherit !important; font-size: 13px !important; font-weight: 600 !important; line-height: 1.2 !important; text-transform: none !important; letter-spacing: 0 !important;
  cursor: pointer; -webkit-appearance: none !important; appearance: none !important; transition: background-color .15s ease, color .15s ease;
}
#swwai-chat .swwai-chip:hover, #swwai-chat .swwai-chip:focus-visible { background: var(--sw-blue) !important; color: #fff !important; outline: none; }

/* ── Input ── */
#swwai-chat .swwai-input-wrap { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px 10px 8px; background: #fff; border-top: 1px solid var(--sw-line); }
#swwai-chat .swwai-textarea {
  flex: 1; min-height: 44px; max-height: 100px; margin: 0; padding: 11px 14px; resize: none;
  background: var(--sw-mist) !important; color: var(--sw-ink) !important; -webkit-text-fill-color: var(--sw-ink) !important;
  border: 1.5px solid var(--sw-line) !important; border-radius: 14px !important; outline: none; box-shadow: none !important;
  font-family: inherit; font-size: 16px; line-height: 1.35;
  transition: border-color .15s ease;
}
#swwai-chat .swwai-textarea::placeholder { color: var(--sw-ink2); -webkit-text-fill-color: var(--sw-ink2); }
#swwai-chat .swwai-textarea:focus { border-color: var(--sw-blue) !important; }
#swwai-chat .swwai-send-btn {
  width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 0 !important; flex: 0 0 44px !important; padding: 0 !important; margin: 0 !important;
  display: grid !important; place-items: center !important;
  background: var(--sw-amber) !important; background-image: none !important; color: var(--sw-amber-ink) !important;
  border: 0 !important; border-radius: 12px !important; box-shadow: none !important; cursor: pointer; line-height: 0 !important;
  -webkit-appearance: none !important; appearance: none !important; transition: background-color .15s ease, transform .15s ease;
}
#swwai-chat .swwai-send-btn:hover { background: var(--sw-amber-d) !important; }
#swwai-chat .swwai-send-btn:active { transform: translateY(1px); }
#swwai-chat .swwai-send-btn:focus-visible { outline: 2px solid var(--sw-blue); outline-offset: 2px; }
#swwai-chat .swwai-send-btn:disabled { opacity: .5; cursor: not-allowed; }
#swwai-chat .swwai-send-btn svg { width: 22px !important; height: 22px !important; fill: var(--sw-amber-ink) !important; display: block !important; margin-left: 2px; pointer-events: none; }

#swwai-chat .swwai-foot { flex: none; margin: 0; padding: 0 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: #fff; font-size: 11px; line-height: 1.4; color: var(--sw-muted); text-align: center; }
#swwai-chat .swwai-foot a { color: var(--sw-deep); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .swwai-online::after { animation: none !important; }
  #swwai-trigger, #swwai-chat, #swwai-chat .swwai-row, #swwai-chat .swwai-typing-bub span { animation: none !important; transition: none !important; }
}
