/* WA Chat Leads — widget estilo asistente (tipo Lyro)
 *
 * Todos los selectores van prefijados con #wcl-root y las propiedades
 * visuales clave llevan !important para que NINGÚN tema o plugin
 * (Elementor, botones globales del tema, resets, etc.) pueda romper
 * el diseño del widget.
 */

:root {
  --wcl-primary: #25d366;
  --wcl-header: #075e54;
  --wcl-offset-bottom: 24px;
}

#wcl-root,
#wcl-root * {
  box-sizing: border-box !important;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  line-height: 1.4;
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* ---------- Botón flotante (píldora: icono + texto en línea) ---------- */
#wcl-root .wcl-bubble-wrap {
  position: fixed !important;
  bottom: var(--wcl-offset-bottom) !important;
  z-index: 999990 !important;
}
#wcl-root.wcl-pos-right .wcl-bubble-wrap { right: 24px !important; left: auto !important; }
#wcl-root.wcl-pos-left  .wcl-bubble-wrap { left: 24px !important; right: auto !important; }

#wcl-root .wcl-bubble {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  height: 56px !important;
  padding: 0 22px !important;
  border: none !important;
  outline: none;
  border-radius: 999px !important;
  background: var(--wcl-primary) !important;
  background-image: none !important;
  color: #fff !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none !important;
}
#wcl-root .wcl-bubble:hover,
#wcl-root .wcl-bubble:focus {
  background: var(--wcl-primary) !important;
  color: #fff !important;
  transform: scale(1.05);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3) !important;
}
#wcl-root .wcl-bubble:focus-visible { outline: 3px solid rgba(0, 0, 0, 0.25) !important; outline-offset: 2px; }
#wcl-root .wcl-bubble svg {
  width: 28px !important;
  height: 28px !important;
  fill: #fff !important;
  flex-shrink: 0 !important;
  display: block !important;
}
#wcl-root .wcl-bubble .wcl-bubble-label {
  color: #fff !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}
/* Sin texto configurado: botón redondo solo con icono */
#wcl-root .wcl-bubble.wcl-icon-only {
  width: 56px !important;
  padding: 0 !important;
  justify-content: center !important;
}

/* ---------- Ventana de chat ---------- */
#wcl-root .wcl-window {
  position: fixed !important;
  bottom: calc(var(--wcl-offset-bottom) + 72px) !important;
  width: 360px !important;
  max-width: calc(100vw - 32px) !important;
  height: 520px !important;
  max-height: calc(100vh - 120px) !important;
  max-height: calc(100dvh - 120px) !important;
  background: #f5f6f8 !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 999991 !important;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  border: none !important;
}
#wcl-root.wcl-pos-right .wcl-window { right: 24px !important; left: auto !important; }
#wcl-root.wcl-pos-left  .wcl-window { left: 24px !important; right: auto !important; }
#wcl-root .wcl-window.wcl-open {
  opacity: 1 !important;
  transform: translateY(0) scale(1);
  pointer-events: auto !important;
}

@media (max-width: 480px) {
  #wcl-root .wcl-window {
    right: 16px !important;
    left: 16px !important;
    width: auto !important;
  }
}

/* ---------- Cabecera ---------- */
#wcl-root .wcl-header {
  background: var(--wcl-header) !important;
  background-image: none !important;
  color: #fff !important;
  padding: 14px 16px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-shrink: 0 !important;
}
#wcl-root .wcl-avatar {
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.18) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  flex-shrink: 0 !important;
}
#wcl-root .wcl-avatar svg { width: 24px !important; height: 24px !important; fill: #fff !important; display: block !important; }
#wcl-root .wcl-avatar::after {
  content: "";
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid var(--wcl-header);
}
#wcl-root .wcl-header-info { flex: 1 !important; min-width: 0 !important; }
#wcl-root .wcl-header-name {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #fff !important;
  margin: 0 !important;
  padding: 0 !important;
}
#wcl-root .wcl-header-status {
  font-size: 12px !important;
  color: rgba(255, 255, 255, 0.85) !important;
  margin: 0 !important;
  padding: 0 !important;
}
#wcl-root .wcl-close {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  border-radius: 8px !important;
  color: #fff !important;
  cursor: pointer !important;
  padding: 6px !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  box-shadow: none !important;
  opacity: 0.85;
}
#wcl-root .wcl-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.12) !important; }
#wcl-root .wcl-close svg { width: 18px !important; height: 18px !important; fill: #fff !important; display: block !important; }

/* ---------- Mensajes ---------- */
#wcl-root .wcl-messages {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 16px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px !important;
  scroll-behavior: smooth;
  background: transparent !important;
}
#wcl-root .wcl-msg {
  max-width: 82% !important;
  padding: 10px 14px !important;
  border-radius: 14px !important;
  font-size: 14px !important;
  color: #1f2937 !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  border: none !important;
  animation: wcl-msg-in 0.25s ease both;
}
#wcl-root .wcl-msg-bot {
  background: #fff !important;
  border-bottom-left-radius: 4px !important;
  align-self: flex-start !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}
#wcl-root .wcl-msg-user {
  background: var(--wcl-primary) !important;
  color: #fff !important;
  border-bottom-right-radius: 4px !important;
  align-self: flex-end !important;
}
#wcl-root .wcl-msg-error {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
  align-self: flex-start !important;
  border-bottom-left-radius: 4px !important;
}

/* Indicador de escritura */
#wcl-root .wcl-typing {
  display: inline-flex !important;
  gap: 4px !important;
  padding: 12px 16px !important;
  background: #fff !important;
  border-radius: 14px !important;
  border-bottom-left-radius: 4px !important;
  align-self: flex-start !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}
#wcl-root .wcl-typing span {
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #9ca3af !important;
  display: block !important;
  animation: wcl-typing 1.2s infinite ease-in-out;
}
#wcl-root .wcl-typing span:nth-child(2) { animation-delay: 0.15s; }
#wcl-root .wcl-typing span:nth-child(3) { animation-delay: 0.3s; }

/* Consentimiento */
#wcl-root .wcl-consent {
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px !important;
  background: #fff !important;
  border-radius: 14px !important;
  border-bottom-left-radius: 4px !important;
  padding: 12px 14px !important;
  font-size: 13px !important;
  color: #374151 !important;
  align-self: flex-start !important;
  max-width: 90% !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
  cursor: pointer;
}
#wcl-root .wcl-consent input {
  margin: 2px 0 0 0 !important;
  width: 16px !important;
  height: 16px !important;
  accent-color: var(--wcl-primary);
}
#wcl-root .wcl-consent a { color: var(--wcl-header) !important; text-decoration: underline !important; }

/* Botón final de WhatsApp (solo se abre al pulsarlo) */
#wcl-root .wcl-wa-cta {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: var(--wcl-primary) !important;
  background-image: none !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  padding: 12px 20px !important;
  border-radius: 999px !important;
  border: none !important;
  text-decoration: none !important;
  align-self: flex-start !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
  transition: transform 0.15s ease;
  animation: wcl-msg-in 0.25s ease both;
}
#wcl-root .wcl-wa-cta:hover { transform: scale(1.03); color: #fff !important; }
#wcl-root .wcl-wa-cta svg { width: 20px !important; height: 20px !important; fill: #fff !important; display: block !important; }

/* ---------- Zona de entrada ---------- */
#wcl-root .wcl-input-area {
  display: flex !important;
  gap: 8px !important;
  padding: 12px !important;
  background: #fff !important;
  border-top: 1px solid #e5e7eb !important;
  flex-shrink: 0 !important;
}
#wcl-root .wcl-input {
  flex: 1 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 999px !important;
  padding: 10px 16px !important;
  font-size: 14px !important;
  outline: none !important;
  background: #f9fafb !important;
  color: #111827 !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 0 !important;
  width: auto !important;
}
#wcl-root .wcl-input:focus { border-color: var(--wcl-primary) !important; background: #fff !important; }
#wcl-root .wcl-send {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  border: none !important;
  border-radius: 50% !important;
  background: var(--wcl-primary) !important;
  background-image: none !important;
  color: #fff !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
#wcl-root .wcl-send:hover { transform: scale(1.06); background: var(--wcl-primary) !important; }
#wcl-root .wcl-send:disabled { opacity: 0.5; cursor: not-allowed !important; transform: none; }
#wcl-root .wcl-send svg { width: 18px !important; height: 18px !important; fill: #fff !important; display: block !important; }

/* Ocultar la zona de entrada al terminar el flujo */
#wcl-root .wcl-input-area.wcl-hidden { display: none !important; }

/* Pie discreto */
#wcl-root .wcl-footer-note {
  text-align: center !important;
  font-size: 10px !important;
  color: #9ca3af !important;
  padding: 4px 0 8px !important;
  background: #fff !important;
  flex-shrink: 0 !important;
}

/* Botón inline (shortcode / Elementor) — fuera de #wcl-root */
.wcl-inline-button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: var(--wcl-primary, #25d366) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 999px !important;
  padding: 12px 22px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: transform 0.15s ease;
}
.wcl-inline-button:hover { transform: scale(1.03); color: #fff !important; }

/* ---------- Animaciones ---------- */
@keyframes wcl-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes wcl-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #wcl-root * { animation: none !important; transition: none !important; }
}
