/*
 * GDPS-34777 - Widget flotante de WhatsApp.
 * Reemplaza al launcher del webchat de Commbox (dado de baja), en la misma
 * posicion: esquina inferior derecha, sobre el footer.
 *
 * Diseno segun el ejemplo adjunto al ticket (IDSS-95208): cabecera con avatar y
 * nombre, burbuja de bienvenida sobre fondo de chat, campo de mensaje y boton
 * verde de envio. Al enviar se abre la conversacion de WhatsApp con el texto
 * escrito (wa.me/<numero>?text=<mensaje>).
 *
 * El icono del launcher ya trae el circulo verde (wsp-icon.svg), por eso el
 * boton no lleva fondo propio.
 */

/* --- Launcher flotante --- */
.myv-whatsapp-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1030;
  display: block;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  line-height: 0;
  cursor: pointer;
}

.myv-whatsapp-launcher:hover,
.myv-whatsapp-launcher:focus {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  outline: none;
}

.myv-whatsapp-launcher img {
  width: 100%;
  height: 100%;
  display: block;
}

/* Punto de notificacion, como en el ejemplo del ticket */
.myv-whatsapp-launcher::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff3b30;
  border: 2px solid #ffffff;
}

.myv-whatsapp-launcher[aria-expanded="true"]::after {
  display: none;
}

/* --- Panel --- */
.myv-whatsapp-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 1031;
  width: 330px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  font-family: inherit;
}

.myv-whatsapp-panel[hidden] {
  display: none;
}

/* Cabecera blanca con avatar y nombre */
.myv-whatsapp-panel__header {
  display: flex;
  align-items: center;
  background: #ffffff;
  padding: 12px 14px;
  border-bottom: 1px solid #ececec;
}

.myv-whatsapp-panel__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f2f2f2;
  object-fit: contain;
  padding: 4px;
  flex: 0 0 auto;
}

.myv-whatsapp-panel__identity {
  flex: 1 1 auto;
  padding-left: 10px;
  min-width: 0;
}

.myv-whatsapp-panel__name {
  font-size: 14px;
  font-weight: 700;
  color: #58595b;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.myv-whatsapp-panel__status {
  font-size: 11px;
  color: #8b8b8b;
  margin: 2px 0 0;
  line-height: 1.2;
}

.myv-whatsapp-panel__close {
  background: transparent;
  border: 0;
  color: #8b8b8b;
  font-size: 22px;
  line-height: 1;
  padding: 0 0 0 8px;
  cursor: pointer;
  flex: 0 0 auto;
}

.myv-whatsapp-panel__close:hover,
.myv-whatsapp-panel__close:focus {
  color: #58595b;
  outline: none;
}

/* Cuerpo con fondo de chat y burbuja de bienvenida */
.myv-whatsapp-panel__chat {
  background: #e5ddd5;
  padding: 16px 14px;
}

.myv-whatsapp-panel__bubble {
  position: relative;
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 12px 18px;
  font-size: 13px;
  line-height: 1.45;
  color: #303030;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  max-width: 90%;
}

.myv-whatsapp-panel__bubble-time {
  position: absolute;
  right: 10px;
  bottom: 5px;
  font-size: 10px;
  color: #9a9a9a;
}

/* Campo de mensaje y envio */
.myv-whatsapp-panel__body {
  padding: 12px 14px 14px;
  background: #ffffff;
}

.myv-whatsapp-panel__input {
  width: 100%;
  border: 1px solid #d5d5d5;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #58595b;
}

.myv-whatsapp-panel__input::placeholder {
  color: #a9a9a9;
}

.myv-whatsapp-panel__input:focus {
  border-color: #80bc00;
  outline: none;
}

.myv-whatsapp-panel__send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  border: 0;
  border-radius: 22px;
  background: #25d366;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease-in-out;
}

.myv-whatsapp-panel__send:hover,
.myv-whatsapp-panel__send:focus {
  background: #1eb855;
  outline: none;
}

/* --- Mobile --- */
@media only screen and (max-width: 767px) {
  .myv-whatsapp-launcher {
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
  }

  .myv-whatsapp-panel {
    right: 16px;
    bottom: 76px;
    width: calc(100vw - 32px);
  }
}
