/* Chatbot widget — reuses the site's existing design tokens (see style.css :root),
   added purely additively; nothing here touches existing site styles. */

.chatbot-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20,21,28,.04), 0 16px 32px -12px rgba(22,33,122,.55);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.chatbot-launcher:hover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(20,21,28,.06), 0 22px 40px -16px rgba(22,33,122,.6); }
.chatbot-launcher svg { width: 26px; height: 26px; }
.chatbot-launcher-avatar { width: 100%; height: 100%; border-radius: 50%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.chatbot-launcher-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chatbot-launcher[aria-expanded="true"] .chatbot-launcher-avatar { display: none; }
.chatbot-launcher .chatbot-launcher-icon-close { display: none; }
.chatbot-launcher[aria-expanded="true"] .chatbot-launcher-icon-close { display: block; }

.chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--white);
}

.chatbot-greeting {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 9998;
  max-width: 210px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(20,21,28,.04), 0 20px 40px -16px rgba(20,21,28,.3);
  padding: 10px 26px 10px 12px;
  font-family: 'Manrope', sans-serif;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.chatbot-greeting.is-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; cursor: pointer; }
.chatbot-greeting p { margin: 0; font-size: .78rem; line-height: 1.35; color: var(--ink); }
.chatbot-greeting-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  color: var(--ink-faint);
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background .2s, color .2s;
}
.chatbot-greeting-close:hover { background: var(--paper); color: var(--ink); }

@media (max-width: 480px) {
  .chatbot-greeting { right: 16px; max-width: 180px; }
}

.chatbot-window {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(20,21,28,.04), 0 30px 70px -20px rgba(20,21,28,.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  font-family: 'Manrope', sans-serif;
}
.chatbot-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot-header {
  background: var(--primary);
  color: var(--white);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chatbot-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.chatbot-header-avatar svg { width: 20px; height: 20px; }
.chatbot-header-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chatbot-header-text { flex: 1; min-width: 0; }
.chatbot-header-title { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.chatbot-header-status { font-size: .78rem; color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chatbot-header-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
.chatbot-header-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: 6px;
  display: flex;
  border-radius: var(--radius-sm);
  transition: background .2s, color .2s;
}
.chatbot-header-close:hover { background: rgba(255,255,255,.12); color: var(--white); }
.chatbot-header-close svg { width: 18px; height: 18px; }

.chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper);
}

.chatbot-msg { display: flex; gap: 8px; max-width: 88%; }
.chatbot-msg-assistant { align-self: flex-start; }
.chatbot-msg-user { align-self: flex-end; flex-direction: row-reverse; }

.chatbot-bubble {
  padding: 11px 15px;
  border-radius: var(--radius-md);
  font-size: .89rem;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chatbot-msg-assistant .chatbot-bubble {
  background: var(--white);
  color: var(--ink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 10px rgba(20,21,28,.04), 0 24px 48px -16px rgba(20,21,28,.16);
}
.chatbot-msg-user .chatbot-bubble {
  background: var(--primary);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.chatbot-msg-error .chatbot-bubble {
  background: #fff1ee;
  color: var(--accent-dim);
  border: 1px solid #ffd8cc;
}

.chatbot-typing { display: flex; gap: 4px; align-items: center; padding: 4px 2px; }
.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: chatbot-typing-bounce 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: .15s; }
.chatbot-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatbot-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chatbot-footer {
  flex-shrink: 0;
  padding: 12px 14px;
  background: var(--white);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.chatbot-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: .89rem;
  line-height: 1.4;
  max-height: 100px;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.chatbot-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,33,122,.1); }
.chatbot-input:disabled { background: var(--paper); color: var(--ink-faint); }

.chatbot-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.chatbot-send:hover:not(:disabled) { background: var(--accent-dim); transform: translateY(-1px); }
.chatbot-send:disabled { background: var(--ink-faint); cursor: not-allowed; }
.chatbot-send svg { width: 17px; height: 17px; }

@media (max-width: 480px) {
  .chatbot-window {
    right: 16px;
    left: 16px;
    bottom: 88px;
    width: auto;
    height: calc(100vh - 150px);
  }
  .chatbot-launcher { right: 16px; bottom: 16px; }
}
