/* ─────────────────────────────────────────
   WhatsApp Floating Widget
   Place this before </body> with the HTML
   ───────────────────────────────────────── */

/* ── FAB Button ── */
.wa-fab {
  position: fixed;
  bottom: clamp(16px, 4vw, 28px);
  right: clamp(16px, 4vw, 28px);
  width: clamp(50px, 8vw, 62px);
  height: clamp(50px, 8vw, 62px);
  background: #25D366;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  outline: none;
}

.wa-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 22px rgba(37, 211, 102, 0.55);
}

.wa-fab:active {
  transform: scale(0.96);
}

/* Icon swap: show chat icon by default, close icon when open */
.wa-fab-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wa-fab-icon--chat  { opacity: 1;  transform: rotate(0deg) scale(1); }
.wa-fab-icon--close { opacity: 0;  transform: rotate(-90deg) scale(0.7); }

.wa-fab.is-open .wa-fab-icon--chat  { opacity: 0;  transform: rotate(90deg) scale(0.7); }
.wa-fab.is-open .wa-fab-icon--close { opacity: 1;  transform: rotate(0deg) scale(1); }

/* ── Popup Card ── */
.wa-popup {
  position: fixed;
  bottom: calc(clamp(16px, 4vw, 28px) + clamp(50px, 8vw, 62px) + 16px);
  right: clamp(16px, 4vw, 28px);
  width: min(320px, calc(100vw - 32px));
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 9998;

  /* Hidden state */
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity 0.3s cubic-bezier(0.34,1.56,0.64,1),
              transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

/* Visible state */
.wa-popup.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */
.wa-header {
  background: var(--primary-color);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #128C7E;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.wa-header-name {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wa-header-sub {
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  margin: 3px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wa-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.wa-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.18s;
  flex-shrink: 0;
}

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

/* ── Chat Body ── */
.wa-body {
  background: #ECE5DD;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c5b8ad' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  padding: 20px 14px 16px;
  min-height: 110px;
  display: flex;
  align-items: flex-start;
}

.wa-bubble-wrap {
  display: flex;
  flex-direction: column;
  animation: bubbleIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  animation-delay: 0.15s;
  opacity: 0;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wa-bubble {
  background: #ffffff;
  border-radius: 2px 12px 12px 12px;
  padding: 10px 14px;
  max-width: 240px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  position: relative;
}

.wa-bubble-sender {
  font-size: 12px;
  color: #075E54;
  font-weight: 600;
  margin: 0 0 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wa-bubble-text {
  font-size: 14px;
  color: #111111;
  margin: 0;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wa-bubble-time {
  font-size: 11px;
  color: #888888;
  text-align: right;
  margin: 5px 0 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Footer / CTA ── */
.wa-footer {
  padding: 12px 14px 16px;
  background: #ffffff;
}

.wa-start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  background: #25D366;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.01em;
}

.wa-start-btn:hover {
  background: #1ebe5d;
}

.wa-start-btn:active {
  transform: scale(0.98);
}

/* ── Responsive tweaks ── */
@media (max-width: 400px) {
  .wa-popup {
    border-radius: 14px;
  }

  .wa-header {
    padding: 12px 14px;
  }

  .wa-body {
    padding: 16px 12px 12px;
  }

  .wa-footer {
    padding: 10px 12px 14px;
  }
}
