/* Aithena: KI-Chat-Assistentin. Nutzt die Farben der Website, mit Fallbacks. */
#aithena {
  --ai-ink: var(--ink, #10150b);
  --ai-muted: var(--muted, #5b6450);
  --ai-line: var(--line, #e3e3d8);
  --ai-paper: var(--paper, #f7f6f1);
  --ai-green: var(--green, #84ba3f);
  --ai-green-dark: var(--green-dark, #44701d);
  --ai-soft: var(--green-soft, #ecf3e0);
  --ai-lime: var(--lime, #d9f99d);
  --ai-font: var(--font, "Inter", "Segoe UI", system-ui, sans-serif);
  position: fixed; right: 20px; bottom: 20px; z-index: 900; font-family: var(--ai-font);
}
#aithena *, #aithena *::before, #aithena *::after { box-sizing: border-box; }
#aithena [hidden] { display: none !important; }

.aithena-launcher {
  position: relative; display: block; width: 64px; height: 64px; padding: 4px; border: 0; border-radius: 50%;
  background: var(--ai-lime); cursor: pointer; box-shadow: 0 12px 32px rgba(16, 21, 11, .22);
  transition: transform .2s ease;
}
.aithena-launcher:hover { transform: translateY(-2px); }
.aithena-launcher:focus-visible, #aithena button:focus-visible, #aithena a:focus-visible, .aithena-input:focus-visible { outline: 3px solid var(--ai-green-dark); outline-offset: 2px; }
.aithena-avatar { display: block; border-radius: 50%; object-fit: cover; flex: none; background: var(--ai-soft); }
.aithena-launcher .aithena-avatar { width: 56px; height: 56px; }
.aithena-launcher-badge {
  position: absolute; right: -2px; bottom: -2px; padding: 2px 6px; border-radius: 999px; background: var(--ai-ink); color: #fff;
  font: 700 .62rem/1.2 var(--ai-font); letter-spacing: .04em; border: 2px solid #fff;
}
.aithena-launcher-hint {
  position: absolute; right: 74px; top: 50%; translate: 0 -50%; white-space: nowrap; padding: 8px 12px; border-radius: 12px;
  background: #fff; color: var(--ai-ink); font: 600 .85rem/1.2 var(--ai-font); box-shadow: 0 8px 24px rgba(16, 21, 11, .14);
  opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.aithena-launcher:hover .aithena-launcher-hint, .aithena-launcher:focus-visible .aithena-launcher-hint { opacity: 1; }
#aithena.is-open .aithena-launcher-hint { display: none; }

.aithena-panel {
  position: absolute; right: 0; bottom: 78px; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100dvh - 120px));
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--ai-line); border-radius: 22px; overflow: hidden;
  box-shadow: 0 24px 64px rgba(16, 21, 11, .24); color: var(--ai-ink);
}
.aithena-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--ai-ink); color: #fff; }
.aithena-head .aithena-avatar { width: 44px; height: 44px; border: 2px solid var(--ai-lime); }
.aithena-who { display: flex; flex-direction: column; line-height: 1.25; margin-right: auto; }
.aithena-who strong { font-size: 1rem; }
.aithena-who span { font-size: .78rem; color: #c9d3bd; }
.aithena-close, .aithena-reset { border: 0; background: transparent; color: #fff; cursor: pointer; border-radius: 10px; }
.aithena-close { width: 36px; height: 36px; font-size: 1.6rem; line-height: 1; }
.aithena-reset { padding: 6px 8px; font: 500 .74rem/1 var(--ai-font); color: #c9d3bd; }
.aithena-close:hover, .aithena-reset:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.aithena-log { flex: 1; overflow-y: auto; padding: 16px; background: var(--ai-paper); display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.aithena-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.aithena-msg .aithena-avatar { width: 28px; height: 28px; }
.aithena-msg--user { align-self: flex-end; }
.aithena-bubble { padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.5; overflow-wrap: anywhere; }
.aithena-msg--assistant .aithena-bubble { background: #fff; border: 1px solid var(--ai-line); border-bottom-left-radius: 4px; }
.aithena-msg--user .aithena-bubble { background: var(--ai-ink); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.aithena-bubble p { margin: 0 0 .5em; }
.aithena-bubble p:last-child, .aithena-bubble ul:last-child { margin-bottom: 0; }
.aithena-bubble ul { margin: 0 0 .5em; padding-left: 1.1em; }
.aithena-bubble a { color: var(--ai-green-dark); font-weight: 600; text-underline-offset: 2px; }
.aithena-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.aithena-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ai-muted); animation: aithena-dot 1.2s infinite ease-in-out; }
.aithena-dots i:nth-child(2) { animation-delay: .15s; }
.aithena-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aithena-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.aithena-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; background: #fff; }
.aithena-chips:empty { display: none; }
.aithena-chip {
  border: 1px solid var(--ai-line); background: var(--ai-soft); color: var(--ai-ink); border-radius: 999px; padding: 7px 12px;
  font: 500 .8rem/1.25 var(--ai-font); cursor: pointer; text-align: left;
}
.aithena-chip:hover { border-color: var(--ai-green); }

.aithena-consent { padding: 14px 16px; background: #fff; border-top: 1px solid var(--ai-line); font-size: .8rem; line-height: 1.45; color: var(--ai-muted); }
.aithena-consent p { margin: 0 0 10px; }
.aithena-consent a { color: var(--ai-green-dark); }
.aithena-accept {
  width: 100%; border: 0; border-radius: 999px; padding: 11px 16px; background: var(--ai-ink); color: #fff; font: 600 .9rem/1 var(--ai-font); cursor: pointer;
}
.aithena-accept:hover { background: #26301b; }

.aithena-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; background: #fff; border-top: 1px solid var(--ai-line); }
.aithena-input {
  flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 14px; border: 1px solid var(--ai-line); border-radius: 14px;
  font: 400 .92rem/1.4 var(--ai-font); color: var(--ai-ink); background: var(--ai-paper);
}
.aithena-send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--ai-green); color: var(--ai-ink); font-size: 1.05rem; cursor: pointer; }
.aithena-send:disabled, .aithena-input:disabled { opacity: .55; cursor: wait; }
.aithena-foot { margin: 0; padding: 0 12px 10px; background: #fff; font-size: .68rem; color: var(--ai-muted); text-align: center; }

@media (max-width: 520px) {
  #aithena { right: 14px; bottom: 14px; }
  .aithena-panel { position: fixed; inset: auto 8px 8px 8px; width: auto; height: min(640px, calc(100dvh - 16px)); }
  #aithena.is-open .aithena-launcher { display: none; }
  .aithena-launcher-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .aithena-launcher, .aithena-dots i { transition: none; animation: none; }
}
@media print { #aithena { display: none; } }
