/* ============================================================
   Summi – Chatbot-Widget  (Biene + APE Easter-Egg)
   ============================================================ */

/* Sicherstellen dass [hidden] immer wirkt (CSS-Spezifität) */
#chatbot-typing[hidden],
#chatbot-window[hidden] { display: none !important; }

/* ── Widget-Container ────────────────────────────────────── */
#chatbot-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .75rem;
  font-family: var(--font-display, 'Outfit', sans-serif);
}

/* ── Hint-Bubble ─────────────────────────────────────────── */
.chatbot-hint {
  background: #fff;
  border: 1.5px solid var(--border, #d0e8f5);
  border-radius: 18px 18px 4px 18px;
  padding: .55rem 1rem;
  font-size: .82rem;
  color: var(--text-primary, #1a1a1a);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px) scale(.95);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  max-width: 240px;
}
.chatbot-hint.hint-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Toggle-Button ───────────────────────────────────────── */
.chatbot-toggle {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--csu-blue, #0080c8);
  border: none;
  cursor: pointer;
  padding: 4px;
  box-shadow: 0 4px 22px rgba(0,128,200,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s, width .3s, border-radius .3s, background .3s;
  overflow: visible;
  position: relative;
}
.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 30px rgba(0,128,200,.55);
}
.chatbot-toggle:focus-visible {
  outline: 3px solid var(--accent, #a2c516);
  outline-offset: 3px;
}

/* APE-Modus: Button wird breiter + heller */
#chatbot-widget.is-ape .chatbot-toggle {
  width: 92px;
  border-radius: 20px;
  background: #F2F2EA;
  border: 2px solid var(--csu-blue, #0080c8);
  box-shadow: 0 4px 22px rgba(0,0,0,.18);
}
#chatbot-widget.is-ape .chatbot-toggle:hover {
  transform: scale(1.05) rotate(-1deg);
}

/* ── SVG-Maskotschen im Button ───────────────────────────── */
#chatbot-bee-svg,
#chatbot-ape-svg {
  display: block;
  transition: opacity .4s;
}
#chatbot-bee-svg { width: 52px; height: 52px; }
#chatbot-ape-svg { width: 84px; height: 58px; display: none; }

/* ── Bee-Animationen ─────────────────────────────────────── */
@keyframes bee-bob {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-5px); }
}
@keyframes bee-celebrate {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(-13deg) scale(1.06); }
  45%  { transform: rotate(11deg) scale(1.09); }
  65%  { transform: rotate(-7deg) scale(1.05); }
  82%  { transform: rotate(4deg) scale(1.02); }
  100% { transform: rotate(0deg) scale(1); }
}
@keyframes wing-flutter {
  0%, 100% { transform: scaleY(1);   opacity: .85; }
  50%       { transform: scaleY(.2); opacity: .45; }
}

.bee-wing {
  transform-box: fill-box;
}
.bee-wing-l {
  transform-origin: right center;
  animation: wing-flutter .12s linear infinite;
}
.bee-wing-r {
  transform-origin: left center;
  animation: wing-flutter .12s linear infinite .06s;
}

.bee-bobbing { animation: bee-bob 2.2s ease-in-out infinite; }
.bee-celebrating { animation: bee-celebrate .65s ease-in-out; }

/* ── APE-Animationen ─────────────────────────────────────── */
@keyframes ape-drive {
  0%, 100% { transform: translateY(0)  rotate(0deg); }
  25%       { transform: translateY(-2px) rotate(-1.2deg); }
  75%       { transform: translateY(-1px) rotate(1.2deg); }
}
#chatbot-ape-svg { animation: ape-drive .7s ease-in-out infinite; }

/* ── Chat-Fenster ────────────────────────────────────────── */
.chatbot-window {
  width: 360px;
  max-height: 520px;
  background: var(--bg-light, #eef2f5);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  border: 1px solid rgba(0,128,200,.15);
  opacity: 0;
  transform: translateY(10px) scale(.97);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.chatbot-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.chatbot-header {
  background: var(--csu-blue, #0080c8);
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-shrink: 0;
}
.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.chatbot-avatar-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 1.25rem;
  line-height: 1;
}
.chatbot-header-info .chatbot-name {
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  line-height: 1.2;
}
.chatbot-status {
  font-size: .72rem;
  color: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.chatbot-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent, #a2c516);
  box-shadow: 0 0 0 2px rgba(162,197,22,.35);
}
.chatbot-close {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.chatbot-close:hover { background: rgba(255,255,255,.32); }

/* Messages */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  scroll-behavior: smooth;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 2px; }

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
  max-width: 90%;
  animation: msg-in .2s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot  { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-bubble {
  padding: .55rem .9rem;
  border-radius: 16px;
  font-size: .875rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg.bot  .chat-bubble {
  background: #fff;
  color: var(--text-primary, #1a1a1a);
  border: 1px solid var(--border, #d0e8f5);
  border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-bubble {
  background: var(--csu-blue, #0080c8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-avatar-mini {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

/* Typing indicator */
.chatbot-typing {
  padding: .4rem 1rem .6rem;
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}
.chatbot-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted, #757575);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.chatbot-typing-dot:nth-child(2) { animation-delay: .2s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-7px); }
}

/* Input form */
.chatbot-form {
  display: flex;
  gap: .5rem;
  padding: .65rem .75rem;
  border-top: 1px solid var(--border, #d0e8f5);
  background: #fff;
  flex-shrink: 0;
}
.chatbot-input {
  flex: 1;
  border: 1.5px solid var(--border, #d0e8f5);
  border-radius: 22px;
  padding: .45rem .9rem;
  font-size: .875rem;
  font-family: var(--font-body, serif);
  outline: none;
  transition: border-color .2s;
  background: var(--bg, #fff);
  color: var(--text-primary, #1a1a1a);
}
.chatbot-input:focus { border-color: var(--csu-blue, #0080c8); }
.chatbot-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--csu-blue, #0080c8);
  border: none;
  color: #fff;
  font-size: .95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .15s;
  flex-shrink: 0;
}
.chatbot-send:hover { background: var(--csu-blue-dark, #005f96); transform: scale(1.08); }
.chatbot-send:disabled { background: var(--text-muted, #aaa); cursor: not-allowed; transform: none; }

/* Disclaimer */
.chatbot-disclaimer {
  font-size: .7rem;
  color: var(--text-muted, #757575);
  text-align: center;
  padding: .3rem .75rem .5rem;
  background: #fff;
  border-top: 1px solid var(--border, #d0e8f5);
  flex-shrink: 0;
}
.chatbot-disclaimer a { color: var(--csu-blue, #0080c8); text-decoration: none; }

/* Error message */
.chat-bubble.error {
  background: #fff0f0;
  border-color: #ffcccc;
  color: #c00;
}

/* ── Mobil ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  #chatbot-widget {
    bottom: 1rem;
    right: 1rem;
  }
  .chatbot-window {
    width: calc(100vw - 2rem);
    max-height: calc(100vh - 110px);
  }
}
