/* ==========================================================================
   VITALHUB - AI SOLAR ADVISOR CHATBOT WIDGET
   Ultra-modern Glassmorphic Interface with Interactive Lead Capture
   ========================================================================== */

/* Floating Launcher Container */
.vital-ai-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Outfit', 'Segoe UI', -apple-system, sans-serif;
}

/* Floating Launcher Button (WhatsApp Green with AI Badge) */
.vital-ai-launcher {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(37, 211, 102, 0.45);
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.vital-ai-launcher:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 0 16px 36px rgba(37, 211, 102, 0.65);
}

.vital-ai-launcher .launcher-icon {
  font-size: 2.1rem;
  color: #ffffff;
  transition: transform 0.3s ease;
}

.vital-ai-launcher.active .launcher-icon {
  display: none;
}

.vital-ai-launcher .launcher-close-icon {
  font-size: 1.6rem;
  color: #ffffff;
  display: none;
}

.vital-ai-launcher.active .launcher-close-icon {
  display: block;
}

/* AI Badge */
.vital-ai-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #00cec9;
  color: #070e1c;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  letter-spacing: 0.5px;
  line-height: 1.2;
}

/* Pulse Glow Ring */
.vital-ai-launcher::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(37, 211, 102, 0.5);
  animation: aiRingPulse 2.4s infinite;
  pointer-events: none;
}

@keyframes aiRingPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

/* Proactive Speech Teaser Bubble (Left of the button) */
.vital-ai-proactive-bubble {
  position: absolute;
  right: 76px;
  bottom: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 10px 16px 10px 14px;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1.5px solid rgba(37, 211, 102, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateX(18px) scale(0.92);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99998;
}

.vital-ai-proactive-bubble.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: all;
  animation: gentleFloat 4s ease-in-out infinite alternate;
}

@keyframes gentleFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

/* Speech Arrow pointing to WhatsApp button */
.vital-ai-proactive-bubble::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 14px;
  border-width: 7px 0 7px 9px;
  border-style: solid;
  border-color: transparent transparent transparent #ffffff;
  filter: drop-shadow(2px 0 1px rgba(0,0,0,0.06));
}

.proactive-bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.proactive-bubble-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.proactive-header-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.proactive-badge-tag {
  background: rgba(37, 211, 102, 0.15);
  color: #059669;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 9999px;
}

.proactive-title-txt {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
}

.proactive-msg-txt {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.proactive-close-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  color: #94a3b8;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  margin-left: 4px;
}

.proactive-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Tooltip */
.vital-ai-tooltip {
  position: absolute;
  right: 76px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: #070e1c;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  border: 1px solid rgba(0, 206, 201, 0.3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.vital-ai-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent #070e1c;
}

.vital-ai-launcher:hover .vital-ai-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Chatbox Window */
.vital-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #0a1122;
  border-radius: 20px;
  border: 1px solid rgba(0, 206, 201, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(0, 206, 201, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.94);
  pointer-events: none;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.vital-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.vital-chat-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #070e1c, #0f1c34);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vital-chat-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vital-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b894, #00cec9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #070e1c;
  font-size: 1.2rem;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 206, 201, 0.3);
}

.vital-chat-avatar .online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #25d366;
  border: 2px solid #070e1c;
}

.vital-chat-title-group h4 {
  margin: 0;
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vital-chat-title-group span {
  font-size: 0.72rem;
  color: #00cec9;
  font-weight: 500;
}

.vital-chat-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vital-chat-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Chat Messages Area */
.vital-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(circle at top right, rgba(0, 206, 201, 0.04), transparent 60%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.vital-chat-body::-webkit-scrollbar {
  width: 5px;
}
.vital-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

/* Message Rows */
.chat-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: chatMsgIn 0.25s ease forwards;
}

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

.chat-row.bot {
  align-self: flex-start;
  max-width: 88%;
}

.chat-row.user {
  align-self: flex-end;
  max-width: 82%;
  flex-direction: row-reverse;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.chat-row.bot .chat-bubble {
  background: #152238;
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.chat-row.user .chat-bubble {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #070e1c;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

/* Quick Action Option Pills */
.chat-options-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chat-opt-pill {
  background: rgba(0, 206, 201, 0.1);
  color: #00cec9;
  border: 1px solid rgba(0, 206, 201, 0.3);
  padding: 7px 13px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.chat-opt-pill:hover {
  background: #00cec9;
  color: #070e1c;
  border-color: #00cec9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 206, 201, 0.3);
}

/* In-Chat Interactive Lead Form */
.chat-lead-card {
  background: rgba(7, 14, 28, 0.7);
  border: 1px solid rgba(0, 206, 201, 0.3);
  border-radius: 14px;
  padding: 14px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-lead-card input, .chat-lead-card select {
  width: 100%;
  background: #0d192d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 9px 12px;
  color: #ffffff;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.chat-lead-card input:focus {
  border-color: #00cec9;
  box-shadow: 0 0 0 2px rgba(0, 206, 201, 0.2);
}

.chat-lead-submit-btn {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #070e1c;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.chat-lead-submit-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Typing Indicator Animation */
.vital-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #152238;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.vital-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00cec9;
  animation: typingBlink 1.4s infinite both;
}

.vital-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.vital-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Chat Footer / Input */
.vital-chat-footer {
  padding: 12px 16px;
  background: #070e1c;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.vital-chat-input {
  flex: 1;
  background: #152238;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 10px 16px;
  color: #ffffff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.vital-chat-input:focus {
  border-color: #00cec9;
}

.vital-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #070e1c;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
}

.vital-chat-send-btn:hover {
  transform: scale(1.06);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .vital-ai-widget-container {
    bottom: 18px;
    right: 16px;
  }
  /* Crucial: Prevent proactive speech bubble from blocking mobile screen content */
  .vital-ai-proactive-bubble {
    display: none !important;
  }
  .vital-ai-launcher {
    width: 52px;
    height: 52px;
    font-size: 1.7rem;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
  }
  .vital-chat-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 90px);
    max-height: 600px;
    bottom: 78px;
    right: 12px;
    border-radius: 20px;
  }
}

