.whatsapp-chat-wrapper {
  width: 60px;
  height: 60px;

  position: sticky;
  left: 100%;
  bottom: 110px;
  margin-right: 20px;
  margin-top: -60px;
  z-index: 10;
}

.whatsapp-chat-icon {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background-color: #25d366 !important;
  color: #ffffff !important;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.whatsapp-chat-icon:hover {
  transform: scale(1.1);
  color: #ffffff;
}

.whatsapp-chat-icon svg {
  width: 34px;
  height: 34px;
}

/* Both icons are stacked in the center and slide vertically */
.whatsapp-chat-icon__open,
.whatsapp-chat-icon__close {
  position: absolute;
  top: 50%;
  left: 50%;
  transition:
    transform 0.35s ease,
    opacity 0.35s ease;
}

/* Default: WhatsApp icon visible, cross waiting below */
.whatsapp-chat-icon__open {
  transform: translate(-50%, -50%);
  opacity: 1;
}

.whatsapp-chat-icon .whatsapp-chat-icon__close {
  width: 28px;
  height: 28px;
  transform: translate(-50%, calc(-50% + 60px));
  opacity: 0;
}

/* Open: WhatsApp icon slides up and out, cross slides up into place */
.whatsapp-chat-wrapper.is-open .whatsapp-chat-icon__open {
  transform: translate(-50%, calc(-50% - 60px));
  opacity: 0;
}

.whatsapp-chat-wrapper.is-open .whatsapp-chat-icon__close {
  transform: translate(-50%, -50%);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-chat-icon__open,
  .whatsapp-chat-icon__close {
    transition: none;
  }
}

/* Popup */
.whatsapp-chat-popup {
  position: absolute;
  right: 0;
  bottom: calc(100% + 15px);
  width: 320px;
  max-width: calc(100vw - 40px);
  background: #ffffff;
  color: #1f2933;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.97);
  transform-origin: bottom right;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s;
}

.whatsapp-chat-popup[hidden] {
  display: block; /* keep it animatable; visibility handles hiding */
}

.whatsapp-chat-wrapper.is-open .whatsapp-chat-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.whatsapp-chat-popup__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #075e54;
  color: #ffffff;
}

.whatsapp-chat-popup__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.whatsapp-chat-popup__title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.whatsapp-chat-popup__close {
  background-color: transparent !important;
  border: 0;
  color: #ffffff !important;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  opacity: 0.85;
}

.whatsapp-chat-popup__close:hover {
  opacity: 1;
}

.whatsapp-chat-popup__body {
  padding: 18px 16px;
  background: #ece5dd;
}

.whatsapp-chat-popup__message {
  position: relative;
  display: inline-block;
  max-width: 90%;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: 0 8px 8px 8px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.whatsapp-chat-popup__footer {
  padding: 12px 16px 16px;
  background: #ffffff;
}

.whatsapp-chat-popup__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: #25d366;
  color: #ffffff;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.whatsapp-chat-popup__button:hover {
  background: #1ebe5b;
  color: #ffffff;
}

/* media query starts */
@media screen and (max-width: 1366px) {
  .whatsapp-chat-wrapper {
    width: 50px;
    height: 50px;
    bottom: 95px;
  }

  .whatsapp-chat-icon svg {
    width: 30px;
    height: 30px;
  }

  .whatsapp-chat-icon .whatsapp-chat-icon__close {
    width: 25px;
    height: 25px;
  }

  .whatsapp-chat-popup__button {
    padding: 10px 16px;
  }

  .whatsapp-chat-popup__footer {
    padding: 12px 16px 14px;
  }

  .whatsapp-chat-popup__avatar {
    width: 34px;
    height: 34px;
  }

  .whatsapp-chat-popup__avatar svg {
    width: 20px;
    height: 20px;
  }

  .whatsapp-chat-popup__message {
    font-size: 13px;
  }

  .whatsapp-chat-popup__header {
    padding: 12px 16px;
  }
}

@media screen and (max-width: 767px) {
  .whatsapp-chat-wrapper {
    margin-right: 16px;
  }
}

@media screen and (max-width: 749px) {
  .whatsapp-chat-wrapper {
    width: 50px;
    height: 50px;
  }

  .whatsapp-chat-icon svg {
    width: 30px;
    height: 30px;
  }

  .whatsapp-chat-icon .whatsapp-chat-icon__close {
    width: 24px;
    height: 24px;
  }
}
