/* KI-Assistent – Chat-Fenster */
.wa-ai { --ai-bg: #0a1030; --ai-line: rgba(140, 180, 255, .18); font-family: "Jakarta", system-ui, sans-serif; }
.wa-ai-sr { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Start-Button (über dem WhatsApp-Button) */
.wa-ai-launch {
  position: fixed; right: 20px; bottom: 92px; z-index: 9998;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 8px 8px; margin: 0;
  border: 1px solid rgba(160, 210, 255, .35); border-radius: 999px;
  background: rgba(8, 14, 44, .88); color: #f2f5ff;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px -14px rgba(0, 56, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .15);
  font: 500 .88rem "Jakarta", system-ui, sans-serif; text-transform: none; letter-spacing: 0; cursor: pointer;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
}
.wa-ai-launch:hover { transform: translateY(-3px); box-shadow: 0 22px 46px -14px rgba(0, 120, 255, .9); }
.wa-ai-launch-ico, .wa-ai-avatar {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #0038ff, #2f7bff 55%, #00d1ff);
  color: #fff; font-weight: 800; font-size: .85rem; letter-spacing: .02em;
  box-shadow: 0 0 0 4px rgba(47, 123, 255, .22);
}
.wa-ai-launch-ico { animation: waAiPing 2.6s ease-out infinite; }
@keyframes waAiPing { 0% { box-shadow: 0 0 0 0 rgba(0, 209, 255, .55); } 70%, 100% { box-shadow: 0 0 0 12px rgba(0, 209, 255, 0); } }
.wa-ai-launch-txt strong { color: #7fd8ff; }
.wa-ai.open .wa-ai-launch { opacity: 0; pointer-events: none; transform: scale(.9); }

/* Fenster */
.wa-ai-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  display: flex; flex-direction: column;
  width: min(390px, calc(100vw - 24px)); height: min(620px, calc(100vh - 40px));
  border-radius: 26px; overflow: hidden;
  border: 1px solid rgba(140, 200, 255, .25);
  background: rgba(8, 14, 40, .9);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 50px 100px -30px rgba(0, 56, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .08);
  color: #f2f5ff;
  animation: waAiIn .35s cubic-bezier(.2, .8, .2, 1);
}
.wa-ai-panel[hidden] { display: none; }
@keyframes waAiIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

.wa-ai-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--ai-line); }
.wa-ai-title { display: grid; flex: 1; }
.wa-ai-title strong { font-size: .98rem; }
.wa-ai-status { font-size: .78rem; color: #3dffa8; }
.wa-ai-status::before { content: "● "; }
.wa-ai-icon {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; margin: 0;
  border-radius: 10px; border: 1px solid var(--ai-line); background: rgba(255, 255, 255, .05);
  color: #c9d1ec; font-size: .95rem; line-height: 1; cursor: pointer; text-transform: none;
}
.wa-ai-icon:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.wa-ai-body { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; scrollbar-width: thin; }
.wa-ai-msg { max-width: 86%; padding: 11px 15px; border-radius: 18px; font-size: .93rem; line-height: 1.5; overflow-wrap: anywhere; animation: waAiMsg .3s ease-out; }
@keyframes waAiMsg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.wa-ai-user { align-self: flex-end; background: #0038ff; color: #fff; border-bottom-right-radius: 6px; }
.wa-ai-bot { align-self: flex-start; background: rgba(255, 255, 255, .08); border: 1px solid var(--ai-line); border-bottom-left-radius: 6px; color: #e6ebff; }
.wa-ai-bot a { color: #7fd8ff; }
.wa-ai-error { border-color: rgba(255, 95, 122, .45); background: rgba(255, 95, 122, .1); color: #ffc2cc; }
.wa-ai-ok { border-color: rgba(61, 255, 168, .4); background: rgba(61, 255, 168, .1); color: #b6ffd9; font-weight: 600; }
.wa-ai-typing { display: flex; gap: 5px; padding: 14px 16px; }
.wa-ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa5c8; animation: waAiDot 1.2s infinite; }
.wa-ai-typing i:nth-child(2) { animation-delay: .15s; }
.wa-ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes waAiDot { 0%, 60%, 100% { transform: none; opacity: .6; } 30% { transform: translateY(-5px); opacity: 1; } }

.wa-ai-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.wa-ai-quick:empty { display: none; }
.wa-ai-chip {
  padding: 7px 12px; margin: 0; border-radius: 999px;
  border: 1px solid rgba(111, 163, 255, .4); background: rgba(47, 123, 255, .12);
  color: #cfe0ff; font: 600 .8rem "Jakarta", system-ui, sans-serif; text-transform: none; letter-spacing: 0; cursor: pointer;
}
.wa-ai-chip:hover { background: rgba(47, 123, 255, .3); color: #fff; }

.wa-ai-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ai-line); }
.wa-ai-form textarea {
  flex: 1; min-height: 44px; max-height: 120px; margin: 0; padding: 11px 14px;
  border: 1px solid var(--ai-line); border-radius: 14px; background: rgba(0, 0, 0, .3);
  color: #fff; font: 16px/1.4 "Jakarta", system-ui, sans-serif; resize: none; width: auto; display: block;
}
.wa-ai-form textarea:focus { outline: none; border-color: #2f7bff; box-shadow: 0 0 0 3px rgba(47, 123, 255, .25); }
.wa-ai-send {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; margin: 0;
  border: 0; border-radius: 14px; background: linear-gradient(135deg, #0038ff, #00b7ff); color: #fff;
  font-size: 1.05rem; cursor: pointer; text-transform: none;
}
.wa-ai-send:disabled { opacity: .5; cursor: wait; }
.wa-ai-note { margin: 0; padding: 0 16px 12px; font-size: .7rem; line-height: 1.45; color: #8f9bc2; }
.wa-ai-note a { color: #9fc6ff; }

@media (max-width: 600px) {
  .wa-ai-launch { right: 14px; bottom: 84px; padding: 6px; }
  .wa-ai-launch-txt { display: none; }
  .wa-ai-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .admin-bar .wa-ai-panel { height: calc(100dvh - 46px); }
}
@media (prefers-reduced-motion: reduce) { .wa-ai-launch-ico, .wa-ai-panel, .wa-ai-msg { animation: none; } }
/* Chat liegt über dem Handy-Menü nicht im Weg */
body.menu-open .wa-ai { display: none; }
