/* ========================================
   CHATBOT — TrueCell (Luxe theme)
   ======================================== */

.chat-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  width: 56px;
  height: 56px;
  background: var(--luxe-ink, #2c1212);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  box-shadow: 0 8px 28px rgba(44, 18, 18, 0.18);
}

.chat-fab:hover {
  background: var(--luxe-burgundy, #682626);
  transform: translateY(-2px);
}

.chat-fab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--luxe-bone, #fdf9f6);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.chat-fab .chat-fab__close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.8);
}

.chat-fab.active .chat-fab__open {
  opacity: 0;
  transform: rotate(90deg) scale(0.8);
}

.chat-fab.active .chat-fab__close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* While the chat is open, hide the launcher so it can't overlap the Send
   button in the footer (both anchor to the same bottom-right corner).
   Closing is handled by the ✕ in the chat header. */
.chat-fab.active {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  pointer-events: none;
}

/* Chat window */
.chat-window {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 199;
  width: 400px;
  height: 580px;
  max-height: calc(100vh - 6rem);
  background: var(--luxe-bone, #fdf9f6);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(44, 18, 18, 0.18), 0 0 0 1px var(--luxe-line, rgba(44, 18, 18, 0.14));
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
  font-family: var(--luxe-sans, "Instrument Sans", sans-serif);
}

.chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat header */
.chat-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--luxe-line-soft, rgba(44, 18, 18, 0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--luxe-bone, #fdf9f6);
}

.chat-header__info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-header__avatar {
  width: 36px;
  height: 36px;
  background: var(--luxe-burgundy, #682626);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header__avatar svg {
  width: 18px;
  height: 18px;
  stroke: var(--luxe-bone, #fdf9f6);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-header__name {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--luxe-ink, #2c1212);
  line-height: 1.3;
  margin: 0;
}

.chat-header__status {
  font-size: 0.6875rem;
  color: var(--luxe-ink-muted, rgba(44, 18, 18, 0.55));
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin: 0;
}

.chat-header__status-dot {
  width: 6px;
  height: 6px;
  background: #5CA365;
  border-radius: 50%;
}

.chat-header__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--luxe-ink-muted, rgba(44, 18, 18, 0.55));
  transition: color 0.2s ease;
}

.chat-header__close:hover {
  color: var(--luxe-ink, #2c1212);
}

.chat-header__close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Chat body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--luxe-bone, #fdf9f6);
}

.chat-body::-webkit-scrollbar { width: 4px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb {
  background: var(--luxe-line, rgba(44, 18, 18, 0.14));
  border-radius: 2px;
}

/* Messages */
.chat-msg {
  display: flex;
  gap: 0.625rem;
  max-width: 88%;
  animation: msgIn 0.35s ease forwards;
}

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

.chat-msg--bot { align-self: flex-start; }
.chat-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg__avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  border-radius: 50%;
}

.chat-msg--bot .chat-msg__avatar {
  background: var(--luxe-bone-deep, #f0ece6);
}

.chat-msg--bot .chat-msg__avatar svg {
  width: 14px;
  height: 14px;
  stroke: var(--luxe-burgundy, #682626);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-msg__bubble {
  font-size: 0.875rem;
  line-height: 1.6;
  letter-spacing: 0.005em;
  font-family: var(--luxe-sans, "Instrument Sans", sans-serif);
}

.chat-msg__bubble strong { font-weight: 500; color: var(--luxe-ink, #2c1212); }

.chat-msg--bot .chat-msg__bubble {
  background: var(--luxe-bone-deep, #f0ece6);
  color: var(--luxe-ink-soft, rgba(44, 18, 18, 0.85));
  padding: 0.875rem 1.125rem;
  border-radius: 2px 12px 12px 12px;
}

.chat-msg--user .chat-msg__bubble {
  background: var(--luxe-ink, #2c1212);
  color: var(--luxe-bone, #fdf9f6);
  padding: 0.875rem 1.125rem;
  border-radius: 12px 2px 12px 12px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 0.625rem;
  align-self: flex-start;
  max-width: 88%;
}

.chat-typing__avatar {
  width: 28px;
  height: 28px;
  background: var(--luxe-bone-deep, #f0ece6);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-typing__avatar svg {
  width: 14px;
  height: 14px;
  stroke: var(--luxe-burgundy, #682626);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-typing__dots {
  background: var(--luxe-bone-deep, #f0ece6);
  padding: 0.875rem 1.125rem;
  border-radius: 2px 12px 12px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-typing__dot {
  width: 5px;
  height: 5px;
  background: var(--luxe-ink-muted, rgba(44, 18, 18, 0.55));
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.chat-typing__dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Quick replies */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0.25rem;
  animation: msgIn 0.35s ease forwards;
}

.chat-quick-reply {
  font-family: var(--luxe-sans, "Instrument Sans", sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--luxe-burgundy, #682626);
  background: var(--luxe-bone, #fdf9f6);
  border: 1px solid var(--luxe-burgundy, #682626);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.3;
}

.chat-quick-reply:hover {
  background: var(--luxe-burgundy, #682626);
  color: var(--luxe-bone, #fdf9f6);
}

/* Chat footer / input */
.chat-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--luxe-line-soft, rgba(44, 18, 18, 0.08));
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  background: var(--luxe-bone, #fdf9f6);
}

.chat-input {
  flex: 1;
  font-family: var(--luxe-sans, "Instrument Sans", sans-serif);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--luxe-ink, #2c1212);
  border: none;
  outline: none;
  background: none;
  padding: 0.375rem 0;
  line-height: 1.5;
}

.chat-input::placeholder {
  color: var(--luxe-ink-muted, rgba(44, 18, 18, 0.55));
}

.chat-send {
  width: 36px;
  height: 36px;
  background: var(--luxe-ink, #2c1212);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  opacity: 0.3;
}

.chat-send.has-text { opacity: 1; }
.chat-send:hover { background: var(--luxe-burgundy, #682626); }

.chat-send svg {
  width: 16px;
  height: 16px;
  stroke: var(--luxe-bone, #fdf9f6);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Chat timestamp */
.chat-timestamp {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--luxe-ink-muted, rgba(44, 18, 18, 0.55));
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.5rem 0;
}

/* Chat powered */
.chat-powered {
  text-align: center;
  font-size: 0.625rem;
  color: var(--luxe-ink-muted, rgba(44, 18, 18, 0.55));
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.5rem 1.5rem 0.75rem;
  border-top: 1px solid var(--luxe-line-soft, rgba(44, 18, 18, 0.08));
  background: var(--luxe-bone, #fdf9f6);
}

@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - 1.5rem);
    height: calc(100vh - 5rem);
    max-height: calc(100vh - 5rem);
    bottom: 0.75rem;
    right: 0.75rem;
  }
  .chat-fab {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 50px;
    height: 50px;
  }
}

/* ============================================================
 * Brand re-skin (2026): map the chatbot's legacy luxe palette
 * to the gold/mineral brand. Loaded last, so these win.
 * Gold is reserved for small accents; surfaces stay mineral/bone.
 * ============================================================ */
.chat-fab,
.chat-window {
  --luxe-ink: #1E211E;
  --luxe-ink-soft: rgba(30, 33, 30, 0.85);
  --luxe-ink-muted: rgba(30, 33, 30, 0.55);
  --luxe-bone: #F4F1E9;
  --luxe-bone-deep: #ECE7DC;
  --luxe-line: rgba(30, 33, 30, 0.14);
  --luxe-line-soft: rgba(30, 33, 30, 0.08);
  --luxe-burgundy: #E0A437;   /* accent -> mango gold */
  --luxe-sans: 'Poppins', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
/* keep gold to accents only — surfaces stay mineral so light icons read */
.chat-fab:hover { background: #2C302B; }
.chat-header__avatar { background: #1E211E; }
.chat-header__avatar svg { stroke: #E0A437; }
.chat-quick-reply { color: #1E211E; border-color: #E0A437; }
.chat-quick-reply:hover { background: #E0A437; color: #1E211E; }
.chat-send:hover { background: #2C302B; }

/* Gold chat button (dark icon for contrast, like the site's gold CTAs) */
.chat-fab { background: #E0A437; }
.chat-fab:hover { background: #C68C29; }
.chat-fab svg { stroke: #1E211E; }

/* ===== AI lead-capture confirm card ===== */
.chat-lead-card {
  align-self: stretch;
  margin: 0.25rem 0 0.25rem 2.375rem;
  background: #fff;
  border: 1px solid var(--luxe-line, #e6ddd4);
  border-left: 3px solid #E0A437;
  border-radius: 12px;
  padding: 0.95rem 1.05rem;
  font-family: var(--luxe-sans, "Instrument Sans", sans-serif);
  box-shadow: 0 6px 20px rgba(30, 33, 30, 0.06);
}
.chat-lead-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--luxe-ink, #1E211E);
  margin-bottom: 0.7rem;
}
.chat-lead-card__rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
}
.chat-lead-card__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.35;
}
.chat-lead-card__row span { color: rgba(30, 33, 30, 0.55); }
.chat-lead-card__row strong { color: var(--luxe-ink, #1E211E); font-weight: 500; text-align: right; }
.chat-lead-card__consent {
  font-size: 0.68rem;
  line-height: 1.45;
  color: rgba(30, 33, 30, 0.5);
  margin-bottom: 0.8rem;
}
.chat-lead-card__consent a { color: #B4832A; text-decoration: underline; text-underline-offset: 2px; }
.chat-lead-card__actions { display: flex; gap: 0.5rem; }
.chat-lead-send,
.chat-lead-skip {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.chat-lead-send { background: #E0A437; color: #1E211E; }
.chat-lead-send:hover { background: #C68C29; }
.chat-lead-send:disabled { opacity: 0.6; cursor: default; }
.chat-lead-skip { background: transparent; color: rgba(30, 33, 30, 0.6); border-color: var(--luxe-line, #e6ddd4); }
.chat-lead-skip:hover { color: #1E211E; border-color: #1E211E; }
.chat-lead-card__done {
  font-size: 0.82rem;
  color: var(--luxe-ink, #1E211E);
  font-weight: 500;
}
.chat-lead-card__err {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #a3341f;
}
