:root {
  --lookupit-bg: #ffffff;
  --lookupit-surface: rgba(255, 255, 255, 0.98);
  --lookupit-surface-strong: #ffffff;
  --lookupit-ink: #4b0f18;
  --lookupit-muted: #8d5a64;
  --lookupit-line: #f3c9d0;
  --lookupit-coral: #c42f3e;
  --lookupit-coral-deep: #b51f34;
  --lookupit-coral-soft: #fff1f3;
  --lookupit-shadow: 0 18px 44px rgba(181, 31, 52, 0.18);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--lookupit-ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(217, 58, 73, 0.1), transparent 24%),
    radial-gradient(circle at 88% 14%, rgba(181, 31, 52, 0.08), transparent 20%),
    linear-gradient(180deg, #ffffff 0%, #fff7f8 100%);
}

#chat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  font-family: inherit;
}

#chat-toggle {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.28), transparent 28%),
    linear-gradient(145deg, #ef5b69 0%, var(--lookupit-coral) 52%, var(--lookupit-coral-deep) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(219, 63, 70, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

#chat-toggle:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 28px rgba(219, 63, 70, 0.3);
}

#chat-toggle::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 11px;
}

#chat-toggle svg,
#chat-toggle img {
  position: relative;
  z-index: 1;
}

#chat-toggle svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

#chat-toggle img {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: contain;
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--lookupit-coral-deep);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  z-index: 2;
}

#chat-window {
  position: absolute;
  right: 0;
  bottom: 58px;
  width: 308px;
  max-height: min(500px, calc(100vh - 88px));
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 250, 251, 0.98) 0%, rgba(255, 255, 255, 0.99) 100%);
  border: 1px solid rgba(217, 58, 73, 0.18);
  box-shadow: var(--lookupit-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(18px);
}

#chat-window::before {
  content: "";
  position: absolute;
  top: -18px;
  right: -16px;
  width: 128px;
  height: 128px;
  background:
    radial-gradient(circle, rgba(217, 58, 73, 0.12) 0 22%, transparent 23% 100%);
  background-size: 18px 18px;
  opacity: 0.8;
  pointer-events: none;
}

#chat-window::after {
  content: "";
  position: absolute;
  left: -36px;
  top: 92px;
  width: 104px;
  height: 104px;
  border: 10px solid rgba(217, 58, 73, 0.22);
  border-right-color: transparent;
  border-top-color: transparent;
  border-radius: 999px;
  transform: rotate(20deg);
  pointer-events: none;
  opacity: 0.28;
}

#chat-window.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.96);
}

#chat-conversation.hidden,
#chat-lead-gate.hidden,
.lead-form-message.hidden {
  display: none !important;
}

#chat-conversation {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-header {
  position: relative;
  padding: 12px 13px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(217, 58, 73, 0.16);
  background: linear-gradient(180deg, rgba(255, 243, 245, 0.94) 0%, rgba(255, 255, 255, 0.94) 100%);
  z-index: 1;
}

.chat-header-info {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(217, 58, 73, 0.16);
  box-shadow: 0 6px 14px rgba(219, 63, 70, 0.12);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.chat-name {
  font-size: 13px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--lookupit-ink);
}

.chat-status {
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--lookupit-coral-soft);
  color: var(--lookupit-coral-deep);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lookupit-coral);
  box-shadow: 0 0 0 4px rgba(219, 63, 70, 0.14);
}

#chat-close-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(217, 58, 73, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--lookupit-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 8px rgba(181, 31, 52, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease;
}

#chat-close-btn:hover {
  transform: translateY(-1px);
  color: var(--lookupit-coral);
  border-color: rgba(219, 63, 70, 0.24);
}

#chat-lead-gate {
  flex: 1;
  min-height: 0;
  padding: 12px 11px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#chat-lead-gate::-webkit-scrollbar {
  width: 6px;
}

#chat-lead-gate::-webkit-scrollbar-thumb {
  background: #efc5cc;
  border-radius: 999px;
}

.lead-card {
  position: relative;
  padding: 16px 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(217, 58, 73, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 244, 246, 0.98) 100%);
  box-shadow: 0 18px 28px rgba(181, 31, 52, 0.06);
}

.lead-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--lookupit-coral-soft);
  color: var(--lookupit-coral-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lead-title {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 800;
  color: var(--lookupit-ink);
}

.lead-copy {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--lookupit-muted);
}

.lead-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lead-field span {
  font-size: 11px;
  font-weight: 800;
  color: var(--lookupit-ink);
}

.lead-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--lookupit-line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--lookupit-ink);
  font: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.lead-field input:focus {
  border-color: rgba(219, 63, 70, 0.36);
  box-shadow: 0 0 0 2px rgba(219, 63, 70, 0.08);
}

.lead-field input::placeholder {
  color: #b07a84;
}

.lead-form-message {
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff0f2;
  color: var(--lookupit-coral-deep);
  font-size: 11px;
  line-height: 1.4;
  border: 1px solid rgba(217, 58, 73, 0.14);
}

.lead-submit-btn {
  height: 40px;
  border: 0;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.28), transparent 28%),
    linear-gradient(145deg, #ef5b69 0%, var(--lookupit-coral) 58%, var(--lookupit-coral-deep) 100%);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(219, 63, 70, 0.24);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.lead-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(219, 63, 70, 0.28);
}

.lead-submit-btn:disabled {
  cursor: not-allowed;
  background: #efc5cc;
  box-shadow: none;
}

#chat-messages {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 11px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #efc5cc;
  border-radius: 999px;
}

.msg {
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: lookupitFadeSlide 220ms ease;
}

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

.msg.user {
  align-self: flex-end;
}

.msg.bot {
  align-self: flex-start;
}

.msg-bubble {
  position: relative;
  padding: 9px 11px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}

.msg.user .msg-bubble {
  background: linear-gradient(135deg, #ef5b69 0%, var(--lookupit-coral) 60%, var(--lookupit-coral-deep) 100%);
  color: #fff;
  border-bottom-right-radius: 10px;
  box-shadow: 0 18px 28px rgba(219, 63, 70, 0.2);
}

.msg.bot .msg-bubble {
  background: var(--lookupit-surface-strong);
  color: var(--lookupit-ink);
  border: 1px solid rgba(217, 58, 73, 0.16);
  border-bottom-left-radius: 10px;
  box-shadow: 0 18px 28px rgba(181, 31, 52, 0.06);
}

.msg.bot .msg-bubble strong {
  color: var(--lookupit-coral-deep);
  font-weight: 800;
}

.msg.bot .msg-bubble ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.msg.bot .msg-bubble li {
  margin-bottom: 4px;
}

.msg.bot .msg-bubble p + p {
  margin-top: 7px;
}

.msg-time {
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--lookupit-muted);
}

.msg.user .msg-time {
  text-align: right;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.quick-reply {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(217, 58, 73, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #fff4f6 100%);
  color: var(--lookupit-ink);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(181, 31, 52, 0.06);
  transition: transform 150ms ease, border-color 150ms ease, color 150ms ease;
}

.quick-reply:hover {
  transform: translateY(-1px);
  border-color: rgba(219, 63, 70, 0.28);
  color: var(--lookupit-coral-deep);
}

#typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 13px 8px;
}

#typing-indicator.hidden {
  display: none;
}

#typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(219, 63, 70, 0.42);
  animation: lookupitBounce 1s infinite ease-in-out;
}

#typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

#typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes lookupitBounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-5px);
  }
}

.chat-input-area {
  padding: 8px 10px 10px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  border-top: 1px solid rgba(217, 58, 73, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 245, 247, 0.98) 100%);
}

#chat-input {
  flex: 1;
  min-height: 38px;
  max-height: 84px;
  padding: 9px 11px;
  border-radius: 14px;
  border: 1px solid var(--lookupit-line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--lookupit-ink);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.5;
  outline: none;
  resize: none;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#chat-input:focus {
  border-color: rgba(219, 63, 70, 0.36);
  box-shadow: 0 0 0 2px rgba(219, 63, 70, 0.08);
}

#chat-input::placeholder {
  color: #b07a84;
}

#send-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.28), transparent 28%),
    linear-gradient(145deg, #ef5b69 0%, var(--lookupit-coral) 58%, var(--lookupit-coral-deep) 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 16px rgba(219, 63, 70, 0.24);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

#send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(219, 63, 70, 0.28);
}

#send-btn:disabled {
  cursor: not-allowed;
  background: #efc5cc;
  box-shadow: none;
}

#send-btn svg {
  width: 15px;
  height: 15px;
  color: #fff;
}

@media (max-width: 640px) {
  #chat-widget {
    right: 10px;
    bottom: 10px;
  }

  #chat-window {
    width: min(calc(100vw - 16px), 294px);
    right: 0;
    bottom: 60px;
    max-height: min(440px, calc(100vh - 84px));
    border-radius: 20px;
  }
}
/* ── Toggle button: pulse + float + ripple ring ── */
@keyframes chatbotPulse {
  0%   { box-shadow: 0 12px 24px rgba(219,63,70,0.26), 0 0 0 0   rgba(219,63,70,0.55); }
  70%  { box-shadow: 0 12px 24px rgba(219,63,70,0.26), 0 0 0 14px rgba(219,63,70,0);   }
  100% { box-shadow: 0 12px 24px rgba(219,63,70,0.26), 0 0 0 0   rgba(219,63,70,0);   }
}

@keyframes chatbotFloat {
  0%, 100% { transform: translateY(0px);  }
  50%       { transform: translateY(-5px); }
}

@keyframes chatbotRing {
  0%   { transform: scale(1);   opacity: 0.65; }
  100% { transform: scale(2.4); opacity: 0;    }
}

#chat-toggle {
  animation: chatbotPulse 2s ease-in-out infinite, chatbotFloat 3.2s ease-in-out infinite;
}

#chat-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 2.5px solid rgba(219, 63, 70, 0.55);
  animation: chatbotRing 2s ease-out infinite;
  pointer-events: none;
}

#chat-toggle:hover {
  transform: translateY(-3px) scale(1.07);
  box-shadow: 0 18px 32px rgba(219, 63, 70, 0.38);
  animation: none;
}

/* ── Avatar: glowing pulse ── */
@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 6px 14px rgba(219,63,70,0.22); }
  50%       { box-shadow: 0 6px 22px rgba(219,63,70,0.52), 0 0 0 5px rgba(219,63,70,0.10); }
}

.avatar {
  animation: avatarGlow 2.6s ease-in-out infinite;
}

/* ── Status dot: blink ── */
@keyframes dotBlink {
  0%, 100% { opacity: 1;   box-shadow: 0 0 0 3px rgba(196,47,62,0.28); }
  50%       { opacity: 0.4; box-shadow: 0 0 0 6px rgba(196,47,62,0.08); }
}

.dot {
  animation: dotBlink 1.4s ease-in-out infinite;
}

/* ── Bot bubble: glow-in on appear ── */
@keyframes botBubbleHighlight {
  0%   { box-shadow: 0 0 0 3px rgba(196,47,62,0.32), 0 18px 28px rgba(181,31,52,0.06); }
  60%  { box-shadow: 0 0 0 2px rgba(196,47,62,0.14), 0 18px 28px rgba(181,31,52,0.06); }
  100% { box-shadow: 0 0 0 0px rgba(196,47,62,0),    0 18px 28px rgba(181,31,52,0.06); }
}

.msg.bot .msg-bubble {
  animation: botBubbleHighlight 1.2s ease forwards;
}

/* ── Quick replies: shimmer sweep ── */
@keyframes shimmerSweep {
  0%   { background-position: -220% center; }
  100% { background-position: 220% center;  }
}

.quick-reply {
  background: linear-gradient(
    105deg,
    #ffffff        38%,
    rgba(196,47,62,0.10) 50%,
    #fff4f6        62%
  );
  background-size: 220% auto;
  animation: shimmerSweep 2.8s linear infinite;
}

.quick-reply:hover {
  animation: none;
  background: linear-gradient(180deg, #fff4f6 0%, #ffe8ec 100%);
  transform: translateY(-2px);
  border-color: rgba(219, 63, 70, 0.38);
  color: var(--lookupit-coral-deep);
}

/* ── Badge: pop pulse ── */
@keyframes badgePop {
  0%, 100% { transform: scale(1);    }
  50%       { transform: scale(1.18); }
}

.badge {
  animation: badgePop 1.1s ease-in-out infinite;
}
