
.chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(195, 38, 47, 0.4);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s ease;
  border: none;
  outline: none;
}

.chatbot-launcher:hover {
  transform: scale(1.1);
  background: var(--brand-dark);
}

.chatbot-launcher svg {
  width: 24px;
  height: 24px;
}

.chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--paper);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.chatbot-window.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chatbot-header {
  background: var(--ink);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 32px;
  height: 32px;
  background: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-avatar svg {
  width: 18px;
  height: 18px;
}

.chatbot-header-text h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.chatbot-header-text span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-header-text span::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
}

.chatbot-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: 4px;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--soft);
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  position: relative;
}

.chat-message.bot {
  align-self: flex-start;
  background: #fff;
  color: var(--ink);
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chat-message.user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 2px;
  box-shadow: 0 2px 8px rgba(195, 38, 47, 0.2);
}

.chat-message p {
  margin: 0;
}

.chat-message .cta-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--soft-2);
  color: var(--ink);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s;
}

.chat-message .cta-button:hover {
  background: var(--line);
}

.chat-message.user .cta-button {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  width: fit-content;
  align-self: flex-start;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.quick-reply-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-reply-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: rgba(195, 38, 47, 0.04);
}

.chatbot-input-area {
  padding: 16px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
}

.chatbot-input-area input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-input-area input:focus {
  border-color: var(--brand);
}

.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.chatbot-send:hover {
  background: var(--brand-dark);
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
}

/* Accessibility: Keyboard focus */
.chatbot-launcher:focus-visible,
.chatbot-close:focus-visible,
.chatbot-send:focus-visible,
.quick-reply-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .chatbot-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  
  .chatbot-launcher.is-active {
    display: none;
  }
}
