/* Chatbot widget — Brenda, floating bottom-right, noir & doré theme */

/* ── Variables ── */
:root {
  --chat-gold: #d4af37;
  --chat-gold-dim: #a88920;
  --chat-gold-glow: rgba(212, 175, 55, 0.18);
  --chat-bg: #0d0d0d;
  --chat-bg-surface: #161616;
  --chat-bg-elevated: #1f1f1f;
  --chat-fg: #e8e4df;
  --chat-fg-muted: #8a8580;
  --chat-radius: 16px;
  --chat-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 175, 55, 0.12);
  --chat-w: 360px;
  --chat-h: 520px;
}

/* ── Container ── */
#chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-size: 15px;
}

/* ── Toggle bubble — Brenda silhouette ── */
#chatbot-toggle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1a1200 0%, #0d0a04 100%);
  border: 1.5px solid var(--chat-gold);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3), 0 2px 8px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  outline-offset: 3px;
  overflow: hidden;
}

#chatbot-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(212, 175, 55, 0.5), 0 2px 10px rgba(0,0,0,0.5);
  border-color: #f0cc55;
}

#chatbot-toggle:active { transform: scale(0.95); }

#chatbot-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chat-gold);
}

/* ── Chat window ── */
#chatbot-window {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: var(--chat-w);
  max-height: var(--chat-h);
  background: var(--chat-bg);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideIn 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#chatbot-window[hidden] { display: none; }

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

/* ── Header ── */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1c1500 0%, #0f0c05 60%, #0d0d0d 100%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
  flex-shrink: 0;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Avatar — contains the Brenda SVG portrait */
.chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Soft gold glow around the portrait */
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.35));
}

.chatbot-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--chat-fg);
  letter-spacing: 0.02em;
}
.chatbot-name span { color: var(--chat-gold); }

.chatbot-status {
  font-size: 11px;
  color: var(--chat-fg-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Online status dot */
.chatbot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25d366;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.25);
  animation: statusPulse 2.5s infinite ease-in-out;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2); }
  50%       { box-shadow: 0 0 0 5px rgba(37, 211, 102, 0.08); }
}

#chatbot-close {
  background: none;
  border: none;
  color: var(--chat-fg-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 5px 7px;
  border-radius: 7px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}
#chatbot-close:hover { color: var(--chat-fg); background: rgba(255,255,255,0.07); }

/* ── Messages area ── */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,0.2) transparent;
}

#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.2); border-radius: 4px; }

.chatbot-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  animation: msgIn 0.18s ease;
}

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

.chatbot-msg-bot {
  background: var(--chat-bg-surface);
  color: var(--chat-fg);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chatbot-msg-user {
  background: linear-gradient(135deg, #2a1f00, #1e1600);
  color: var(--chat-fg);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ── Typing indicator ── */
.chatbot-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 10px 14px;
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  background: var(--chat-gold-dim);
  border-radius: 50%;
  animation: chatDot 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatDot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* ── WhatsApp CTA ── */
#chatbot-whatsapp-cta {
  padding: 10px 14px;
  background: #080f0a;
  border-top: 1px solid rgba(37, 211, 102, 0.2);
}

#chatbot-whatsapp-cta[hidden] { display: none; }

#chatbot-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #25d366, #1da851);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: 10px;
  transition: opacity 0.15s, transform 0.15s;
}
#chatbot-whatsapp-btn:hover { opacity: 0.92; transform: translateY(-1px); }

/* ── Input row ── */
.chatbot-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: var(--chat-bg-elevated);
  flex-shrink: 0;
}

#chatbot-input {
  flex: 1;
  background: var(--chat-bg-surface);
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: 10px;
  color: var(--chat-fg);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
#chatbot-input::placeholder { color: var(--chat-fg-muted); }
#chatbot-input:focus { border-color: rgba(212,175,55,0.45); }
#chatbot-input:disabled { opacity: 0.5; cursor: not-allowed; }

#chatbot-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--chat-gold), var(--chat-gold-dim));
  border: none;
  color: #0a0a0a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}
#chatbot-send:hover { opacity: 0.88; transform: scale(1.04); }
#chatbot-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ── Mobile responsive ── */
@media (max-width: 480px) {
  #chatbot-widget {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }

  #chatbot-window {
    width: auto;
    right: 0;
    left: 0;
    max-height: 80dvh;
  }
}
