/* Final Widget Opsi 1 Medium Outline - Updated Script
   Outline putih tipis SUDAH ADA di PNG (export dari Photoshop stroke 4-6px white)
   jadi akan terlihat jelas di background hitam / navy.
   Tidak perlu extra CSS stroke / filter / drop-shadow.
   NO flip - pose salam hands forward original.
*/

.sip-wa-wrapper {
  position: fixed;
  right: 24px;
  bottom: 56px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  z-index: 9999;
  /* INI KUNCINYA: wrapper yang animasi, bukan child */
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.7s cubic-bezier(.68,-0.2,.32,1.2), opacity 0.5s ease;
  pointer-events: auto;
  will-change: transform;
}

.sip-wa-wrapper.is-hidden {
  transform: translateX(140%);
  opacity: 0;
  pointer-events: none; /* cuma nonaktif saat sudah hilang total */
}

.sip-wa-avatar {
  height: clamp(170px, 22vw, 300px); /* medium outline tetap jelas di bg gelap */
  width: auto;
  display: block;
  cursor: pointer;
  filter: drop-shadow(0 12px 32px rgba(0,0,0,0.3));
  user-select: none;
  -webkit-user-drag: none;
  /* jangan di-flip */
  transform: none;
}

.sip-wa-bubble-wrap {
  position: relative;
  margin-right: 18px;
  margin-bottom: 4px;
  pointer-events: auto;
}

.sip-wa-bubble {
  position: relative;
  background: white;
  color: #0F2942;
  padding: 12px 40px 12px 16px;
  border-radius: 18px 18px 4px 18px;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  cursor: pointer;
  max-width: 240px;
  line-height: 1.4;
}

/* ekor bubble mengarah ke avatar */
.sip-wa-bubble::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: white;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  transform: rotate(45deg);
}

.sip-wa-bubble-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  background: #EEF2F7;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
}

.sip-wa-bubble p {
  margin: 0 22px 12px 0;
  font-size: 14.5px;
  line-height: 1.45;
  font-weight: 500;
}

.sip-wa-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: #F1F5F9;
  color: #64748B;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sip-wa-close:hover { background: #E2E8F0; color: #0F2942; }

.sip-wa-btn {
  background: #25D366;
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(37,211,102,0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sip-wa-btn:hover { background: #1DA851; transform: translateY(-1px); }

@keyframes sip-wa-slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes sip-wa-bubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Avatar menghilang setelah 10 detik */
@keyframes sipHideShow {
  0% { transform: translateX(0) rotate(-2deg); opacity: 1; }
  40% { transform: translateX(0) rotate(-2deg); opacity: 1; } /* diam 10 detik */
  50% { transform: translateX(150px) rotate(3deg); opacity: 0; } /* hilang ke kanan */
  90% { transform: translateX(150px) rotate(3deg); opacity: 0; } /* stay hilang 10 detik */
  100% { transform: translateX(0) rotate(-2deg); opacity: 1; } /* muncul lagi */
}

.sip-wa-avatar.loop-hide {
  animation: sipHideShow 20s infinite; /* 10 detik tampil + 10 detik hilang = 20s loop */
}
.sip-wa-bubble.loop-hide {
  animation: sipHideShow 20s infinite;
}


@media (max-width: 640px) {
  .sip-wa-wrapper { right: 10px; }
  .sip-wa-avatar { height: 170px; }
  .sip-wa-bubble { min-width: 230px; max-width: 260px; }
}