/* Alterra Valley Landscaping — Floating AI Chatbot */
:root {
  --avl-sky: #0099cc;
  --avl-sky-dark: #007aa3;
  --avl-green: #5a8a2a;
  --avl-ink: #1a2b22;
  --avl-muted: #6b7a72;
  --avl-bg: #ffffff;
  --avl-bot-bubble: #f1f5f4;
  --avl-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

#avl-chat-root,
#avl-chat-root * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Floating launcher button (NOT a plain bubble) */
#avl-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 14px 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--avl-sky), var(--avl-green));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--avl-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.2s ease;
  animation: avl-pulse 2.8s ease-in-out infinite;
}
#avl-chat-launcher:hover { transform: translateY(-2px) scale(1.03); }
#avl-chat-launcher svg { width: 22px; height: 22px; }
#avl-chat-launcher.avl-hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }

@keyframes avl-pulse {
  0%, 100% { box-shadow: var(--avl-shadow), 0 0 0 0 rgba(0, 153, 204, 0.45); }
  50% { box-shadow: var(--avl-shadow), 0 0 0 12px rgba(0, 153, 204, 0); }
}

#avl-launcher-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: #ff4d4f;
  border: 2px solid #fff;
  border-radius: 50%;
}

/* Chat window */
#avl-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483000;
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 48px);
  background: var(--avl-bg);
  border-radius: 20px;
  box-shadow: var(--avl-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: avl-pop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
#avl-chat-window.avl-hidden { display: none; }

@keyframes avl-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#avl-chat-header {
  background: linear-gradient(135deg, var(--avl-sky), var(--avl-green));
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#avl-chat-header .avl-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#avl-chat-header .avl-avatar svg { width: 22px; height: 22px; }
#avl-chat-header .avl-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
#avl-chat-header .avl-status { font-size: 12px; opacity: 0.9; display: flex; align-items: center; gap: 5px; }
#avl-chat-header .avl-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80;
}
#avl-chat-close {
  margin-left: auto; background: transparent; border: none; color: #fff;
  cursor: pointer; padding: 4px; border-radius: 8px; opacity: 0.85;
}
#avl-chat-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }
#avl-chat-close svg { width: 20px; height: 20px; }

/* Messages */
#avl-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafbfb;
}
.avl-msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.avl-msg.bot { align-self: flex-start; background: var(--avl-bot-bubble); color: var(--avl-ink); border-bottom-left-radius: 4px; }
.avl-msg.user { align-self: flex-end; background: var(--avl-sky); color: #fff; border-bottom-right-radius: 4px; }

.avl-typing { align-self: flex-start; background: var(--avl-bot-bubble); padding: 12px 16px; border-radius: 16px; border-bottom-left-radius: 4px; display: inline-flex; gap: 4px; }
.avl-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--avl-muted); animation: avl-bounce 1.2s infinite; }
.avl-typing span:nth-child(2) { animation-delay: 0.2s; }
.avl-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes avl-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Quick action buttons */
#avl-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 14px 0;
  background: #fafbfb;
}
.avl-quick-btn {
  border: 1px solid var(--avl-sky);
  background: #fff;
  color: var(--avl-sky-dark);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.avl-quick-btn:hover { background: var(--avl-sky); color: #fff; }

/* Lead form */
.avl-lead-form { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #fff; border: 1px solid #e4eae8; border-radius: 14px; align-self: stretch; }
.avl-lead-form input {
  padding: 10px 12px; border: 1px solid #d6dedb; border-radius: 10px; font-size: 14px; outline: none;
  color: var(--avl-ink); background: #fff; caret-color: var(--avl-sky); -webkit-text-fill-color: var(--avl-ink);
}
.avl-lead-form input::placeholder { color: var(--avl-muted); -webkit-text-fill-color: var(--avl-muted); }
.avl-lead-form input:focus { border-color: var(--avl-sky); }
.avl-lead-form button {
  background: var(--avl-green); color: #fff; border: none; padding: 11px; border-radius: 10px;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.avl-lead-form button:hover { filter: brightness(1.05); }
.avl-lead-form button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Input bar */
#avl-chat-input-bar {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px;
  border-top: 1px solid #eef2f1; background: #fff;
}
#avl-chat-input {
  flex: 1; resize: none; border: 1px solid #d6dedb; border-radius: 12px;
  padding: 10px 12px; font-size: 14px; max-height: 96px; outline: none; line-height: 1.4;
  color: var(--avl-ink); background: #fff; caret-color: var(--avl-sky); -webkit-text-fill-color: var(--avl-ink);
}
#avl-chat-input::placeholder { color: var(--avl-muted); -webkit-text-fill-color: var(--avl-muted); }
#avl-chat-input:focus { border-color: var(--avl-sky); }
#avl-chat-send {
  background: var(--avl-sky); border: none; color: #fff; width: 42px; height: 42px;
  border-radius: 12px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
#avl-chat-send:hover { background: var(--avl-sky-dark); }
#avl-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
#avl-chat-send svg { width: 20px; height: 20px; }

#avl-chat-footer { text-align: center; font-size: 10.5px; color: var(--avl-muted); padding: 0 0 8px; background: #fff; }

/* Mobile: full screen */
@media (max-width: 480px) {
  #avl-chat-window {
    width: 100vw; height: 100vh; max-height: 100vh; bottom: 0; right: 0; border-radius: 0;
  }
  #avl-chat-launcher { bottom: 16px; right: 16px; padding: 13px 16px; }
  #avl-chat-launcher .avl-launcher-text { display: none; }
  #avl-chat-launcher { padding: 14px; }
}
