/* === Chat Widget — Terminbuchungs-Bot === */

/* Floating chat button */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.55);
}
.chat-fab svg { width: 28px; height: 28px; fill: white; }
.chat-fab.open { background: var(--surface, #1e293b); }

/* Chat window */
.chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--bg-2, #111827);
  border: 1px solid var(--border, #334155);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 901;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.chat-header {
  background: var(--accent, #6366f1);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.chat-header-info { flex: 1; }
.chat-header-name {
  color: white;
  font-family: var(--font-head, 'Bricolage Grotesque', sans-serif);
  font-weight: 700;
  font-size: 0.95rem;
}
.chat-header-status {
  color: rgba(255,255,255,0.75);
  font-size: 0.78rem;
}
.chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.7;
  padding: 4px;
}
.chat-close:hover { opacity: 1; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  max-width: 85%;
  line-height: 1.5;
  font-size: 0.88rem;
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; text-align: right; }
.chat-msg .bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  word-break: break-word;
}
.chat-msg.bot .bubble {
  background: var(--surface, #1e293b);
  border-bottom-left-radius: 4px;
  color: var(--text, #f1f5f9);
}
.chat-msg.user .bubble {
  background: var(--accent, #6366f1);
  border-bottom-right-radius: 4px;
  color: white;
}
.chat-msg .timestamp {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
  padding: 0 4px;
}
.chat-msg.calendly .bubble {
  border: 1px solid var(--accent, #6366f1);
  background: transparent;
}
.chat-msg.calendly .calendly-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 16px;
  background: var(--accent, #6366f1);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s;
}
.chat-msg.calendly .calendly-btn:hover {
  background: var(--accent-2, #818cf8);
}
.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.chat-typing span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted, #94a3b8);
  animation: bounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #334155);
  display: flex;
  gap: 8px;
}
.chat-input {
  flex: 1;
  background: var(--surface, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 24px;
  padding: 10px 16px;
  color: var(--text, #f1f5f9);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.88rem;
  outline: none;
  resize: none;
}
.chat-input:focus { border-color: var(--accent, #6366f1); }
.chat-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-send:hover { background: var(--accent-2, #818cf8); }
.chat-send svg { fill: white; width: 18px; height: 18px; }

/* Quick replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px;
  border-top: 1px solid var(--border, #334155);
}
.quick-reply {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--accent, #6366f1);
  background: transparent;
  color: var(--accent-2, #818cf8);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.quick-reply:hover {
  background: var(--accent, #6366f1);
  color: white;
}

/* Hidden */
.chat-window.hidden,
.chat-fab.hidden { display: none; }