/* ═══════════════════════════════════════════════════════════════
   WallpaperZA — WhatsApp Concierge Widget
   "Alabaster & Liquid Gold" theme · Glassmorphic · Anti-ban
   Re-skin by overriding the --wac-* custom properties on .wac
   ═══════════════════════════════════════════════════════════════ */

.wac, .wac * { box-sizing: border-box; }
.wac button { font: inherit; }

.wac {
  /* ─── Theme tokens — inherit the host's Liquid-Gold aura, with fallbacks ─── */
  --wac-gold:         var(--gold-24k, #C4A030);
  --wac-gold-soft:    var(--gold-champagne, #B89A3E);
  --wac-gold-deep:    var(--gold-deep, #7A5D10);
  --wac-gold-grad:    var(--gradient-gold, linear-gradient(135deg, #B89A3E 0%, #C4A030 45%, #A07048 100%));
  --wac-ink:          var(--charcoal-soft, #181412);   /* primary text */
  --wac-ink-soft:     var(--stone, #2F2A26);           /* secondary text */
  --wac-cream:        var(--cream, #FFFDF5);            /* light text on dark header */
  --wac-glass:        rgba(255, 253, 247, 0.88);        /* frosted cream surface */
  --wac-field:        #FFFFFF;                          /* input background */
  --wac-border:       rgba(196, 160, 48, 0.30);
  --wac-header:       linear-gradient(135deg, #181412 0%, #2A2522 100%);
  --wac-danger:       #B00020;
  --wac-radius:       22px;
  --wac-shadow:       0 26px 70px rgba(31, 27, 26, 0.28);
  --wac-font:         var(--font-body, "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif);
  --wac-ease:         cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  right: clamp(14px, 4vw, 28px);
  bottom: clamp(14px, 4vw, 28px);
  z-index: 9999;
  font-family: var(--wac-font);
  -webkit-font-smoothing: antialiased;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* Yield to full-screen surfaces — the cart drawer, mobile menu, product modal,
   and the live PayFast payment modal — so the widget is never in the way. */
body.cart-open .wac,
body.nav-open .wac,
body.modal-open .wac,
body.payment-active .wac {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ═══════════════════════════════
   LAUNCHER (Floating Action Button)
   ═══════════════════════════════ */
.wac__launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-left: auto;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--charcoal, #0E0E0E);            /* dark glyph on gold */
  background: var(--wac-gold-grad);
  box-shadow: 0 12px 30px rgba(122, 93, 16, 0.40);
  transition: transform 0.35s var(--wac-ease), box-shadow 0.35s var(--wac-ease);
  animation: wac-pulse 2.8s ease-out infinite;
}
.wac__launcher:hover { transform: scale(1.06); }
.wac__launcher:active { transform: scale(0.96); }
.wac__launcher:focus-visible { outline: 2px solid var(--wac-gold); outline-offset: 3px; }
.wac__launcher svg { width: 32px; height: 32px; display: block; }

/* High-end gold radial pulse — soft expanding ring, no harsh flashing */
@keyframes wac-pulse {
  0%   { box-shadow: 0 12px 30px rgba(122, 93, 16, 0.40), 0 0 0 0 rgba(196, 160, 48, 0.45); }
  70%  { box-shadow: 0 12px 30px rgba(122, 93, 16, 0.40), 0 0 0 18px rgba(196, 160, 48, 0); }
  100% { box-shadow: 0 12px 30px rgba(122, 93, 16, 0.40), 0 0 0 0 rgba(196, 160, 48, 0); }
}
.wac.is-open .wac__launcher { animation: none; }

/* ═══════════════════════════════
   CHAT CANVAS (Glassmorphic panel)
   ═══════════════════════════════ */
.wac__panel {
  position: absolute;
  right: 0;
  bottom: calc(60px + 16px);                  /* sit just above the launcher */
  width: min(360px, calc(100vw - 28px));
  max-height: min(580px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  background: var(--wac-glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--wac-border);
  border-radius: var(--wac-radius);
  box-shadow: var(--wac-shadow);
  color: var(--wac-ink);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.32s var(--wac-ease), transform 0.32s var(--wac-ease);
}
.wac.is-open .wac__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header — deep charcoal bar with gold accents */
.wac__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--wac-header);
  color: var(--wac-cream);
  border-bottom: 1px solid rgba(196, 160, 48, 0.35);
  flex: 0 0 auto;
}
.wac__avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--charcoal, #0E0E0E);
  background: var(--wac-gold-grad);
  box-shadow: 0 2px 10px rgba(122, 93, 16, 0.45);
}
.wac__avatar svg { width: 22px; height: 22px; }
.wac__title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.wac__title strong {
  font-family: var(--font-display, "Cormorant Garamond", serif);
  font-size: 18px; font-weight: 700; letter-spacing: 0.02em; color: var(--wac-cream);
}
.wac__status { font-size: 12px; color: rgba(255, 253, 247, 0.78); display: flex; align-items: center; gap: 6px; }
.wac__status::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--wac-gold);
  box-shadow: 0 0 0 0 rgba(196, 160, 48, 0.7);
  animation: wac-dot 1.8s ease-out infinite;
}
@keyframes wac-dot { 0%{box-shadow:0 0 0 0 rgba(196,160,48,0.6);} 70%{box-shadow:0 0 0 6px rgba(196,160,48,0);} 100%{box-shadow:0 0 0 0 rgba(196,160,48,0);} }
.wac__close {
  margin-left: auto;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: rgba(255, 253, 247, 0.14);
  color: var(--wac-cream); cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}
.wac__close:hover { background: rgba(196, 160, 48, 0.45); transform: rotate(90deg); }
.wac__close:focus-visible { outline: 2px solid var(--wac-gold); outline-offset: 2px; }
.wac__close svg { width: 16px; height: 16px; }

/* Scrollable body */
.wac__intro {
  padding: 16px 18px 4px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--wac-ink-soft);
}
.wac__intro b { color: var(--wac-ink); font-weight: 600; }

/* Form */
.wac__form { padding: 12px 18px 18px; display: flex; flex-direction: column; gap: 13px; overflow-y: auto; }
.wac__field { display: flex; flex-direction: column; gap: 6px; }
.wac__label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--wac-ink-soft);
}
.wac__input,
.wac__textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 14px;
  color: var(--wac-ink);
  background: var(--wac-field);
  border: 1px solid var(--wac-border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.wac__input::placeholder,
.wac__textarea::placeholder { color: rgba(42, 37, 34, 0.45); }
.wac__input:focus,
.wac__textarea:focus {
  border-color: var(--wac-gold);
  box-shadow: 0 0 0 3px rgba(196, 160, 48, 0.20);
}
.wac__textarea {
  resize: none;
  min-height: 48px;
  max-height: 140px;
  line-height: 1.5;
  overflow-y: auto;
}

/* Elegant validation ring (no browser alerts) */
.wac__field.is-invalid .wac__input,
.wac__field.is-invalid .wac__textarea {
  border-color: var(--wac-danger);
  box-shadow: 0 0 0 3px rgba(176, 0, 32, 0.18);
  animation: wac-shake 0.4s ease;
}
.wac__error {
  font-size: 11.5px; font-weight: 600;
  color: var(--wac-danger);
  height: 0; opacity: 0; overflow: hidden;
  transition: opacity 0.2s ease;
}
.wac__field.is-invalid .wac__error { height: auto; opacity: 1; }
@keyframes wac-shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }

/* Magnetic gold CTA */
.wac__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 4px;
  padding: 13px 18px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--charcoal, #0E0E0E);             /* dark text on gold = high contrast */
  cursor: pointer;
  border: none;
  border-radius: 14px;
  background: var(--wac-gold-grad);
  box-shadow: 0 10px 26px rgba(122, 93, 16, 0.38);
  transition: transform 0.3s var(--wac-ease), box-shadow 0.3s var(--wac-ease), filter 0.3s ease;
}
.wac__cta:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(122, 93, 16, 0.5); filter: brightness(1.06); }
.wac__cta:active { transform: translateY(0) scale(0.99); }
.wac__cta:focus-visible { outline: 2px solid var(--wac-ink); outline-offset: 2px; }
.wac__cta svg { width: 18px; height: 18px; }

.wac__footnote {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 18px 14px;
  font-size: 10.5px;
  text-align: center;
  color: rgba(47, 42, 38, 0.6);
}

/* ─── Mobile optimisation ─── */
@media (max-width: 480px) {
  .wac { right: 14px; bottom: 14px; }
  .wac__panel {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 96px);
  }
  .wac__launcher { width: 56px; height: 56px; }
  .wac__panel { bottom: calc(56px + 14px); }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .wac__launcher, .wac__status::before { animation: none; }
  .wac__panel, .wac__cta, .wac__launcher, .wac__close { transition: none; }
}
