/* ==========================================================================
   JP Logistices - Floating WhatsApp Widget Styles (Compact & Sleek)
   ========================================================================== */

.jp-wa-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: "Sarabun", "Stack Sans Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  width: 56px;
  height: 56px;
}

/* ── Interactive Modal / Popup Box (Absolute Positioned, No Stray Hover Area) ── */
.jp-wa-modal {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 275px;
  max-width: calc(100vw - 36px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 3px 10px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
  pointer-events: none;
}

.jp-wa-widget.is-open .jp-wa-modal {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Modal Header */
.jp-wa-header {
  background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.jp-wa-avatar-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.jp-wa-avatar {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.jp-wa-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.jp-wa-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: #25D366;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
}

.jp-wa-header-info {
  flex: 1;
  min-width: 0;
}

.jp-wa-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jp-wa-subtitle {
  font-size: 10.5px;
  opacity: 0.92;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: rgba(255, 255, 255, 0.9);
}

.jp-wa-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.jp-wa-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Modal Body */
.jp-wa-body {
  padding: 12px 14px;
  background: #f8faf9;
}

.jp-wa-bubble {
  background: #ffffff;
  padding: 9px 11px;
  border-radius: 10px;
  border-top-left-radius: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: #2b3b38;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

.jp-wa-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  width: 0;
  height: 0;
  border-top: 5px solid #ffffff;
  border-left: 5px solid transparent;
}

.jp-wa-time {
  font-size: 9.5px;
  color: #8c9b98;
  text-align: right;
  margin-top: 3px;
}

/* Modal CTA Button */
.jp-wa-cta {
  margin-top: 10px;
  width: 100%;
  background: #25D366;
  color: #ffffff !important;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.jp-wa-cta:hover {
  background: #20BA56;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(37, 211, 102, 0.4);
}

.jp-wa-cta svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ── Floating Launcher Button Wrap ── */
.jp-wa-launcher-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover Pill Tooltip (Appears to the left of the button) */
.jp-wa-pill {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: #111a18;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.jp-wa-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25D366;
  box-shadow: 0 0 6px #25D366;
}

/* Show pill on launcher hover ONLY when modal is closed */
.jp-wa-widget:not(.is-open) .jp-wa-launcher-wrap:hover .jp-wa-pill {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* Main Circle Button */
.jp-wa-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.38), 0 2px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  cursor: pointer;
  border: none;
  outline: none;
}

.jp-wa-button:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.5), 0 3px 8px rgba(0, 0, 0, 0.12);
}

.jp-wa-button svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12));
  transition: transform 0.25s ease;
}

.jp-wa-button:hover svg {
  transform: scale(1.06);
}

/* Ripple Pulse Rings */
.jp-wa-pulse-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #25D366;
  opacity: 0.75;
  animation: jp-wa-pulse 2.4s infinite cubic-bezier(0.24, 0, 0.38, 1);
  pointer-events: none;
}

@keyframes jp-wa-pulse {
  0% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .jp-wa-widget {
    bottom: 18px;
    right: 18px;
    width: 50px;
    height: 50px;
  }
  .jp-wa-button {
    width: 50px;
    height: 50px;
  }
  .jp-wa-button svg {
    width: 25px;
    height: 25px;
  }
  .jp-wa-pill {
    display: none !important;
  }
  .jp-wa-modal {
    width: 255px;
    right: 0;
    bottom: calc(100% + 10px);
  }
}
