/* =========================================================
   FLOATING WIDGETS · WhatsApp (right) + AI Chatbot (left)
   ========================================================= */

.wa-fab {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  background: #25D366;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 998;
  border: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
  animation: wa-pulse 2.5s ease-in-out infinite;
}

.wa-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(37, 211, 102, 0.55);
}

@keyframes wa-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4), 0 0 0 0 rgba(37, 211, 102, 0.6); }
  50%      { box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4), 0 0 0 14px rgba(37, 211, 102, 0); }
}

.wa-fab svg { width: 32px; height: 32px; fill: white; }

.wa-tooltip {
  position: absolute;
  left: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: #0e0e10;
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  font-family: 'Inter', sans-serif;
}

.wa-tooltip::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #0e0e10;
  border-left: 0;
}

.wa-fab:hover .wa-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(4px);
}

/* Chatbot Button - RIGHT */
.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #6e56ff, #ff4d8d);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(110, 86, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 998;
  border: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(110, 86, 255, 0.6);
}

.chat-fab-icon { width: 28px; height: 28px; color: white; position: relative; }

.chat-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #c6f432;
  border-radius: 50%;
  border: 2px solid white;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.2); }
}

/* Greeting bubble - appears to left of chat fab (which is now on right) */
.chat-greet {
  position: fixed;
  right: 100px;
  bottom: 36px;
  background: white;
  border: 1px solid #e5e3da;
  padding: 14px 28px 14px 16px;
  border-radius: 18px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 12px 32px rgba(15, 15, 20, 0.12);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #0e0e10;
  max-width: 260px;
  line-height: 1.45;
  z-index: 997;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  cursor: pointer;
}

.chat-greet.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.chat-greet-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  font-size: 16px;
  color: #9a9aa3;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}

.chat-greet-close:hover { color: #0e0e10; }
.chat-greet strong { color: #6e56ff; font-weight: 600; }

/* Chat Window - RIGHT side */
.chat-window {
  position: fixed;
  right: 24px;
  bottom: 100px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 580px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 15, 20, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}

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

.chat-header {
  background: #0e0e10;
  color: white;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c6f432, #4ec3ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 18px;
  color: #0e0e10;
  position: relative;
}

.chat-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #28c840;
  border: 2px solid #0e0e10;
  border-radius: 50%;
}

.chat-header-info { flex: 1; min-width: 0; }
.chat-header-title { font-weight: 600; font-size: 15px; font-family: 'Inter', sans-serif; }
.chat-header-status { font-size: 11px; color: rgba(255, 255, 255, 0.6); font-family: 'JetBrains Mono', monospace; }

.chat-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-close:hover { background: rgba(255, 255, 255, 0.2); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafaf7;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: #d4d1c4; border-radius: 3px; }

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
  animation: msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  word-wrap: break-word;
}

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

.chat-msg.bot {
  background: white;
  border: 1px solid #e5e3da;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  color: #0e0e10;
}

.chat-msg.user {
  background: linear-gradient(135deg, #6e56ff, #ff4d8d);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg a { color: inherit; text-decoration: underline; font-weight: 500; }
.chat-msg.user a { color: white; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chat-suggestion {
  background: white;
  border: 1px solid #e5e3da;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  color: #0e0e10;
  transition: all 0.2s;
  font-weight: 500;
}

.chat-suggestion:hover {
  background: #0e0e10;
  color: #c6f432;
  border-color: #0e0e10;
}

.chat-suggestion.primary {
  background: #c6f432;
  border-color: #c6f432;
  font-weight: 600;
}

.chat-suggestion.primary:hover {
  background: #0e0e10;
  color: #c6f432;
}

.chat-typing {
  align-self: flex-start;
  background: white;
  border: 1px solid #e5e3da;
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b6b73;
  animation: typing-bounce 1.2s infinite;
}

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

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

.chat-input-wrap {
  padding: 14px 16px;
  background: white;
  border-top: 1px solid #e5e3da;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1px solid #e5e3da;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  background: #fafaf7;
  color: #0e0e10;
}

.chat-input:focus { border-color: #6e56ff; background: white; }

.chat-send {
  background: #0e0e10;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

.chat-send:hover { background: #6e56ff; transform: scale(1.05); }

.chat-footer {
  padding: 8px 16px;
  font-size: 10px;
  color: #9a9aa3;
  text-align: center;
  background: white;
  border-top: 1px solid #e5e3da;
  font-family: 'JetBrains Mono', monospace;
}

/* Lead summary card */
.chat-summary {
  background: linear-gradient(135deg, #f3f0ff, #ffe8f1);
  border: 1px solid #d4cfff;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 13px;
  align-self: stretch;
  margin: 4px 0;
}

.chat-summary-title {
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-summary-row {
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.chat-summary-row span:first-child {
  color: #6b6b73;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-summary-row span:last-child {
  text-align: right;
  font-weight: 500;
  color: #0e0e10;
  max-width: 60%;
  word-wrap: break-word;
}

@media (max-width: 480px) {
  .wa-fab { left: 16px; bottom: 20px; width: 54px; height: 54px; }
  .wa-fab svg { width: 28px; height: 28px; }
  .chat-fab { right: 16px; bottom: 20px; width: 56px; height: 56px; }
  .chat-window {
    left: 16px; right: 16px; bottom: 90px;
    width: auto;
    height: calc(100vh - 110px);
    max-height: 620px;
  }
  .wa-tooltip { display: none; }
  .chat-greet { right: 16px; left: 80px; bottom: 90px; max-width: none; }
}
