/* ═══════════════════════════════════════════════════════════
   Big Brothers Tree Services — Chatbot Styles
   ═══════════════════════════════════════════════════════════ */
:root {
  --bb-primary: #44a420;
  --bb-primary-dark: #2d7315;
  --bb-gold: #dfac16;
  --bb-bg: #0f1f10;
  --bb-surface: #1a2e1a;
  --bb-surface2: #243824;
  --bb-text: #f0f4f0;
  --bb-text-muted: rgba(240,244,240,0.55);
  --bb-border: rgba(68,164,32,0.2);
  --bb-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(68,164,32,0.15);
  --bb-radius: 20px;
  --bb-z: 99999;
}

/* ── Floating Button ─────────────────────────────────────── */
#bb-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--bb-z);
  width: 64px;
  height: 64px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
#bb-chat-btn:hover { transform: scale(1.1) rotate(-5deg); }
#bb-chat-btn:active { transform: scale(0.95); }

/* Pulse ring */
#bb-chat-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  border: 2px solid rgba(68,164,32,0.5);
  animation: bb-pulse-ring 2.5s ease-in-out infinite;
}
#bb-chat-btn::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  border: 1.5px solid rgba(223,172,22,0.3);
  animation: bb-pulse-ring 2.5s ease-in-out infinite 0.5s;
}

@keyframes bb-pulse-ring {
  0%   { transform: scale(1); opacity: 0.8; }
  50%  { transform: scale(1.12); opacity: 0.3; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* Badge notification */
#bb-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--bb-gold);
  color: #0f1f10;
  font-size: 11px;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bb-badge-pop 0.4s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 2px 8px rgba(223,172,22,0.5);
}
@keyframes bb-badge-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Chat Container ──────────────────────────────────────── */
#bb-chat {
  position: fixed;
  bottom: 104px;
  right: 28px;
  z-index: var(--bb-z);
  width: 380px;
  height: 520px;
  background: var(--bb-bg);
  border-radius: var(--bb-radius);
  box-shadow: var(--bb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--bb-border);
  transform-origin: bottom right;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
}
#bb-chat.bb-hidden {
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
}
#bb-chat.bb-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ── Header ──────────────────────────────────────────────── */
#bb-header {
  background: linear-gradient(135deg, var(--bb-primary-dark) 0%, var(--bb-primary) 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}
#bb-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(223,172,22,0.5), transparent);
}
#bb-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.2);
}
#bb-header-info { flex: 1; }
#bb-header-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: #fff;
  line-height: 1;
  margin-bottom: 3px;
}
#bb-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  font-family: 'Inter', sans-serif;
}
.bb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ee04a;
  animation: bb-status-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 4px #6ee04a;
}
@keyframes bb-status-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}
#bb-close {
  background: rgba(255,255,255,0.12);
  border: none;
  color: rgba(255,255,255,0.8);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
#bb-close:hover { background: rgba(255,255,255,0.22); color: #fff; }

/* ── Messages Area ───────────────────────────────────────── */
#bb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
#bb-messages::-webkit-scrollbar { width: 4px; }
#bb-messages::-webkit-scrollbar-track { background: transparent; }
#bb-messages::-webkit-scrollbar-thumb { background: var(--bb-border); border-radius: 2px; }

.bb-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: bb-msg-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes bb-msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.bb-msg.bb-user { align-self: flex-end; align-items: flex-end; }
.bb-msg.bb-bot  { align-self: flex-start; align-items: flex-start; }

.bb-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
}
.bb-msg.bb-user .bb-bubble {
  background: linear-gradient(135deg, var(--bb-primary) 0%, var(--bb-primary-dark) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bb-msg.bb-bot .bb-bubble {
  background: var(--bb-surface);
  color: var(--bb-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--bb-border);
}
.bb-bubble a { color: var(--bb-gold); text-decoration: none; }
.bb-bubble a:hover { text-decoration: underline; }
.bb-bubble strong { color: #fff; font-weight: 700; }
.bb-bubble ul { margin: 6px 0 0 16px; padding: 0; }
.bb-bubble li { margin-bottom: 3px; }

/* Typing indicator */
#bb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bb-surface);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--bb-border);
  width: fit-content;
  animation: bb-msg-in 0.3s ease;
}
.bb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bb-primary);
  animation: bb-typing-dot 1.2s ease-in-out infinite;
}
.bb-dot:nth-child(2) { animation-delay: 0.2s; }
.bb-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bb-typing-dot {
  0%,80%,100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Quick Buttons ───────────────────────────────────────── */
#bb-quick {
  padding: 8px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid var(--bb-border);
}
.bb-quick-btn {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  color: var(--bb-text);
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.bb-quick-btn:hover {
  background: var(--bb-primary);
  border-color: var(--bb-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Input Area ──────────────────────────────────────────── */
#bb-input-area {
  padding: 12px 14px 14px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  border-top: 1px solid var(--bb-border);
  background: var(--bb-surface);
}
#bb-input {
  flex: 1;
  background: var(--bb-bg);
  border: 1px solid var(--bb-border);
  border-radius: 12px;
  color: var(--bb-text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 9px 13px;
  resize: none;
  outline: none;
  max-height: 100px;
  min-height: 38px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
#bb-input:focus { border-color: var(--bb-primary); }
#bb-input::placeholder { color: var(--bb-text-muted); }
#bb-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bb-primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
#bb-send:hover { background: var(--bb-primary-dark); transform: scale(1.05); }
#bb-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  #bb-chat {
    bottom: 0; right: 0; left: 0;
    width: 100%;
    height: 85dvh;
    border-radius: 20px 20px 0 0;
  }
  #bb-chat-btn { bottom: 20px; right: 20px; }
}
