/*--------------------------------------------------------------
# AdRevit Chatbot
--------------------------------------------------------------*/
.adrevit-chatbot {
  --chat-brand: var(--accent-color, #0755b8);
  --chat-navy: var(--heading-color, #071a35);
  position: relative;
  z-index: 99999;
}

.chatbot-launcher {
  position: fixed;
  right: 22px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--chat-brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--chat-brand), transparent 45%),
    0 0 0 0 color-mix(in srgb, var(--chat-brand), transparent 55%);
  cursor: pointer;
  transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
  animation: chatbot-pulse 2.6s ease-out infinite;
  z-index: 100000;
}

.chatbot-launcher:hover {
  background: color-mix(in srgb, var(--chat-brand), #000 12%);
  transform: translateY(-3px) scale(1.04);
  animation: none;
}

.chatbot-launcher i {
  font-size: 26px;
  line-height: 1;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chatbot-launcher .chatbot-launcher-close {
  opacity: 0;
  transform: scale(0.6) rotate(-40deg);
}

.adrevit-chatbot.is-open .chatbot-launcher .chatbot-launcher-icon {
  opacity: 0;
  transform: scale(0.6) rotate(40deg);
}

.adrevit-chatbot.is-open .chatbot-launcher .chatbot-launcher-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.chatbot-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

@keyframes chatbot-pulse {
  0% {
    box-shadow:
      0 10px 28px color-mix(in srgb, var(--chat-brand), transparent 45%),
      0 0 0 0 color-mix(in srgb, var(--chat-brand), transparent 55%);
  }

  70% {
    box-shadow:
      0 10px 28px color-mix(in srgb, var(--chat-brand), transparent 45%),
      0 0 0 14px transparent;
  }

  100% {
    box-shadow:
      0 10px 28px color-mix(in srgb, var(--chat-brand), transparent 45%),
      0 0 0 0 transparent;
  }
}

.chatbot-panel {
  position: fixed;
  right: 22px;
  bottom: 98px;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 130px));
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(7, 26, 53, 0.22);
  border: 1px solid color-mix(in srgb, var(--chat-brand), transparent 85%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100000;
}

.adrevit-chatbot.is-open .chatbot-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chatbot-header {
  background: linear-gradient(135deg, var(--chat-navy), var(--chat-brand));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chatbot-header-info strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.chatbot-header-info span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.chatbot-header-info span i {
  font-size: 8px;
  color: #4ade80;
}

.chatbot-restart {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chatbot-restart:hover {
  background: rgba(255, 255, 255, 0.24);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f8fc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-row {
  display: flex;
  max-width: 92%;
}

.chat-row.bot {
  align-self: flex-start;
}

.chat-row.user {
  align-self: flex-end;
  justify-content: flex-end;
}

.chat-row.system {
  align-self: center;
  max-width: 100%;
  font-size: 11px;
  color: #64748b;
  background: #e8eef7;
  padding: 4px 10px;
  border-radius: 999px;
}

.chat-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-row.bot .chat-bubble {
  background: #fff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 14px rgba(7, 26, 53, 0.06);
}

.chat-row.user .chat-bubble {
  background: var(--chat-brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 52px;
  justify-content: center;
}

.chat-bubble.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: chatbot-dot 1.2s infinite ease-in-out;
}

.chat-bubble.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-bubble.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatbot-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
  background: #f5f8fc;
}

.chatbot-chip {
  border: 1px solid color-mix(in srgb, var(--chat-brand), transparent 70%);
  background: #fff;
  color: var(--chat-brand);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.chatbot-chip:hover {
  background: var(--chat-brand);
  color: #fff;
}

.chatbot-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  position: relative;
}

.chatbot-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  background: #f8fafc;
}

.chatbot-input:focus {
  border-color: var(--chat-brand);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-brand), transparent 85%);
}

.chatbot-input:disabled {
  opacity: 0.7;
}

.chatbot-send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--chat-brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chatbot-send:disabled {
  opacity: 0.55;
}

.chatbot-send:not(:disabled):hover {
  background: color-mix(in srgb, var(--chat-brand), #000 12%);
}

/* Keep scroll-top above the launcher */
.scroll-top {
  right: 22px;
  bottom: 96px;
}

@media (max-width: 575.98px) {
  .chatbot-launcher {
    right: 16px;
    bottom: 18px;
    width: 56px;
    height: 56px;
  }

  .chatbot-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 84px;
    height: min(70vh, 560px);
  }

  .scroll-top {
    right: 16px;
    bottom: 86px;
  }
}
