
/* ─── Widget Container ─── */
#wa-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

/* ─── Chat Popup Box ─── */
#wa-popup {
  width: 340px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: all 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#wa-popup.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.wa-header {
  background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
  padding: 18px 20px 20px;
  position: relative;
}
.wa-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.wa-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wa-brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-brand-icon svg { width: 18px; height: 18px; fill: #fff; }
.wa-brand-name {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.wa-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s;
}
.wa-close-btn:hover { background: rgba(255,255,255,0.28); }

/* Agent Card */
.wa-agent {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wa-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.6);
  object-fit: cover;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.wa-online-dot {
  width: 12px;
  height: 12px;
  background: #44e44a;
  border: 2px solid #075e54;
  border-radius: 50%;
  position: absolute;
  bottom: 1px;
  right: 1px;
}
.wa-agent-info { flex: 1; }
.wa-agent-name {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.wa-agent-role {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-weight: 600;
  margin-top: 1px;
}
.wa-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}
.wa-status-dot {
  width: 7px;
  height: 7px;
  background: #44e44a;
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.wa-status-text {
  color: rgba(255,255,255,0.8);
  font-size: 11.5px;
  font-weight: 600;
}

/* Chat body */
.wa-body {
  background: #e5ddd5;
  padding: 18px 16px 14px;
  background-image: url("data:image/svg+xml,%3Csvg width='400' height='400' xmlns='http://www.w3.org/2000/svg'%3E%3Cg opacity='.03' fill='%23000'%3E%3Ccircle cx='20' cy='20' r='2'/%3E%3Ccircle cx='60' cy='20' r='2'/%3E%3Ccircle cx='100' cy='20' r='2'/%3E%3Ccircle cx='140' cy='20' r='2'/%3E%3Ccircle cx='20' cy='60' r='2'/%3E%3Ccircle cx='60' cy='60' r='2'/%3E%3Ccircle cx='100' cy='60' r='2'/%3E%3Ccircle cx='140' cy='60' r='2'/%3E%3C/g%3E%3C/svg%3E");
}

/* Greeting bubble */
.wa-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 4px;
}
.wa-bubble-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  margin-bottom: 4px;
}
.wa-bubble {
  background: #fff;
  border-radius: 0 12px 12px 12px;
  padding: 10px 14px;
  max-width: 240px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  position: relative;
}
.wa-bubble::before {
  content: '';
  position: absolute;
  top: 0; left: -8px;
  width: 0; height: 0;
  border-top: 8px solid #fff;
  border-left: 8px solid transparent;
}
.wa-bubble p {
  font-size: 13.5px;
  color: #303030;
  line-height: 1.55;
}
.wa-bubble-time {
  font-size: 10.5px;
  color: #aaa;
  text-align: right;
  margin-top: 5px;
}

/* Typing indicator */
.wa-typing {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.wa-typing-bubble {
  background: #fff;
  border-radius: 0 12px 12px 12px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 4px;
}
.dot {
  width: 7px;
  height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Footer CTA */
.wa-footer {
  padding: 14px 16px 16px;
  background: #fff;
}
.wa-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #25d366;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: 50px;
  padding: 13px 22px;
  width: 100%;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  letter-spacing: 0.2px;
}
.wa-cta:hover { background: #1ebe5d; transform: translateY(-1px); }
.wa-cta:active { transform: translateY(0); }
.wa-cta svg { width: 20px; height: 20px; fill: #fff; flex-shrink: 0; }
.wa-footer-note {
  text-align: center;
  font-size: 11px;
  color: #aaa;
  margin-top: 9px;
  font-weight: 600;
}

/* ─── Floating Button ─── */
#wa-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #25d366;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(37,211,102,0.45), 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
#wa-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 32px rgba(37,211,102,0.55), 0 4px 12px rgba(0,0,0,0.15);
}
#wa-fab svg { width: 32px; height: 32px; fill: #fff; transition: opacity 0.2s; }
#wa-fab .icon-close { display: none; }
#wa-fab.active .icon-wa { display: none; }
#wa-fab.active .icon-close { display: block; }

/* Notification badge */
.wa-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #ff3b30;
  border-radius: 50%;
  border: 2px solid #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Ripple ring */
.wa-ripple {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(37,211,102,0.5);
  animation: ripple 2s ease-out infinite;
  pointer-events: none;
}
.wa-ripple:nth-child(2) { animation-delay: 0.7s; }
@keyframes ripple {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Tooltip */
.wa-tooltip {
  position: absolute;
  right: 70px;
  bottom: 50%;
  transform: translateY(50%);
  background: #222;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.wa-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #222;
  border-right: none;
}
#wa-fab:hover .wa-tooltip { opacity: 1; }