/* Contenedor fijo */
.floating-wpp {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-family: Arial, Helvetica, sans-serif;
}

/* Botón principal */
.floating-wpp-button {
  display: grid;
  width: 64px !important;
  height: 64px !important;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 12px 28px rgba(37, 211, 102, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-wpp-button:hover {
  box-shadow: 0 16px 34px rgba(37, 211, 102, 0.48);
  transform: translateY(-3px) scale(1.04);
}

.floating-wpp-button:focus-visible,
.floating-wpp-btn-send:focus-visible,
.floating-wpp-head .close:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 3px;
}

.floating-wpp-button img {
  display: block;
  width: 64%;
  height: 64%;
  object-fit: contain;
}

/* Panel de conversación */
.floating-wpp-popup {
  position: absolute;
  right: 0;
  bottom: calc(100% + 16px);
  width: min(350px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  background: #f7f9f8;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.25s ease;
}

.floating-wpp-popup.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Encabezado */
.floating-wpp-head {
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, #25d366, #128c7e);
}

.floating-wpp-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  object-fit: cover;
}

.floating-wpp-avatar-info {
  min-width: 0;
  margin-left: 12px;
  color: #fff;
}

.floating-wpp-avatar-name {
  overflow: hidden;
  /* font-size: 15px; */
  font-weight: 700;
  line-height: 1.3;
  color: #000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-wpp-avatar-role {
  margin-top: 2px;
  /* font-size: 12px; */
  /* opacity: 0.88; */
}

/* Cerrar: texto discreto */
.floating-wpp-head .close {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.floating-wpp-head .close:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.18);
  transform: none;
}

/* Mensaje de bienvenida */
.floating-wpp-message {
  position: relative;
  margin: 16px;
  padding: 13px 14px;
  border-radius: 4px 14px 14px;
  color: #27313b;
  background: #fff;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
  font-size: 14px;
  line-height: 1.5;
}

/* Área de escritura */
.floating-wpp-input-message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid #e9eeee;
  background: #fff;
}

.floating-wpp-input-message textarea {
  width: 100%;
  min-height: 44px;
  max-height: 110px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid #dce4e1;
  border-radius: 12px;
  outline: none;
  color: #27313b;
  background: #f7f9f8;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.35;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.floating-wpp-input-message textarea:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.16);
}

.floating-wpp-input-message textarea::placeholder {
  color: #82908b;
}

/* Enviar: botón claro y moderno */
.floating-wpp-btn-send {
  min-width: 80px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #128c7e;
  box-shadow: 0 5px 12px rgba(18, 140, 126, 0.24);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.2s ease;
}

.floating-wpp-btn-send:hover {
  background: #0d756a;
  transform: translateY(-1px);
}





/* Móvil */
@media (max-width: 480px) {
  .floating-wpp {
    right: 16px;
    bottom: 16px;
  }

  .floating-wpp-button {
    width: 58px !important;
    height: 58px !important;
  }

  .floating-wpp-popup {
    width: min(350px, calc(100vw - 24px));
    right: 0;
    bottom: calc(100% + 12px);
    border-radius: 16px;
  }

  .floating-wpp-head {
    min-height: 68px;
    padding: 10px 12px;
  }

  .floating-wpp-message {
    margin: 12px;
  }

  .floating-wpp-input-message {
    padding: 10px 12px 12px;
  }
}

/* Respeta usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .floating-wpp-button,
  .floating-wpp-popup,
  .floating-wpp-head .close,
  .floating-wpp-btn-send {
    transition: none;
  }
}