/* WA Chat Plugin — Widget Styles */
#wacp-widget {
  position: fixed;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Positions */
.wacp-pos-bottom-right { bottom: 24px; right: 24px; }
.wacp-pos-bottom-left  { bottom: 24px; left: 24px; }
.wacp-pos-top-right    { top: 24px; right: 24px; }
.wacp-pos-top-left     { top: 24px; left: 24px; }

/* ---- Trigger button ---- */
.wacp-trigger {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(37,211,102,0.45);
  position: relative;
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: wacp-pop-in 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  padding: 0;
}

@keyframes wacp-pop-in {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

.wacp-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(37,211,102,0.55);
}
.wacp-trigger:active  { transform: scale(0.95); }
.wacp-trigger:focus   { outline: 3px solid rgba(37,211,102,0.5); outline-offset: 3px; }

/* Icons inside trigger */
.wacp-icon-wa,
.wacp-icon-close {
  position: absolute;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.22s;
}
.wacp-icon-wa    { width: 32px; height: 32px; opacity: 1; transform: scale(1) rotate(0deg); }
.wacp-icon-close { width: 22px; height: 22px; opacity: 0; transform: scale(0) rotate(90deg); }

.wacp-trigger.wacp-open .wacp-icon-wa    { opacity: 0; transform: scale(0) rotate(-90deg); }
.wacp-trigger.wacp-open .wacp-icon-close { opacity: 1; transform: scale(1) rotate(0deg); }

/* ---- Ripple rings ---- */
.wacp-ripple {
  position: absolute;
  top: 50%; left: 50%;
  width: 60px; height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  border: 2px solid rgba(37,211,102,0.45);
  animation: wacp-ripple 2.5s ease-out infinite;
  z-index: 1;
  pointer-events: none;
}
.wacp-ripple:nth-child(2) { animation-delay: 0.85s; }
.wacp-ripple:nth-child(3) { animation-delay: 1.7s; }

@keyframes wacp-ripple {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2); opacity: 0; }
}

/* ---- Badge ---- */
.wacp-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 20px; height: 20px;
  background: #ff4757;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  z-index: 3;
  animation: wacp-badge-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes wacp-badge-in {
  0%   { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ---- Chat window ---- */
.wacp-chat {
  position: absolute;
  width: 340px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.04);
  overflow: hidden;
  pointer-events: none;
  transform: scale(0.85) translateY(12px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.3s ease;
}
.wacp-chat.wacp-chat--open {
  pointer-events: all;
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Position the chat window relative to the trigger */
.wacp-pos-bottom-right .wacp-chat { bottom: 72px; right: 0; transform-origin: bottom right; }
.wacp-pos-bottom-left  .wacp-chat { bottom: 72px; left: 0;  transform-origin: bottom left; }
.wacp-pos-top-right    .wacp-chat { top: 72px;    right: 0; transform-origin: top right; }
.wacp-pos-top-left     .wacp-chat { top: 72px;    left: 0;  transform-origin: top left; }

@media (max-width: 420px) {
  .wacp-chat { width: 290px; }
}

/* Header */
.wacp-chat-header {
  background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
  padding: 16px 16px 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.wacp-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.wacp-header-info { flex: 1; }
.wacp-agent-name {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 3px;
  line-height: 1;
}
.wacp-status {
  color: rgba(255,255,255,0.75);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}
.wacp-status-dot {
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  flex-shrink: 0;
  animation: wacp-status 2s ease-in-out infinite;
}
@keyframes wacp-status {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.wacp-header-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
  padding: 0; flex-shrink: 0;
}
.wacp-header-close:hover { background: rgba(255,255,255,0.15); }
.wacp-header-close svg { width: 16px; height: 16px; }
.wacp-header-close:focus { outline: 2px solid rgba(255,255,255,0.5); }

/* Chat body */
.wacp-chat-body {
  padding: 16px 14px;
  min-height: 120px;
  background: #f0f2f5;
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.04) 1px, transparent 0);
  background-size: 20px 20px;
}

/* Typing indicator */
.wacp-typing {
  display: inline-flex;
  gap: 5px;
  background: #fff;
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 8px;
}
.wacp-typing span {
  width: 7px; height: 7px;
  background: #adb5bd;
  border-radius: 50%;
  animation: wacp-typing 1.2s ease-in-out infinite;
}
.wacp-typing span:nth-child(2) { animation-delay: 0.2s; }
.wacp-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wacp-typing {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* Message bubble */
.wacp-message {
  background: #fff;
  padding: 11px 15px;
  border-radius: 16px 16px 16px 4px;
  font-size: 0.875rem;
  color: #2d3436;
  line-height: 1.55;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  max-width: 92%;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  margin-bottom: 4px;
}
.wacp-message.wacp-message--show {
  opacity: 1;
  transform: translateY(0);
}
.wacp-msg-time {
  font-size: 0.68rem;
  color: #adb5bd;
  text-align: right;
  margin-top: 5px;
}

/* Footer / CTA */
.wacp-chat-footer {
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid #f0f2f5;
}
.wacp-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 18px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(37,211,102,0.38);
  font-family: inherit;
}
.wacp-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,211,102,0.5);
}
.wacp-cta-btn:active { transform: translateY(0); }
.wacp-cta-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.wacp-privacy {
  text-align: center;
  margin: 8px 0 0;
  font-size: 0.7rem;
  color: #adb5bd;
}

/* Disabled / hidden */
#wacp-widget.wacp-hidden { display: none !important; }
