/* =============================================================
   BC HOME SERVICE — AI CHATBOT + WHATSAPP FLOATING WIDGETS
   100% Offline rule-based AI assistant + WhatsApp contact
   ============================================================= */

/* ---------- Floating Buttons Container ---------- */
.floating-widgets {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 24px;
}

/* ---------- WhatsApp Float (Bottom-Left) ---------- */
.whatsapp-float {
  pointer-events: auto;
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 60px;
  height: 60px;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #25D366;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5), 0 0 0 0 rgba(37, 211, 102, 0.7);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: whatsappPulse 2s infinite;
  text-decoration: none;
}
.whatsapp-float:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}
.whatsapp-float svg {
  width: 34px;
  height: 34px;
  fill: #fff;
}
.whatsapp-float .wa-tooltip {
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%) translateX(-10px);
  background: #075E54;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  font-family: 'Inter', system-ui, sans-serif;
}
.whatsapp-float .wa-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #075E54;
}
.whatsapp-float:hover .wa-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@keyframes whatsappPulse {
  0% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5), 0 0 0 0 rgba(37, 211, 102, 0.7); }
  70% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5), 0 0 0 16px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5), 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* ---------- AI Chatbot Float (Bottom-Right) ---------- */
.ai-chat-float {
  pointer-events: auto;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  z-index: 9999;
  border-radius: 50%;
  background: linear-gradient(135deg, #2E86DE 0%, #00B4D8 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(46, 134, 222, 0.5), 0 0 0 0 rgba(46, 134, 222, 0.7);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: aiPulse 2.5s infinite;
}
.ai-chat-float:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 30px rgba(46, 134, 222, 0.6);
}
.ai-chat-float svg {
  width: 30px;
  height: 30px;
  fill: #fff;
  transition: transform 0.3s;
}
.ai-chat-float.active svg {
  transform: rotate(90deg);
}
.ai-chat-float .ai-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #FF6B35;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #fff;
  animation: badgeBob 1.5s infinite;
}
.ai-chat-float .ai-tooltip {
  position: absolute;
  right: 74px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: linear-gradient(135deg, #2E86DE, #00B4D8);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  font-family: 'Inter', system-ui, sans-serif;
}
.ai-chat-float .ai-tooltip::before {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #00B4D8;
}
.ai-chat-float:hover .ai-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@keyframes aiPulse {
  0% { box-shadow: 0 6px 24px rgba(46, 134, 222, 0.5), 0 0 0 0 rgba(46, 134, 222, 0.7); }
  70% { box-shadow: 0 6px 24px rgba(46, 134, 222, 0.5), 0 0 0 18px rgba(46, 134, 222, 0); }
  100% { box-shadow: 0 6px 24px rgba(46, 134, 222, 0.5), 0 0 0 0 rgba(46, 134, 222, 0); }
}
@keyframes badgeBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* ---------- Chatbot Window ---------- */
.ai-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(10, 22, 40, 0.3), 0 0 0 1px rgba(10, 22, 40, 0.05);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Inter', system-ui, sans-serif;
}
.ai-chat-window.open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Header */
.ai-chat-header {
  background: linear-gradient(135deg, #0a1628 0%, #1e3a5f 60%, #2e86de 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.ai-chat-header .ai-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00B4D8, #48CAE4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.ai-chat-header .ai-avatar svg { width: 24px; height: 24px; fill: #fff; }
.ai-chat-header .ai-avatar::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #2ecc71;
  border: 2px solid #0a1628;
  border-radius: 50%;
  animation: greenPulse 1.5s infinite;
}
.ai-chat-header .ai-info { flex: 1; }
.ai-chat-header .ai-name { font-weight: 800; font-size: 1rem; }
.ai-chat-header .ai-status { font-size: 0.75rem; color: #48CAE4; display: flex; align-items: center; gap: 4px; }
.ai-chat-header .ai-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ai-chat-header .ai-close:hover { background: rgba(255,255,255,0.2); }
.ai-chat-header .ai-close svg { width: 18px; height: 18px; fill: #fff; }

/* Messages area */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.ai-chat-messages::-webkit-scrollbar { width: 6px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }

.ai-msg {
  max-width: 80%;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: msgSlideIn 0.3s ease;
  word-wrap: break-word;
}
.ai-msg.bot {
  background: #fff;
  color: #1a1a2e;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(10,22,40,0.08);
  align-self: flex-start;
}
.ai-msg.user {
  background: linear-gradient(135deg, #2E86DE, #00B4D8);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  margin-left: auto;
}
.ai-msg.typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}
.ai-msg.typing span {
  width: 8px;
  height: 8px;
  background: #718096;
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}
.ai-msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-msg.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Quick reply chips */
.ai-quick-replies {
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
.ai-quick-reply {
  background: #EBF4FF;
  color: #2E86DE;
  border: 1px solid rgba(46,134,222,0.2);
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.ai-quick-reply:hover {
  background: #2E86DE;
  color: #fff;
  transform: translateY(-1px);
}

/* Input area */
.ai-chat-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-chat-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 100px;
  padding: 10px 16px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.ai-chat-input:focus { border-color: #2E86DE; }
.ai-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2E86DE, #00B4D8);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ai-chat-send:hover { transform: scale(1.1); }
.ai-chat-send svg { width: 18px; height: 18px; fill: #fff; }

/* Welcome card */
.ai-welcome-card {
  background: linear-gradient(135deg, #EBF4FF, #E0F7FA);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  text-align: center;
}
.ai-welcome-card h4 {
  color: #2E86DE;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.ai-welcome-card p {
  color: #4a5568;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* Service card in chat */
.ai-service-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  margin: 8px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}
.ai-service-card:hover {
  border-color: #2E86DE;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(46,134,222,0.1);
}
.ai-service-card .asc-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-service-card .asc-info { flex: 1; }
.ai-service-card .asc-name { font-weight: 700; font-size: 0.88rem; color: #1a1a2e; }
.ai-service-card .asc-desc { font-size: 0.78rem; color: #718096; }

/* Mobile responsive */
@media (max-width: 480px) {
  .ai-chat-window {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .whatsapp-float, .ai-chat-float {
    width: 54px;
    height: 54px;
  }
  .whatsapp-float svg { width: 30px; height: 30px; }
  .ai-chat-float svg { width: 26px; height: 26px; }
}
