/**
 * ISCE Floating Chatbot + WhatsApp Icon — Styles
 * 
 * INTEGRATION:
 * Add this to your existing CSS or link as a separate stylesheet:
 *   <link rel="stylesheet" href="isce-chat.css">
 */

/* ══════════════════════════════════════════════════════════════════════════
   FLOATING CHATBOT STYLES
   ══════════════════════════════════════════════════════════════════════════ */

/* Chat FAB (Floating Action Button) */
.isce-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af 0%, #0d9488 100%);
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px -4px rgba(30, 64, 175, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  transition: all 0.3s ease;
  outline: none;
}
.isce-chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 40px -4px rgba(30, 64, 175, 0.7);
}
.isce-chat-fab.hidden { transform: scale(0); opacity: 0; pointer-events: none; }
.isce-chat-fab .online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 16px;
  height: 16px;
  background: #34d399;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 8px #6ee7b7;
}
.isce-chat-fab .ping-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af, #fbbf24);
  animation: isce-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
  opacity: 0.2;
}
@keyframes isce-ping {
  75%, 100% { transform: scale(1.4); opacity: 0; }
}

/* Chat Window */
.isce-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 99999;
  width: min(390px, calc(100vw - 32px));
  height: min(540px, calc(100vh - 150px));
  border-radius: 2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 3px solid #93c5fd;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  background: linear-gradient(180deg, #fefce8 0%, #f0fdf4 100%);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}
.isce-chat-window.hidden {
  opacity: 0;
  transform: translateY(16px) scale(0.75);
  pointer-events: none;
}
.isce-chat-window.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Header */
.isce-chat-header {
  background: linear-gradient(to right, #1e3a8a, #0f766e);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.isce-chat-header .avatar {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid #93c5fd;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.isce-chat-header .info { margin-left: 12px; }
.isce-chat-header .info h4 {
  color: #f8fafc;
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.isce-chat-header .status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.isce-chat-header .status-dot {
  width: 8px;
  height: 8px;
  background: #6ee7b7;
  border-radius: 50%;
  box-shadow: 0 0 6px #6ee7b7;
  animation: isce-pulse 1.5s infinite;
}
@keyframes isce-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.isce-chat-header .status-text {
  color: rgba(248, 250, 252, 0.8);
  font-size: 11px;
  font-weight: 600;
}
.isce-chat-header .header-actions { display: flex; gap: 4px; }
.isce-chat-header .header-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}
.isce-chat-header .header-btn:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); }

/* Messages Area */
.isce-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}
.isce-msg-row { display: flex; animation: isce-fade-in 0.3s ease; }
.isce-msg-row.user { justify-content: flex-end; }
.isce-msg-row.bot { justify-content: flex-start; }
.isce-msg-row.bot .bot-avatar {
  width: 36px;
  height: 36px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid #bfdbfe;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  margin-right: 6px;
}
.isce-msg-bubble {
  max-width: 80%;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.6;
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.isce-msg-row.user .isce-msg-bubble {
  background: linear-gradient(135deg, #1e40af, #0d9488);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.isce-msg-row.bot .isce-msg-bubble {
  background: #fff;
  color: #334155;
  border: 2px solid #bfdbfe;
  border-bottom-left-radius: 6px;
}
.isce-msg-bubble strong { font-weight: 700; }

/* Typing dots */
.isce-typing-dots { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.isce-typing-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: isce-bounce 0.6s infinite;
}
.isce-typing-dots span:nth-child(1) { background: #2563eb; animation-delay: 0ms; }
.isce-typing-dots span:nth-child(2) { background: #0d9488; animation-delay: 150ms; }
.isce-typing-dots span:nth-child(3) { background: #f59e0b; animation-delay: 300ms; }
@keyframes isce-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Streaming cursor */
.isce-cursor {
  display: inline-block;
  width: 3px;
  height: 16px;
  background: #2563eb;
  border-radius: 2px;
  margin-left: 2px;
  vertical-align: middle;
  animation: isce-pulse 0.8s infinite;
}

/* Action buttons (Enquiry / Franchise) */
.isce-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 42px;
  animation: isce-fade-in 0.3s ease;
}
.isce-action-btn {
  padding: 8px 16px;
  background: linear-gradient(to right, #f59e0b, #f97316);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border: 2px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}
.isce-action-btn:hover { transform: scale(1.05); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); }

/* Input Area */
.isce-chat-input {
  padding: 8px 14px 14px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-top: 2px solid #bfdbfe;
  flex-shrink: 0;
}
.isce-chat-input .input-row { display: flex; gap: 8px; align-items: flex-end; }
.isce-chat-input textarea {
  flex: 1;
  resize: none;
  border: 2px solid #93c5fd;
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: #1e3a8a;
  background: #f8fafc;
  outline: none;
  max-height: 80px;
  transition: border-color 0.2s;
}
.isce-chat-input textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1); }
.isce-chat-input textarea::placeholder { color: #94a3b8; }
.isce-chat-input .send-btn {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 2px solid rgba(30, 64, 175, 0.3);
  background: linear-gradient(135deg, #2563eb, #0d9488);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transition: all 0.2s;
  flex-shrink: 0;
}
.isce-chat-input .send-btn:hover { transform: scale(1.1); }
.isce-chat-input .send-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.isce-chat-input .send-btn svg { width: 18px; height: 18px; }
.isce-chat-input .powered {
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Proactive greeting bubble */
.isce-proactive {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 99999;
  animation: isce-fade-in 0.4s ease;
}
.isce-proactive-inner {
  background: #fff;
  border: 3px solid #93c5fd;
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 14px 18px;
  max-width: 250px;
  position: relative;
}
.isce-proactive-inner .close-pro {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.isce-proactive-inner .close-pro:hover { background: #dc2626; }
.isce-proactive-inner p { margin: 0; }
.isce-proactive-inner .pro-title { font-size: 14px; font-weight: 700; color: #1e3a8a; }
.isce-proactive-inner .pro-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.isce-proactive-inner .pro-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #0c4a6e;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.isce-proactive-inner .pro-cta:hover { color: #082f49; }
.isce-proactive-inner .tail {
  position: absolute;
  bottom: -9px;
  right: 28px;
  width: 16px;
  height: 16px;
  background: #1e293b;
  border-right: 3px solid #fbbf24;
  border-bottom: 3px solid #fbbf24;
  transform: rotate(45deg);
}

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


/* ══════════════════════════════════════════════════════════════════════════
   WHATSAPP FLOATING ICON
   ══════════════════════════════════════════════════════════════════════════ */
.isce-whatsapp-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #25d366;
  border: none;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  text-decoration: none;
}
.isce-whatsapp-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 28px rgba(37, 211, 102, 0.6);
}
.isce-whatsapp-fab svg {
  width: 34px;
  height: 34px;
  fill: #fff;
}
.isce-whatsapp-fab .wa-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: #25d366;
  animation: isce-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
  opacity: 0.25;
}

/* WhatsApp tooltip */
.isce-whatsapp-fab .wa-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  margin-bottom: 10px;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}
.isce-whatsapp-fab:hover .wa-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.isce-whatsapp-fab .wa-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #1e293b;
}
