/* ══════════════════════════════════════════════════════════
   BATMAN GARAGE — AI Car Chat Widget
   © batmangarage.com · Dreams Becoming True
   ══════════════════════════════════════════════════════════ */

/* Floating chat bubble (closed state) */
#bg-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #c9a227 0%, #a88419 100%);
  border: 2px solid #0a0a0a;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(201,162,39,0.4), 0 4px 12px rgba(0,0,0,0.5);
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: bg-pulse 2.5s ease-in-out infinite;
}
#bg-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(201,162,39,0.6), 0 6px 16px rgba(0,0,0,0.6);
}
#bg-chat-bubble svg { width: 30px; height: 30px; color: #0a0a0a; }
#bg-chat-bubble.hidden { display: none; }

@keyframes bg-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(201,162,39,0.4), 0 4px 12px rgba(0,0,0,0.5); }
  50% { box-shadow: 0 8px 24px rgba(201,162,39,0.7), 0 4px 20px rgba(201,162,39,0.3); }
}

/* Tooltip on bubble (desktop only) */
@media (min-width: 768px) {
  #bg-chat-bubble::after {
    content: "Ask the Car Expert";
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%);
    background: #0a0a0a;
    color: #c9a227;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid rgba(201,162,39,0.4);
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  #bg-chat-bubble:hover::after { opacity: 1; }
}

/* Chat widget (open state) */
#bg-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 560px;
  background: #0a0a0a;
  border: 1px solid rgba(201,162,39,0.4);
  border-radius: 8px;
  display: none;
  flex-direction: column;
  font-family: 'Rajdhani', sans-serif;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(201,162,39,0.1);
  overflow: hidden;
  z-index: 9999;
}
#bg-chat-widget.open { display: flex; animation: bg-slide-up 0.3s ease-out; }

@keyframes bg-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
#bg-chat-header {
  background: #111;
  border-bottom: 1px solid rgba(201,162,39,0.3);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.bg-chat-title { display: flex; align-items: center; gap: 10px; }
.bg-chat-logo {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: linear-gradient(135deg, #c9a227 0%, #a88419 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  color: #0a0a0a;
  font-size: 1rem;
  letter-spacing: 0.05em;
}
.bg-chat-title-text { display: flex; flex-direction: column; }
.bg-chat-title-text h3 {
  font-family: 'Bebas Neue', sans-serif;
  color: #c9a227;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  line-height: 1;
  margin: 0;
}
.bg-chat-title-text span {
  color: #888;
  font-size: 0.7rem;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.bg-chat-status-dot {
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 4px #4ade80;
}
#bg-chat-close {
  background: none;
  border: 1px solid rgba(201,162,39,0.3);
  color: #c9a227;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
}
#bg-chat-close:hover { background: rgba(201,162,39,0.15); }
#bg-chat-close svg { width: 14px; height: 14px; }

/* Messages area */
#bg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #0a0a0a;
}
#bg-chat-messages::-webkit-scrollbar { width: 6px; }
#bg-chat-messages::-webkit-scrollbar-track { background: #111; }
#bg-chat-messages::-webkit-scrollbar-thumb { background: rgba(201,162,39,0.3); border-radius: 3px; }

.bg-msg {
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
  animation: bg-msg-in 0.25s ease-out;
  word-wrap: break-word;
  white-space: pre-wrap;
}
@keyframes bg-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.bg-msg.user {
  background: linear-gradient(135deg, #c9a227 0%, #a88419 100%);
  color: #0a0a0a;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
  font-weight: 500;
}
.bg-msg.bot {
  background: #1a1a1a;
  color: #e0e0e0;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  border-left: 2px solid #c9a227;
}
.bg-msg.error {
  background: rgba(139,26,26,0.2);
  color: #ff9090;
  align-self: flex-start;
  border-left: 2px solid #8b1a1a;
  font-size: 13px;
}

/* Welcome intro */
.bg-welcome {
  text-align: center;
  padding: 8px 0 12px;
  border-bottom: 1px solid rgba(201,162,39,0.15);
  margin-bottom: 6px;
}
.bg-welcome-title {
  font-family: 'Bebas Neue', sans-serif;
  color: #c9a227;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.bg-welcome-sub { color: #888; font-size: 0.85rem; }

/* Suggested questions */
.bg-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.bg-suggestion {
  background: transparent;
  border: 1px solid rgba(201,162,39,0.3);
  color: #c9a227;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.bg-suggestion:hover {
  background: rgba(201,162,39,0.1);
  border-color: #c9a227;
}

/* Typing indicator */
.bg-typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}
.bg-typing span {
  width: 6px;
  height: 6px;
  background: #c9a227;
  border-radius: 50%;
  animation: bg-typing-bounce 1.4s infinite;
}
.bg-typing span:nth-child(2) { animation-delay: 0.15s; }
.bg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bg-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Turnstile gate */
.bg-captcha-gate {
  padding: 20px;
  text-align: center;
  background: #111;
  border: 1px dashed rgba(201,162,39,0.3);
  border-radius: 6px;
  margin: 8px 0;
}
.bg-captcha-gate h4 {
  font-family: 'Bebas Neue', sans-serif;
  color: #c9a227;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.bg-captcha-gate p {
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
#bg-turnstile-container {
  display: flex;
  justify-content: center;
}

/* Input area */
#bg-chat-input-wrap {
  padding: 12px;
  border-top: 1px solid rgba(201,162,39,0.2);
  background: #111;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
#bg-chat-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 6px;
  background: #0a0a0a;
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: border 0.2s;
}
#bg-chat-input:focus { border-color: #c9a227; box-shadow: 0 0 0 2px rgba(201,162,39,0.15); }
#bg-chat-input::placeholder { color: #555; }
#bg-chat-input:disabled { opacity: 0.5; cursor: not-allowed; }

#bg-chat-send {
  background: linear-gradient(135deg, #c9a227 0%, #a88419 100%);
  border: none;
  color: #0a0a0a;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.2s;
  font-weight: 600;
  flex-shrink: 0;
}
#bg-chat-send:hover:not(:disabled) { transform: scale(1.05); }
#bg-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
#bg-chat-send svg { width: 18px; height: 18px; }

/* Footer */
#bg-chat-footer {
  padding: 6px 12px;
  background: #0a0a0a;
  border-top: 1px solid rgba(201,162,39,0.1);
  text-align: center;
  font-size: 10px;
  color: #555;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
#bg-chat-footer span { color: #c9a227; }

/* Mobile responsive */
@media (max-width: 480px) {
  #bg-chat-widget {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    right: 12px;
    bottom: 12px;
  }
  #bg-chat-bubble {
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }
  #bg-chat-bubble svg { width: 26px; height: 26px; }
}
