/* BestCarDeal 24/7 AI Chatbot Bubble & Panel */
.bcd-ai {
  position: fixed;
  right: 14px;
  bottom: calc(var(--tabbar-h, 64px) + 14px + env(safe-area-inset-bottom));
  z-index: 1650;
  font-family: var(--font, 'Lato', system-ui, sans-serif);
}

@media (min-width: 900px) {
  .bcd-ai {
    right: 24px;
    bottom: 24px;
  }
}

/* Floating Greeting Pill */
.bcd-ai-teaser {
  position: absolute;
  right: 74px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  background: rgba(20, 20, 24, .92);
  border: 1px solid rgba(227, 28, 121, .45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 255, 255, .06) inset;
  backdrop-filter: blur(12px);
  white-space: nowrap;
  animation: bcdTeaserIn .45s cubic-bezier(.2, .9, .2, 1) both;
}
.bcd-ai-teaser[hidden] { display: none; }
.bcd-ai-teaser-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  padding: 2px 4px 2px 0;
}
.bcd-ai-teaser-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .25);
}
.bcd-ai-teaser-x {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .55);
  font-size: 1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bcd-ai-teaser-x:hover { color: #fff; background: rgba(255, 255, 255, .1); }
@media (max-width: 640px) {
  .bcd-ai-teaser { display: none; }
}

/* Eye-Catching Floating Orb */
.bcd-ai-fab {
  position: relative;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff3b93 0%, #e31c79 48%, #981052 100%);
  box-shadow:
    0 14px 34px rgba(227, 28, 121, .45),
    0 4px 14px rgba(0, 0, 0, .28),
    inset 0 1px 1px rgba(255, 255, 255, .38);
  transition: transform .24s cubic-bezier(.2, .9, .2, 1), box-shadow .24s ease;
}
.bcd-ai-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 18px 40px rgba(227, 28, 121, .56),
    0 6px 18px rgba(0, 0, 0, .32),
    inset 0 1px 1px rgba(255, 255, 255, .45);
}
.bcd-ai-fab:active { transform: scale(.96); }

.bcd-ai-fab-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(227, 28, 121, .55);
  animation: bcdAiPulse 2.6s ease-out infinite;
  pointer-events: none;
}
.bcd-ai.is-open .bcd-ai-fab-ring { animation: none; opacity: 0; }

.bcd-ai-fab-icon {
  position: absolute;
  display: grid;
  place-items: center;
  transition: transform .26s ease, opacity .2s ease;
}
.bcd-ai-fab-icon--close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.bcd-ai.is-open .bcd-ai-fab-icon--chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.bcd-ai.is-open .bcd-ai-fab-icon--close { opacity: 1; transform: none; }

.bcd-ai-fab-online {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid #16161a;
  box-shadow: 0 0 8px rgba(34, 197, 94, .8);
}

/* Chat Panel */
.bcd-ai-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(392px, calc(100vw - 24px));
  height: min(585px, calc(100dvh - 150px));
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(20, 21, 26, .1);
  box-shadow:
    0 28px 70px rgba(15, 16, 22, .32),
    0 6px 20px rgba(227, 28, 121, .16);
  transform-origin: bottom right;
  animation: bcdPanelIn .28s cubic-bezier(.18, .9, .22, 1) both;
}
.bcd-ai-panel[hidden] { display: none; }

@media (max-width: 560px) {
  .bcd-ai-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(var(--tabbar-h, 64px) + 80px + env(safe-area-inset-bottom));
    width: auto;
    height: min(520px, calc(100dvh - 180px));
    border-radius: 22px;
  }
}

/* Header */
.bcd-ai-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .95rem 1rem;
  color: #fff;
  background:
    radial-gradient(ellipse 80% 100% at 15% 0%, rgba(227, 28, 121, .42), transparent 65%),
    linear-gradient(135deg, #1b1820 0%, #121216 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.bcd-ai-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #ff4da6, #e31c79);
  box-shadow: 0 8px 18px rgba(227, 28, 121, .4);
}
.bcd-ai-head-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.bcd-ai-head-info strong {
  font-size: .96rem;
  font-weight: 800;
  letter-spacing: .01em;
}
.bcd-ai-head-info span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  color: rgba(255, 255, 255, .74);
}
.bcd-ai-head-info span i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}
.bcd-ai-head-actions {
  display: inline-flex;
  gap: 4px;
}
.bcd-ai-hbtn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .09);
  color: rgba(255, 255, 255, .88);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .16s ease;
}
.bcd-ai-hbtn:hover { background: rgba(227, 28, 121, .75); color: #fff; }

/* Messages Area */
.bcd-ai-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem .9rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  background: linear-gradient(180deg, #faf9fb 0%, #f4f5f8 100%);
  scroll-behavior: smooth;
}
.bcd-ai-msg {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  animation: bcdMsgIn .22s ease both;
}
.bcd-ai-msg--user { align-self: flex-end; align-items: flex-end; }
.bcd-ai-msg--bot { align-self: flex-start; align-items: flex-start; max-width: 94%; }

.bcd-ai-bubble {
  padding: .72rem .92rem;
  border-radius: 18px;
  font-size: .88rem;
  line-height: 1.48;
  word-wrap: break-word;
}
.bcd-ai-msg--user .bcd-ai-bubble {
  background: linear-gradient(135deg, #e31c79 0%, #c81568 100%);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 6px 16px rgba(227, 28, 121, .24);
}
.bcd-ai-msg--bot .bcd-ai-bubble {
  background: #fff;
  color: #1c1d22;
  border: 1px solid rgba(20, 21, 26, .08);
  border-bottom-left-radius: 5px;
  box-shadow: 0 3px 10px rgba(15, 16, 22, .05);
}
.bcd-ai-bubble strong { font-weight: 800; }

/* Vehicle Mini-Cards inside Chat */
.bcd-ai-cars {
  display: grid;
  gap: .48rem;
  width: 100%;
}
.bcd-ai-car {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: .65rem;
  align-items: center;
  padding: .45rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(20, 21, 26, .09);
  text-decoration: none;
  color: #18191f;
  box-shadow: 0 4px 12px rgba(15, 16, 22, .05);
  transition: transform .16s ease, border-color .16s ease;
}
.bcd-ai-car:hover {
  transform: translateY(-1px);
  border-color: rgba(227, 28, 121, .5);
}
.bcd-ai-car img {
  width: 78px;
  height: 58px;
  object-fit: cover;
  border-radius: 10px;
  background: #ececf0;
  display: block;
}
.bcd-ai-car-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.bcd-ai-car-title {
  font-size: .8rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bcd-ai-car-meta {
  font-size: .72rem;
  color: #646672;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bcd-ai-car-price {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  font-weight: 900;
  color: #e31c79;
}
.bcd-ai-car-save {
  font-size: .66rem;
  font-weight: 700;
  color: #0f766e;
  background: #e6f7f4;
  padding: 2px 6px;
  border-radius: 999px;
}

/* Action Pills */
.bcd-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.bcd-ai-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: .42rem .78rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  text-decoration: none;
  color: #e31c79;
  background: rgba(227, 28, 121, .09);
  border: 1px solid rgba(227, 28, 121, .22);
  transition: background .16s ease, color .16s ease;
}
.bcd-ai-action:hover { background: #e31c79; color: #fff; }

/* Quick Prompt Chips */
.bcd-ai-chips {
  display: flex;
  gap: .42rem;
  padding: .5rem .85rem .45rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fff;
  border-top: 1px solid rgba(20, 21, 26, .06);
}
.bcd-ai-chips::-webkit-scrollbar { display: none; }
.bcd-ai-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(227, 28, 121, .24);
  background: #fff5fa;
  color: #a61358;
  padding: .36rem .72rem;
  border-radius: 999px;
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.bcd-ai-chip:hover { background: #e31c79; color: #fff; border-color: #e31c79; }

/* Input Bar */
.bcd-ai-form {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem .75rem .75rem;
  background: #fff;
  border-top: 1px solid rgba(20, 21, 26, .07);
}
.bcd-ai-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(20, 21, 26, .14);
  border-radius: 999px;
  padding: .62rem .95rem;
  font: inherit;
  font-size: .88rem;
  color: #18191f;
  background: #f7f7f9;
  outline: none;
  transition: border-color .16s ease, background .16s ease;
}
.bcd-ai-input:focus {
  border-color: #e31c79;
  background: #fff;
}
.bcd-ai-send {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff3b93, #e31c79);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(227, 28, 121, .34);
  transition: transform .15s ease, opacity .15s ease;
}
.bcd-ai-send:hover { transform: scale(1.05); }
.bcd-ai-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Typing Dots */
.bcd-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: .75rem .95rem;
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  background: #fff;
  border: 1px solid rgba(20, 21, 26, .08);
}
.bcd-ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e31c79;
  animation: bcdDotBounce 1.1s infinite ease-in-out;
}
.bcd-ai-typing span:nth-child(2) { animation-delay: .16s; }
.bcd-ai-typing span:nth-child(3) { animation-delay: .32s; }

@keyframes bcdAiPulse {
  0% { transform: scale(1); opacity: .75; }
  75% { transform: scale(1.34); opacity: 0; }
  100% { transform: scale(1.34); opacity: 0; }
}
@keyframes bcdPanelIn {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to { opacity: 1; transform: none; }
}
@keyframes bcdTeaserIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes bcdMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes bcdDotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-4px); opacity: 1; }
}
