/* ==========================================================================
   SM GLOBAL IT SOLUTION - CHAT & SUPPORT BOT SYSTEM
   Enterprise Floating Assistant & Lead Generation Bot
   ========================================================================== */

:root {
  --chat-primary: #0F3E8A;
  --chat-primary-dark: #0A2558;
  --chat-accent: #00A651;
  --chat-bg: #FFFFFF;
  --chat-panel-bg: #F8FAFC;
  --chat-border: #E2E8F0;
  --chat-text: #0F172A;
  --chat-text-muted: #64748B;
  --chat-user-msg: #0F3E8A;
  --chat-bot-msg: #F1F5F9;
  --chat-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

/* Floating WhatsApp Button (Desktop) */
.sm-whatsapp-float {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9990;
  display: flex;
  align-items: center;
  background: #25D366;
  color: #FFFFFF !important;
  height: 52px;
  width: 52px;
  padding: 0;
  border-radius: 26px;
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.35);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s ease, box-shadow 0.2s ease;
}

.sm-whatsapp-float:hover {
  width: 245px;
  padding-right: 18px;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(37, 211, 102, 0.5);
}

.sm-whatsapp-float-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}

.sm-whatsapp-float-label {
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s;
  letter-spacing: 0.01em;
}

.sm-whatsapp-float:hover .sm-whatsapp-float-label {
  opacity: 1;
  transform: translateX(0);
}

/* Floating Launcher Button */
.sm-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  outline: none;
  border: none;
  background: transparent;
  padding: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sm-chat-launcher:hover {
  transform: translateY(-2px);
}

.sm-chat-launcher:active {
  transform: scale(0.96);
}

.sm-chat-badge-callout {
  background: #FFFFFF;
  color: var(--chat-text);
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--chat-border);
  font-size: 0.84rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: calloutFloat 4s ease-in-out infinite;
  white-space: nowrap;
}

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

.sm-chat-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--chat-accent);
  position: relative;
}

.sm-chat-pulse-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: inherit;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

.sm-chat-icon-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F3E8A 0%, #0A2558 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 10px 25px rgba(15, 62, 138, 0.4);
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sm-chat-icon-circle svg {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.sm-chat-icon-open {
  display: block;
}

.sm-chat-icon-close {
  display: none;
}

.sm-chat-launcher.is-active .sm-chat-icon-open {
  display: none;
}

.sm-chat-launcher.is-active .sm-chat-icon-close {
  display: block;
}

.sm-chat-unread-count {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #E11D48;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
}

/* Chat Container Window */
.sm-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--chat-bg);
  border-radius: 16px;
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9991;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--chat-border);
}

.sm-chat-window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.sm-chat-header {
  background: linear-gradient(135deg, #0A2558 0%, #0F3E8A 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.sm-chat-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.sm-chat-avatar-wrap img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sm-chat-status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10B981;
  border-radius: 50%;
  border: 2px solid #0A2558;
}

.sm-chat-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.2;
}

.sm-chat-header-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sm-chat-header-sub::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
}

.sm-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sm-chat-btn-icon {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.sm-chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Chat Body */
.sm-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--chat-panel-bg);
  scroll-behavior: smooth;
}

/* Message Bubbles */
.sm-chat-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: fadeInMsg 0.25s ease-out;
}

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

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

.sm-chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.sm-chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.sm-chat-msg.bot .sm-chat-bubble {
  background: #FFFFFF;
  color: var(--chat-text);
  border: 1px solid var(--chat-border);
  border-top-left-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.sm-chat-msg.user .sm-chat-bubble {
  background: var(--chat-user-msg);
  color: #FFFFFF;
  border-top-right-radius: 2px;
  box-shadow: 0 4px 10px rgba(15, 62, 138, 0.2);
}

.sm-chat-timestamp {
  font-size: 0.68rem;
  color: var(--chat-text-muted);
  margin-top: 4px;
  text-align: right;
}

.sm-chat-msg.user .sm-chat-timestamp {
  color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.sm-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #FFFFFF;
  border-radius: 14px;
  border-top-left-radius: 2px;
  width: fit-content;
  border: 1px solid var(--chat-border);
}

.sm-chat-typing span {
  width: 6px;
  height: 6px;
  background: #94A3B8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.sm-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.sm-chat-typing span:nth-child(2) { animation-delay: -0.16s; }
.sm-chat-typing span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Action Chips */
.sm-chat-chips-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.sm-chat-chip-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--chat-primary);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sm-chat-chip-btn:hover {
  background: #F1F5F9;
  border-color: var(--chat-primary);
  transform: translateX(2px);
}

.sm-chat-chip-btn svg {
  color: var(--chat-text-muted);
  transition: transform 0.15s ease;
}

.sm-chat-chip-btn:hover svg {
  color: var(--chat-primary);
  transform: translateX(3px);
}

/* WhatsApp Redirection Card */
.sm-chat-whatsapp-card {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
}

.sm-chat-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25D366;
  color: #FFFFFF;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 8px;
  transition: background 0.2s;
}

.sm-chat-whatsapp-btn:hover {
  background: #1EBE5D;
}

/* Lead Capture Inline Form inside Chat */
.sm-chat-form-inline {
  background: #FFFFFF;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sm-chat-input-field {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.82rem;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-family: inherit;
  outline: none;
  background: #F8FAFC;
}

.sm-chat-input-field:focus {
  border-color: var(--chat-primary);
  background: #FFFFFF;
}

.sm-chat-form-submit {
  background: var(--chat-primary);
  color: #FFFFFF;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.sm-chat-form-submit:hover {
  background: var(--chat-primary-dark);
}

/* Footer & Input Bar */
.sm-chat-footer {
  background: #FFFFFF;
  border-top: 1px solid var(--chat-border);
  padding: 10px 14px;
}

.sm-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sm-chat-text-input {
  flex: 1;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 0.86rem;
  outline: none;
  font-family: inherit;
  background: #F8FAFC;
  transition: border-color 0.2s;
}

.sm-chat-text-input:focus {
  border-color: var(--chat-primary);
  background: #FFFFFF;
}

.sm-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.sm-chat-send-btn:hover {
  background: var(--chat-primary-dark);
  transform: scale(1.05);
}

.sm-chat-send-btn:active {
  transform: scale(0.95);
}

.sm-chat-branding {
  text-align: center;
  font-size: 0.68rem;
  color: #94A3B8;
  margin-top: 6px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .sm-whatsapp-float {
    display: none !important; /* Mobile bottom dock contains prominent WhatsApp button */
  }

  .sm-chat-launcher {
    bottom: 78px; /* Safe distance above the mobile dock */
    right: 16px;
  }

  .sm-chat-badge-callout {
    display: none; /* Keep clean on small mobile screens */
  }

  .sm-chat-icon-circle {
    width: 50px;
    height: 50px;
  }

  .sm-chat-window {
    bottom: 140px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
    height: 480px;
    max-height: calc(100vh - 160px);
  }
}
