/* ═══════════════════════════════════════════════════════════
   CHATBOT — Qualifying Lead Chat Widget
   ═══════════════════════════════════════════════════════════ */

/* ── Chat Toggle Button ── */
.chatbot-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 900;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #d4a020);
  color: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(226, 166, 49, 0.4);
  transition: all 0.3s var(--ease-out);
}

.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(226, 166, 49, 0.5);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  transition: all 0.3s var(--ease-out);
}

.chatbot-toggle .icon-close {
  display: none;
}

.chatbot-toggle.active .icon-chat {
  display: none;
}

.chatbot-toggle.active .icon-close {
  display: block;
}

.chatbot-toggle.active {
  background: var(--gray-700);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Notification dot */
.chatbot-toggle__dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #e74c3c;
  border-radius: 50%;
  border: 2.5px solid var(--white);
  animation: pulse-dot 2s infinite;
}

.chatbot-toggle.active .chatbot-toggle__dot {
  display: none;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ── Chat Window ── */
.chatbot-window {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  z-index: 899;
  width: 380px;
  max-height: 520px;
  background: var(--white);
  border-radius: 1.25rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.35s var(--ease-out);
}

.chatbot-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ── Header ── */
.chatbot-header {
  background: var(--primary);
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.chatbot-header__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-header__avatar svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.chatbot-header__info h4 {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.chatbot-header__info p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.7rem;
  margin: 2px 0 0;
}

.chatbot-header__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chatbot-header__status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #2ecc71;
  border-radius: 50%;
}

/* ── Messages ── */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f8f9fb;
  min-height: 280px;
  max-height: 340px;
  scroll-behavior: smooth;
}

.chatbot-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: msgFadeIn 0.3s var(--ease-out);
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg--bot {
  background: var(--white);
  color: var(--gray-800);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chatbot-msg--user {
  background: var(--accent);
  color: var(--primary);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: var(--white);
  border-radius: 1rem;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  background: var(--gray-400);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Options/Buttons ── */
.chatbot-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  animation: msgFadeIn 0.3s var(--ease-out) 0.1s both;
}

.chatbot-option {
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--accent);
  background: var(--white);
  color: var(--gray-800);
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  font-family: var(--font-body);
}

.chatbot-option:hover {
  background: var(--accent);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(226, 166, 49, 0.3);
}

/* ── Input Area ── */
.chatbot-input {
  display: none;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--gray-100);
  gap: 0.5rem;
  align-items: center;
  background: var(--white);
  flex-shrink: 0;
}

.chatbot-input.active {
  display: flex;
}

.chatbot-input input {
  flex: 1;
  border: 1.5px solid var(--gray-200);
  border-radius: 2rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
  color: var(--gray-800);
}

.chatbot-input input:focus {
  border-color: var(--accent);
}

.chatbot-input input::placeholder {
  color: var(--gray-400);
}

.chatbot-input button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chatbot-input button:hover {
  background: var(--accent-light);
  transform: scale(1.05);
}

.chatbot-input button svg {
  width: 18px;
  height: 18px;
}

/* ── Footer ── */
.chatbot-footer {
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.6rem;
  color: var(--gray-400);
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}

/* ═══ Mobile ═══ */
@media (max-width: 768px) {
  .chatbot-window {
    position: fixed;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-height: 90vh;
    border-radius: 1.25rem 1.25rem 0 0;
    transform-origin: bottom center;
    z-index: 9999;
  }

  .chatbot-window.active {
    transform: translateY(0) scale(1);
  }

  .chatbot-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 54px;
    height: 54px;
  }

  .chatbot-toggle.active {
    bottom: auto;
    top: 1rem;
    right: 1rem;
    z-index: 910;
  }

  .chatbot-toggle svg {
    width: 24px;
    height: 24px;
  }

  .chatbot-messages {
    max-height: 58vh;
    min-height: 200px;
    padding: 1rem 0.75rem;
  }

  .chatbot-header {
    padding: 1rem;
  }

  .chatbot-options {
    gap: 0.4rem;
  }

  .chatbot-option {
    padding: 0.5rem 0.85rem;
    font-size: 0.78rem;
    flex: 0 0 auto;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chatbot-msg {
    max-width: 90%;
    font-size: 0.84rem;
  }

  .chatbot-footer {
    font-size: 0.58rem;
    padding: 0.4rem 0.75rem;
  }

  .chatbot-input input {
    font-size: 16px; /* prevents iOS zoom */
  }
}
