/* ============================================================
   Servicesare Chatbot — SARA
   ============================================================ */

:root {
  --chat-width:   380px;
  --chat-height:  520px;
  --chat-radius:  16px;
  --chat-shadow:  0 8px 40px rgba(0,0,0,0.18);
}

/* ── Minimiert: runder Bubble-Button ─────────────────────── */

.chatbot-bubble {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-dark);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border: 3px solid var(--color-primary);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
  animation: bubbleIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both,
             bubblePulse 3s ease-in-out 0.5s infinite;
}

.chatbot-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}

@keyframes bubbleIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes bubblePulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 0 0 rgba(236,184,28,0.45); }
  50%       { box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 0 10px rgba(236,184,28,0); }
}

/* Online-Badge */
.chatbot-bubble__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e53935;
  border: 2px solid var(--color-white);
  color: var(--color-white);
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(229,57,53,0); }
}

/* ── Chat-Widget ──────────────────────────────────────────── */

.chatbot {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: var(--chat-width);
  height: var(--chat-height);
  display: flex;
  flex-direction: column;
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  z-index: 9999;
  font-family: var(--font-main);
  overflow: hidden;
  animation: chatOpen 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes chatOpen {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.chatbot.is-hidden {
  display: none;
}

/* ── Header ───────────────────────────────────────────────── */

.chatbot__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--color-primary);
  padding: 0 1.25rem;
  height: 60px;
  flex-shrink: 0;
}

.chatbot__avatar {
  width: 36px;
  height: 36px;
  background: var(--color-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.chatbot__title {
  flex: 1;
}

.chatbot__title strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-dark);
  line-height: 1.2;
}

.chatbot__title span {
  font-size: 0.72rem;
  color: var(--color-dark);
  opacity: 0.65;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Online-Dot im Header */
.chatbot__online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2e7d32;
  display: inline-block;
  animation: dotBlink 2.5s ease-in-out infinite;
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.chatbot__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chatbot__clear,
.chatbot__minimize {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  color: var(--color-dark);
  opacity: 0.55;
  transition: opacity var(--transition);
  display: flex;
  align-items: center;
  border-radius: 4px;
}

.chatbot__clear:hover,
.chatbot__minimize:hover { opacity: 1; }

/* ── Messages ─────────────────────────────────────────────── */

.chatbot__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.chatbot__body::-webkit-scrollbar { width: 4px; }
.chatbot__body::-webkit-scrollbar-track { background: transparent; }
.chatbot__body::-webkit-scrollbar-thumb { background: var(--color-bg-muted); border-radius: 4px; }

.chat-msg {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  max-width: 88%;
  animation: msgIn 0.25s ease both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  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-msg__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 2px;
  font-weight: 700;
  color: var(--color-dark);
}

.chat-msg--user .chat-msg__avatar { background: var(--color-bg-muted); }

.chat-msg__bubble {
  padding: 0.65rem 1rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-msg--bot  .chat-msg__bubble { background: var(--color-bg-light); color: var(--color-dark); border-bottom-left-radius: 4px; }
.chat-msg--user .chat-msg__bubble { background: var(--color-dark); color: var(--color-white); border-bottom-right-radius: 4px; }
.chat-msg__bubble a { color: var(--color-primary); font-weight: 600; text-decoration: underline; }

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  align-self: flex-start;
  animation: msgIn 0.25s ease both;
}

.chat-typing__dots {
  display: flex;
  gap: 4px;
  background: var(--color-bg-light);
  padding: 0.65rem 1rem;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.chat-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-gray);
  animation: dotBounce 1.2s infinite ease-in-out;
}
.chat-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* Nav hint */
.chat-nav-hint {
  align-self: flex-start;
  background: #fff8e1;
  border: 1px solid var(--color-primary);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  color: var(--color-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: msgIn 0.25s ease both;
  cursor: pointer;
  transition: background var(--transition);
}
.chat-nav-hint:hover { background: #fef3c7; }

/* History separator */
.chat-separator {
  text-align: center;
  font-size: 0.72rem;
  color: #aaa;
  padding: 0.25rem 0;
  position: relative;
}
.chat-separator::before,
.chat-separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 22%;
  height: 1px;
  background: var(--color-border);
}
.chat-separator::before { left: 0; }
.chat-separator::after  { right: 0; }

/* No-anim class */
.chat-msg.no-anim,
.chat-nav-hint.no-anim { animation: none; }

/* ── Footer / Input ───────────────────────────────────────── */

.chatbot__footer {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-shrink: 0;
}

.chatbot__input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 0.6rem 1rem;
  font-family: var(--font-main);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
  resize: none;
  background: var(--color-bg-light);
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}
.chatbot__input:focus { border-color: var(--color-primary); background: var(--color-white); }
.chatbot__input::placeholder { color: #aaa; }

.chatbot__send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.chatbot__send:hover  { background: var(--color-primary-alt); transform: scale(1.05); }
.chatbot__send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.chatbot__send svg { width: 16px; height: 16px; fill: var(--color-dark); }

/* ── CTA-Button (inline auf der Seite) ───────────────────── */

.sara-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-dark);
  color: var(--color-white);
  border: 2px solid var(--color-primary);
  border-radius: 40px;
  padding: 0.7rem 1.5rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.sara-cta:hover {
  background: var(--color-primary);
  color: var(--color-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(236,184,28,0.35);
  text-decoration: none;
}
.sara-cta__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53935;
  animation: badgePulse 2s ease-in-out infinite;
}

/* ── Mobile ───────────────────────────────────────────────── */

@media (max-width: 480px) {
  :root { --chat-width: calc(100vw - 2rem); }
  .chatbot  { right: 1rem; bottom: 1rem; }
  .chatbot-bubble { right: 1rem; bottom: 1rem; }
}
