/* ================================================================
   Vitalis WhatsApp — Botanical Pulse Button
   Matches the organic pulse effect from Vitalis landing page
   ================================================================ */

:root {
  --vwa-theme:      #3D5C42;
  --vwa-accent:     #C4694F;
  --vwa-cream:      #F5F0E8;
  --vwa-gold:       #C9A96E;
  --vwa-dark:       #1A1A18;
  --vwa-radius-btn: 50%;
  --vwa-size:       64px;
  --vwa-z:          9999;
  --vwa-shadow:     0 12px 40px rgba(0,0,0,0.2);
  --vwa-ease:       cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Root Wrapper ─────────────────────────────────────────────── */
#vwa-root {
  position: fixed;
  z-index: var(--vwa-z);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  pointer-events: none;
}

#vwa-root[data-position="bottom-right"] {
  bottom: 28px;
  right: 28px;
  align-items: flex-end;
}
#vwa-root[data-position="bottom-left"] {
  bottom: 28px;
  left: 28px;
  align-items: flex-start;
}

/* ── Main Button ──────────────────────────────────────────────── */
.vwa-btn {
  position: relative;
  width:  var(--vwa-size);
  height: var(--vwa-size);
  border-radius: var(--vwa-radius-btn);
  border: none;
  cursor: pointer;
  pointer-events: all;
  background: transparent;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* Inner circle */
.vwa-btn-inner {
  position: relative;
  z-index: 4;
  width:  var(--vwa-size);
  height: var(--vwa-size);
  border-radius: 50%;
  background: var(--vwa-theme);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--vwa-shadow);
  transition: transform 0.35s var(--vwa-ease),
              background 0.3s ease,
              box-shadow 0.3s ease;
}

.vwa-btn:hover .vwa-btn-inner {
  transform: scale(1.08);
  box-shadow: 0 16px 48px rgba(0,0,0,0.28);
}

/* Icons */
.vwa-icon-wa,
.vwa-icon-close {
  width: 30px; height: 30px;
  position: absolute;
  transition: opacity 0.3s ease, transform 0.4s var(--vwa-ease);
}
.vwa-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.7);
}
.vwa-icon-wa {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
.vwa-btn.is-open .vwa-icon-wa {
  opacity: 0;
  transform: rotate(90deg) scale(0.7);
}
.vwa-btn.is-open .vwa-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
.vwa-btn.is-open .vwa-btn-inner {
  background: var(--vwa-dark);
}

/* Notification dot */
.vwa-notification-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--vwa-accent);
  border: 2.5px solid white;
  z-index: 5;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.vwa-btn.is-open .vwa-notification-dot {
  opacity: 0;
  transform: scale(0);
}

/* ── PULSE RINGS (organic effect from the landing) ────────────── */
.vwa-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  border-radius: 50%;
  border: 2px solid var(--vwa-theme);
  opacity: 0;
  pointer-events: none;
}

/* ── Style: Pulse Organic (matches landing heart pulse) ────────── */
.vwa-btn--pulse-organic .vwa-ring-1 {
  width: calc(var(--vwa-size) + 20px);
  height: calc(var(--vwa-size) + 20px);
  animation: vwa-pulse-organic 2.8s ease-out infinite 0s;
}
.vwa-btn--pulse-organic .vwa-ring-2 {
  width: calc(var(--vwa-size) + 44px);
  height: calc(var(--vwa-size) + 44px);
  animation: vwa-pulse-organic 2.8s ease-out infinite 0.7s;
  border-color: var(--vwa-theme);
  opacity: 0;
}
.vwa-btn--pulse-organic .vwa-ring-3 {
  width: calc(var(--vwa-size) + 72px);
  height: calc(var(--vwa-size) + 72px);
  animation: vwa-pulse-organic 2.8s ease-out infinite 1.4s;
  border-color: var(--vwa-theme);
  opacity: 0;
}

@keyframes vwa-pulse-organic {
  0%   { transform: translate(-50%,-50%) scale(0.9); opacity: 0.8; }
  70%  { transform: translate(-50%,-50%) scale(1.35); opacity: 0.2; }
  100% { transform: translate(-50%,-50%) scale(1.5);  opacity: 0;   }
}

/* ── Style: Pulse Ring (solid ring grows) ─────────────────────── */
.vwa-btn--pulse-ring .vwa-ring-1 {
  width: calc(var(--vwa-size) + 24px);
  height: calc(var(--vwa-size) + 24px);
  border-width: 3px;
  animation: vwa-pulse-ring 2s ease-out infinite 0s;
}
.vwa-btn--pulse-ring .vwa-ring-2 {
  width: calc(var(--vwa-size) + 48px);
  height: calc(var(--vwa-size) + 48px);
  border-width: 2px;
  animation: vwa-pulse-ring 2s ease-out infinite 0.5s;
  opacity: 0;
}
.vwa-btn--pulse-ring .vwa-ring-3 { display: none; }

@keyframes vwa-pulse-ring {
  0%   { transform: translate(-50%,-50%) scale(1);    opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1.45); opacity: 0; }
}

/* ── Style: Minimal ───────────────────────────────────────────── */
.vwa-btn--minimal .vwa-ring { display: none; }

/* Stop pulse when open */
.vwa-btn.is-open .vwa-ring { animation-play-state: paused; opacity: 0 !important; }

/* ── Entrance animation ──────────────────────────────────────── */
.vwa-btn {
  animation: vwa-entrance 0.6s var(--vwa-ease) both;
}
@keyframes vwa-entrance {
  from { transform: scale(0) rotate(-180deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

/* ── Chat Bubble ─────────────────────────────────────────────── */
.vwa-bubble {
  pointer-events: all;
  width: 340px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 72px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  transform-origin: bottom right;
  transition: opacity 0.4s ease,
              transform 0.5s var(--vwa-ease);
  background: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#vwa-root[data-position="bottom-left"] .vwa-bubble {
  transform-origin: bottom left;
}

.vwa-bubble.vwa-hidden {
  opacity: 0;
  transform: scale(0.7) translateY(20px);
  pointer-events: none;
}
.vwa-bubble.vwa-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Bubble Header */
.vwa-bubble-header {
  background: var(--vwa-theme);
  padding: 20px 20px 20px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.vwa-agent-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}
.vwa-agent-avatar svg {
  width: 26px; height: 26px;
}

.vwa-agent-info { flex: 1; min-width: 0; }
.vwa-agent-name {
  font-size: 15px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vwa-agent-status {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  gap: 6px;
}
.vwa-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: vwa-blink 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes vwa-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.vwa-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.2s;
  flex-shrink: 0;
}
.vwa-close-btn svg { width: 14px; height: 14px; }
.vwa-close-btn:hover { background: rgba(255,255,255,0.25); }

/* Bubble Body */
.vwa-bubble-body {
  padding: 24px 20px 20px;
  background: #f0f2f5;
}

.vwa-chat-area {
  margin-bottom: 20px;
}

.vwa-message-wrap {
  display: inline-block;
  max-width: 85%;
  animation: vwa-msg-in 0.5s var(--vwa-ease) both 0.2s;
}
@keyframes vwa-msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.vwa-message {
  background: white;
  border-radius: 0 16px 16px 16px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid #eee;
  position: relative;
}
.vwa-message::before {
  content: '';
  position: absolute;
  top: 0; left: -8px;
  border: 8px solid transparent;
  border-right-color: white;
  border-top-color: white;
}

.vwa-time {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
  margin-left: 4px;
}

/* Start Button */
.vwa-start-btn {
  width: 100%;
  background: var(--vwa-theme);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 15px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.02em;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s;
  box-shadow: 0 6px 20px rgba(61,92,66,0.35);
  font-family: inherit;
}
.vwa-start-btn:hover {
  background: #2D4A32;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(61,92,66,0.45);
}
.vwa-start-btn:active { transform: scale(0.98); }

/* ── Utility ─────────────────────────────────────────────────── */
.vwa-hidden { display: none; }
.vwa-hidden.vwa-animating { display: block; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .vwa-bubble { width: calc(100vw - 32px); }
  #vwa-root[data-position="bottom-right"] { right: 16px; bottom: 16px; }
  #vwa-root[data-position="bottom-left"]  { left: 16px;  bottom: 16px; }
}

/* ── Accessibility ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .vwa-ring { animation: none !important; }
  .vwa-bubble { transition: opacity 0.2s ease !important; }
  .vwa-btn { animation: none !important; }
}

/* ── Desktop/Mobile visibility ──────────────────────────────── */
.vwa-hide-desktop { display: none !important; }
.vwa-hide-mobile  {}

@media (max-width: 768px) {
  .vwa-hide-mobile  { display: none !important; }
  .vwa-hide-desktop { display: block !important; }
  #vwa-root.vwa-hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  #vwa-root.vwa-hide-desktop { display: none !important; }
}
