/* =========================================================
   Sales bot — floating lead capture widget
   ========================================================= */

.chatbot {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 80;
  font-family: var(--font-body);
}

.chatbot__launcher {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 22px 14px 18px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  border: 0;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(10, 126, 164, 0.45), 0 1px 2px rgba(0,0,0,0.1);
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive), background var(--transition-interactive);
}
.chatbot__launcher:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(10, 126, 164, 0.55), 0 2px 4px rgba(0,0,0,0.12);
}
.chatbot__launcher:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.chatbot__launcher svg { width: 22px; height: 22px; flex-shrink: 0; }
.chatbot__launcher-label {
  white-space: nowrap;
}
.chatbot__launcher::after {
  content: "";
  width: 8px; height: 8px;
  background: #3ec46a;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(62, 196, 106, 0.25);
  margin-left: 2px;
}

@media (min-width: 881px) {
  body[data-page="home"] .chatbot__launcher {
    padding: 14px;
  }
  body[data-page="home"] .chatbot__launcher-label {
    display: none;
  }
  body[data-page="home"] .chatbot__launcher::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .chatbot__launcher-label { display: none; }
  .chatbot__launcher { padding: 14px; }
  .chatbot__launcher::after { display: none; }
}

.chatbot__launcher[aria-expanded='true'] { transform: scale(0.95); opacity: 0.85; }

.chatbot__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: min(380px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 100px));
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.chatbot.is-open .chatbot__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: linear-gradient(135deg, var(--color-brand-deep) 0%, var(--color-brand-deep-2) 100%);
  color: #fff;
  position: relative;
}
.chatbot__avatar {
  width: 42px; height: 42px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  color: #34c6e8;
  flex-shrink: 0;
}
.chatbot__heading h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0;
  color: #fff;
  font-weight: 600;
}
.chatbot__heading p {
  font-size: 0.78rem;
  color: #b9c5d8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.chatbot__heading p::before {
  content: "";
  width: 6px; height: 6px;
  background: #3ec46a;
  border-radius: 50%;
}
.chatbot__close {
  margin-left: auto;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  opacity: 0.8;
}
.chatbot__close:hover { background: rgba(255,255,255,0.12); opacity: 1; }

.chatbot__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--color-bg);
}

.chat-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: msgIn 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg--bot {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-divider);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.chat-msg--user {
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.chat-typing span {
  width: 6px; height: 6px;
  background: var(--color-text-faint);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.chat-quick button {
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.chat-quick button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.chatbot__footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.chatbot__input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 10px 14px;
  font-size: 0.9rem;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 40px;
}
.chatbot__input:focus { outline: none; border-color: var(--color-primary); }
.chatbot__send {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  display: grid;
  place-items: center;
  border: 0;
  flex-shrink: 0;
}
.chatbot__send:hover { background: var(--color-primary-hover); }
.chatbot__send:disabled { opacity: 0.5; cursor: not-allowed; }

.chatbot__disclaimer {
  padding: 8px var(--space-5);
  background: var(--color-surface);
  font-size: 0.7rem;
  color: var(--color-text-faint);
  text-align: center;
  border-top: 1px solid var(--color-divider);
}
.chatbot__disclaimer a { color: var(--color-text-muted); }

/* Lead summary card shown inside chat */
.lead-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: 0.85rem;
  display: grid;
  gap: 6px;
}
.lead-summary dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: 4px;
}
.lead-summary dd { color: var(--color-text); }

.lead-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.lead-actions a.btn-primary,
.lead-actions button.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  border: 0;
  cursor: pointer;
}
.lead-actions a.btn-primary:hover,
.lead-actions button.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}
.lead-actions .btn-secondary {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  background: none;
  border: 0;
  padding: 6px;
  cursor: pointer;
  text-decoration: underline;
}
