/* Monzón WhatsApp Lead - pop-up tipo chat. Prefijo mzwl-. */

.mzwl-root,
.mzwl-root *,
.mzwl-fab {
  box-sizing: border-box;
  font-family: inherit;
}

.mzwl-root {
  --mzwl-primary: #0B4F8A;
  --mzwl-wa: #0E7C6B;
  --mzwl-wa-dot: #25D366;
  --mzwl-ink: #1f2937;
  --mzwl-muted: #4b5563;
  --mzwl-err: #b42318;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  line-height: 1.4;
}

.mzwl-root[hidden] {
  display: none !important;
}

.mzwl-root p {
  margin: 0;
}

/* Velo: solo en móvil (hoja inferior). En escritorio el chat no oscurece la página. */
.mzwl-overlay {
  position: absolute;
  inset: 0;
  display: none;
  background: rgba(17, 24, 39, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

.mzwl-is-open .mzwl-overlay {
  opacity: 1;
}

/* Escritorio: chat abajo a la derecha, justo encima del botón flotante
   (botón 60 px + 20 px de margen + 12 px de separación = 92 px). */
.mzwl-dialog {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  transform-origin: bottom right;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--mzwl-ink);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mzwl-is-open .mzwl-dialog {
  opacity: 1;
  transform: none;
}

/* Con botón flotante, el chat se apoya encima de él. */
.mzwl-has-fab .mzwl-dialog {
  bottom: 92px;
  max-height: calc(100vh - 116px);
}

/* Cabecera del chat */
.mzwl-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 12px 16px;
  border-bottom: 1px solid #eef0f3;
}

.mzwl-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.mzwl-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--mzwl-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.mzwl-head-txt {
  flex: 1 1 auto;
  min-width: 0;
}

.mzwl-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mzwl-ink);
}

.mzwl-sub {
  margin-top: 2px !important;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--mzwl-muted);
}

.mzwl-dot {
  display: inline-block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mzwl-wa-dot);
}

.mzwl-close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mzwl-ink);
  cursor: pointer;
  padding: 0;
}

.mzwl-close:hover {
  background: #f3f4f6;
}

/* Cuerpo: burbuja de saludo y tarjeta de campos */
.mzwl-form {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.mzwl-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #f5f6f7;
}

.mzwl-bubble {
  align-self: flex-start;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px 12px 12px 4px;
  background: #e9ebee;
  color: var(--mzwl-ink);
  font-size: 15px;
}

.mzwl-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.mzwl-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mzwl-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.mzwl-req {
  color: var(--mzwl-err);
}

.mzwl-input,
.mzwl-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  background: #fff;
  color: var(--mzwl-ink);
  font-family: inherit;
  font-size: 16px; /* evita el zoom automático en iOS */
}

.mzwl-textarea {
  min-height: 80px;
  resize: vertical;
}

.mzwl-input[aria-invalid="true"],
.mzwl-textarea[aria-invalid="true"] {
  border-color: var(--mzwl-err);
}

.mzwl-input:focus,
.mzwl-textarea:focus,
.mzwl-close:focus-visible,
.mzwl-submit:focus-visible,
.mzwl-fab:focus-visible {
  outline: 2px solid var(--mzwl-primary);
  outline-offset: 2px;
}

.mzwl-error {
  font-size: 13px;
  color: var(--mzwl-err);
}

/* Aviso de envío fallido, encima del botón */
.mzwl-alert {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--mzwl-err);
  background: #fdecec;
  border: 1px solid var(--mzwl-err);
}

.mzwl-alert[hidden] {
  display: none;
}

/* Campo trampa para bots: fuera de pantalla */
.mzwl-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.mzwl-submit {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--mzwl-wa);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.mzwl-submit:hover {
  filter: brightness(0.92);
}

.mzwl-submit:disabled {
  opacity: 0.7;
  cursor: progress;
}

.mzwl-privacy {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: var(--mzwl-muted);
}

.mzwl-root .mzwl-privacy a {
  /* El enlace hereda tamaño, interlineado y tipo de letra del aviso: el tema del sitio los cambia en los enlaces. */
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-decoration: underline;
}

.mzwl-note {
  text-align: center;
  font-size: 12px;
  color: var(--mzwl-muted);
}

/* Lanzador flotante */
.mzwl-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  width: 60px;
  height: 60px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #25D366; /* verde de la marca WhatsApp */
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease;
}

/* Olas: dos anillos concentricos que nacen del boton, se expanden y se desvanecen sin parar. */
.mzwl-fab::before,
.mzwl-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid rgba(37, 211, 102, 0.7);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: mzwl-wave 2.8s ease-out infinite;
}

.mzwl-fab::after {
  animation-delay: 1.4s;
}

/* Con el chat abierto las olas se detienen. */
.mzwl-fab[aria-expanded="true"]::before,
.mzwl-fab[aria-expanded="true"]::after {
  animation: none;
  opacity: 0;
}

.mzwl-fab:hover {
  transform: scale(1.05);
}

/* El botón alterna entre el logo y la foto del operario con un fundido. */
.mzwl-fab-ico,
.mzwl-fab-photo {
  position: absolute;
  inset: 0;
  transition: opacity 0.5s ease;
}

.mzwl-fab-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.mzwl-fab-photo {
  width: 100%;
  height: 100%;
  border: 3px solid #25D366;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  opacity: 0;
}

.mzwl-fab-alt .mzwl-fab-ico {
  opacity: 0;
}

.mzwl-fab-alt .mzwl-fab-photo {
  opacity: 1;
}

@keyframes mzwl-wave {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; } /* no pasa del margen de 20 px del borde de la pantalla */
}

/* Texto desplegable junto al botón, estilo plugin anterior. */
.mzwl-tip {
  position: fixed;
  right: 92px;
  bottom: 28px;
  z-index: 2147483000;
  max-width: min(260px, calc(100vw - 120px));
  padding: 10px 16px;
  border-radius: 12px;
  background: #fff;
  color: var(--mzwl-ink, #1f2937);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateX(16px);
  transform-origin: right center;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}

.mzwl-tip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  background: #fff;
  transform: rotate(45deg);
}

.mzwl-tip-show,
.mzwl-fab:hover + .mzwl-tip,
.mzwl-fab:focus-visible + .mzwl-tip {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.mzwl-fab[aria-expanded="true"] + .mzwl-tip {
  opacity: 0;
  visibility: hidden;
}

/* Móvil: hoja inferior casi a pantalla completa */
@media (max-width: 600px) {
  .mzwl-overlay {
    display: block;
  }

  .mzwl-dialog,
  .mzwl-has-fab .mzwl-dialog {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .mzwl-is-open .mzwl-dialog {
    transform: none;
  }

  .mzwl-fab {
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }

  .mzwl-tip {
    right: 84px;
    bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mzwl-overlay,
  .mzwl-dialog,
  .mzwl-fab,
  .mzwl-fab-ico,
  .mzwl-fab-photo,
  .mzwl-fab::before,
  .mzwl-fab::after,
  .mzwl-tip {
    transition: none !important;
    animation: none !important;
  }

  .mzwl-fab::before,
  .mzwl-fab::after {
    display: none;
  }

  .mzwl-tip {
    transform: none;
  }

  .mzwl-fab:hover {
    transform: none;
  }
}
