/* ==========================================================================
   YOVEL BOUTIQUE SPA — Floating WhatsApp concierge widget
   Self-contained: every selector is scoped under .yvwa, nothing else on the
   page is touched. Colors / fonts mirror the site's theme tokens.
   ========================================================================== */

.yvwa {
  --yvwa-green: #25d366;
  --yvwa-charcoal: var(--color-charcoal, #171714);
  --yvwa-espresso: var(--color-espresso-deep, #241e18);
  --yvwa-gold: var(--color-gold, #c4a268);
  --yvwa-gold-soft: var(--color-gold-soft, #e0c99a);
  --yvwa-gold-deep: var(--color-gold-deep, #7c6140);
  --yvwa-ivory: var(--color-ivory, #f8f4ed);
  --yvwa-sand: var(--color-sand, #e9ddcb);
  --yvwa-ink: var(--color-ink, #2a2620);
  --yvwa-muted: var(--color-muted, #5f564b);
  --yvwa-ui: var(--font-ui, "Heebo", "Assistant", system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
  --yvwa-sans: var(--font-sans, "Assistant", "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
  --yvwa-display: var(--font-display, "Frank Ruhl Libre", "David Libre", Georgia, serif);
  --yvwa-ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --yvwa-size: 60px;
  --yvwa-edge: 24px;

  position: fixed;
  z-index: 48; /* above page content, below header (50), gallery (60), skip-link (100) */
  right: calc(env(safe-area-inset-right, 0px) + var(--yvwa-edge));
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--yvwa-edge));
  width: var(--yvwa-size);
  height: var(--yvwa-size);
  direction: rtl;
  font-family: var(--yvwa-ui);
  pointer-events: none; /* only the visible parts below catch clicks */
  /* --yvwa-lift: set by the script to rise above a CTA that would sit underneath */
  transform: translate3d(0, calc(-1 * var(--yvwa-lift, 0px)), 0);
  transition:
    opacity 0.35s ease,
    visibility 0s linear 0s,
    transform 0.45s var(--yvwa-ease);
  -webkit-tap-highlight-color: transparent;
}

.yvwa *,
.yvwa *::before,
.yvwa *::after {
  box-sizing: border-box;
}

/* Dropping back past a CTA: fade out, reposition, fade back in */
.yvwa.is-hopping {
  opacity: 0;
  transition: opacity 0.15s ease, transform 0s linear 0.15s;
}

.yvwa.no-lift-anim {
  transition: none;
}

/* Hidden while a site overlay (mobile menu / gallery) locks the page */
.yvwa.is-suppressed {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

/* ---------- Floating button ---------- */

.yvwa-btn {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--yvwa-green);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 26px -8px rgba(37, 211, 102, 0.6),
    0 6px 16px -6px rgba(23, 23, 20, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.6);
  transition:
    opacity 0.6s var(--yvwa-ease),
    transform 0.7s var(--yvwa-ease),
    box-shadow 0.35s ease,
    visibility 0s linear 0.7s;
}

.yvwa.is-ready .yvwa-btn {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.6s var(--yvwa-ease),
    transform 0.7s var(--yvwa-ease),
    box-shadow 0.35s ease,
    visibility 0s;
}

@media (hover: hover) and (pointer: fine) {
  .yvwa.is-ready .yvwa-btn:hover {
    transform: scale(1.06);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.3),
      0 14px 32px -8px rgba(37, 211, 102, 0.7),
      0 8px 20px -8px rgba(23, 23, 20, 0.4);
  }
}

.yvwa.is-ready .yvwa-btn:active {
  transform: scale(0.97);
}

.yvwa-btn:focus-visible {
  outline: 3px solid var(--yvwa-gold-deep);
  outline-offset: 4px;
  box-shadow:
    0 0 0 4px #fff,
    0 10px 26px -8px rgba(37, 211, 102, 0.6);
}

/* glowing halo — soft green pulse + a quiet gold hairline ring */
.yvwa-halo,
.yvwa-halo::before,
.yvwa-halo::after {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.yvwa-halo {
  inset: 0;
  z-index: -1;
}

.yvwa-halo::before {
  content: "";
  inset: 0;
  background: radial-gradient(circle, rgba(37, 211, 102, 0.5) 0%, rgba(37, 211, 102, 0.22) 60%, rgba(37, 211, 102, 0) 72%);
  opacity: 0;
}

.yvwa-halo::after {
  content: "";
  inset: -6px;
  border: 1px solid rgba(196, 162, 104, 0.55);
  opacity: 0.55;
}

.yvwa.is-ready .yvwa-halo::before {
  animation: yvwa-pulse 4.2s cubic-bezier(0.2, 0.6, 0.3, 1) 0.8s infinite;
}

.yvwa.is-ready .yvwa-halo::after {
  animation: yvwa-ring 4.2s ease-in-out 0.8s infinite;
}

.yvwa.is-open .yvwa-halo::before,
.yvwa.is-open .yvwa-halo::after {
  animation-play-state: paused;
  opacity: 0;
  transition: opacity 0.3s ease;
}

@keyframes yvwa-pulse {
  0% { transform: scale(0.95); opacity: 0.75; }
  55% { transform: scale(1.75); opacity: 0; }
  100% { transform: scale(1.75); opacity: 0; }
}

@keyframes yvwa-ring {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.04); opacity: 0.8; }
}

/* icon swap: WhatsApp glyph <-> close */
.yvwa-btn svg {
  grid-area: 1 / 1;
  display: block;
  transition: opacity 0.3s ease, transform 0.45s var(--yvwa-ease);
}

.yvwa-ic-wa {
  width: 31px;
  height: 31px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.yvwa-ic-x {
  width: 22px;
  height: 22px;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.yvwa.is-open .yvwa-ic-wa {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.yvwa.is-open .yvwa-ic-x {
  opacity: 1;
  transform: none;
}

/* ---------- Tooltip ---------- */

.yvwa-tip {
  position: absolute;
  top: 50%;
  right: calc(100% + 14px);
  margin: 0;
  padding: 10px 18px 11px;
  max-width: calc(100vw - var(--yvwa-size) - var(--yvwa-edge) - 30px);
  border: 1px solid rgba(196, 162, 104, 0.5);
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdf9 0%, var(--yvwa-ivory) 100%);
  color: var(--yvwa-ink);
  font-family: var(--yvwa-ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  letter-spacing: 0.01em;
  box-shadow:
    0 12px 30px -12px rgba(23, 23, 20, 0.35),
    0 2px 6px -2px rgba(23, 23, 20, 0.12);
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(10px, -50%) scale(0.92);
  transform-origin: 100% 50%;
  transition:
    opacity 0.45s ease,
    transform 0.55s var(--yvwa-ease),
    visibility 0s linear 0.55s;
}

.yvwa-tip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  background: var(--yvwa-ivory);
  border-top: 1px solid rgba(196, 162, 104, 0.5);
  border-right: 1px solid rgba(196, 162, 104, 0.5);
  transform: rotate(45deg);
  border-radius: 0 2px 0 0;
}

.yvwa.show-tip .yvwa-tip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(0, -50%);
  transition:
    opacity 0.5s ease,
    transform 0.65s var(--yvwa-ease),
    visibility 0s;
}

/* ---------- Chat preview panel ---------- */

.yvwa-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 16px);
  width: min(360px, calc(100vw - 2 * var(--yvwa-edge) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-height: calc(100vh - var(--yvwa-size) - var(--yvwa-edge) - env(safe-area-inset-bottom, 0px) - var(--yvwa-lift, 0px) - 96px);
  max-height: calc(100dvh - var(--yvwa-size) - var(--yvwa-edge) - env(safe-area-inset-bottom, 0px) - var(--yvwa-lift, 0px) - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(196, 162, 104, 0.38);
  border-radius: 22px;
  background: var(--yvwa-ivory);
  box-shadow:
    0 28px 70px -22px rgba(23, 23, 20, 0.55),
    0 10px 24px -12px rgba(23, 23, 20, 0.3);
  text-align: right;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.94);
  transform-origin: calc(100% - 30px) 100%;
  transition:
    opacity 0.32s ease,
    transform 0.42s var(--yvwa-ease),
    visibility 0s linear 0.42s;
}

.yvwa.is-open .yvwa-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.45s ease,
    transform 0.6s var(--yvwa-ease),
    visibility 0s;
}

.yvwa-panel:focus {
  outline: none;
}

.yvwa-panel:focus-visible {
  outline: 3px solid var(--yvwa-gold-deep);
  outline-offset: 3px;
}

/* header */
.yvwa-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 16px 14px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(196, 162, 104, 0.16) 0%, rgba(196, 162, 104, 0) 55%),
    linear-gradient(160deg, var(--yvwa-espresso) 0%, var(--yvwa-charcoal) 72%);
  color: var(--yvwa-ivory);
}

.yvwa-head::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(196, 162, 104, 0) 0%, rgba(196, 162, 104, 0.75) 50%, rgba(196, 162, 104, 0) 100%);
}

.yvwa-logo {
  flex: none;
  display: block;
  width: 74px;
  height: 51px;
}

.yvwa-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.yvwa-id {
  flex: 1 1 auto;
  min-width: 0;
}

.yvwa-name {
  margin: 0;
  font-family: var(--yvwa-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--yvwa-ivory);
  letter-spacing: 0.005em;
}

.yvwa-sub {
  margin: 4px 0 0;
  font-family: var(--yvwa-ui);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--yvwa-gold-soft);
}

.yvwa-close {
  flex: none;
  align-self: flex-start;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -4px 0 0;
  padding: 0;
  border: 1px solid rgba(196, 162, 104, 0.35);
  border-radius: 50%;
  background: rgba(248, 244, 237, 0.04);
  color: var(--yvwa-sand);
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.35s var(--yvwa-ease);
}

.yvwa-close svg {
  width: 16px;
  height: 16px;
}

@media (hover: hover) and (pointer: fine) {
  .yvwa-close:hover {
    background: rgba(196, 162, 104, 0.16);
    border-color: rgba(196, 162, 104, 0.7);
    color: #fff;
    transform: rotate(90deg);
  }
}

.yvwa-close:focus-visible {
  outline: 2px solid var(--yvwa-gold-soft);
  outline-offset: 2px;
}

/* conversation area */
.yvwa-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 18px 10px;
  background:
    radial-gradient(90% 70% at 0% 100%, rgba(196, 162, 104, 0.1) 0%, rgba(196, 162, 104, 0) 60%),
    radial-gradient(70% 60% at 100% 0%, rgba(233, 221, 203, 0.7) 0%, rgba(233, 221, 203, 0) 70%),
    var(--yvwa-ivory);
}

.yvwa-msg-wrap {
  position: relative;
  min-height: 46px;
}

.yvwa-typing {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid rgba(196, 162, 104, 0.28);
  border-radius: 18px 4px 18px 18px;
  background: #fff;
  box-shadow: 0 6px 16px -10px rgba(23, 23, 20, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.yvwa-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yvwa-gold);
  animation: yvwa-dot 1.1s ease-in-out infinite;
}

.yvwa-typing span:nth-child(2) { animation-delay: 0.15s; }
.yvwa-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes yvwa-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.yvwa.is-typing .yvwa-typing {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0s;
}

.yvwa-bubble {
  position: relative;
  max-width: 94%;
  margin: 0;
  padding: 14px 16px 15px;
  border: 1px solid rgba(196, 162, 104, 0.28);
  border-radius: 18px 4px 18px 18px;
  background: #fff;
  color: var(--yvwa-ink);
  font-family: var(--yvwa-sans);
  font-size: 16px;
  line-height: 1.65;
  box-shadow: 0 8px 20px -12px rgba(23, 23, 20, 0.28);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s ease, transform 0.55s var(--yvwa-ease);
}

.yvwa.has-msg .yvwa-bubble {
  opacity: 1;
  transform: none;
}

.yvwa-bubble p {
  margin: 0;
}

.yvwa-bubble p + p {
  margin-top: 4px;
}

.yvwa-bubble .yvwa-hello {
  font-family: var(--yvwa-display);
  font-size: 17.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--yvwa-charcoal);
}

/* footer / CTA */
.yvwa-foot {
  flex: none;
  padding: 12px 18px 18px;
  background: var(--yvwa-ivory);
}

.yvwa-cta {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 52px;
  padding: 10px 20px;
  overflow: hidden;
  border: 1px solid rgba(196, 162, 104, 0.55);
  border-radius: 999px;
  background: linear-gradient(160deg, var(--yvwa-espresso) 0%, var(--yvwa-charcoal) 80%);
  color: var(--yvwa-ivory);
  font-family: var(--yvwa-ui);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 10px 24px -14px rgba(23, 23, 20, 0.6);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.35s var(--yvwa-ease);
}

/* a slow gold sheen that sweeps across on hover */
.yvwa-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, rgba(224, 201, 154, 0) 30%, rgba(224, 201, 154, 0.22) 50%, rgba(224, 201, 154, 0) 70%);
  transform: translateX(110%);
  transition: transform 0.9s var(--yvwa-ease);
}

@media (hover: hover) and (pointer: fine) {
  .yvwa-cta:hover {
    border-color: var(--yvwa-gold);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -14px rgba(23, 23, 20, 0.7);
  }
  .yvwa-cta:hover::before {
    transform: translateX(-110%);
  }
}

.yvwa-cta:active {
  transform: translateY(0) scale(0.99);
}

.yvwa-cta:focus-visible {
  outline: 3px solid var(--yvwa-gold-deep);
  outline-offset: 3px;
}

.yvwa-cta-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--yvwa-green);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.16);
}

.yvwa-cta-ic svg {
  width: 17px;
  height: 17px;
  display: block;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
  .yvwa {
    --yvwa-size: 56px;
    --yvwa-edge: 16px;
  }
  .yvwa-ic-wa {
    width: 29px;
    height: 29px;
  }
  .yvwa-tip {
    font-size: 14.5px;
    padding: 9px 16px 10px;
  }
  .yvwa-panel {
    border-radius: 20px;
    bottom: calc(100% + 14px);
  }
  .yvwa-head {
    padding: 14px 16px 14px 12px;
    gap: 12px;
  }
  .yvwa-logo {
    width: 66px;
    height: 45px;
  }
  .yvwa-name {
    font-size: 18.5px;
  }
  .yvwa-body {
    padding: 18px 16px 8px;
  }
  .yvwa-bubble {
    font-size: 15.5px;
  }
  .yvwa-foot {
    padding: 10px 16px 16px;
  }
}

/* No room to rise above a CTA (e.g. full-width booking submit) — step aside briefly */
.yvwa.is-tucked:not(.is-open) .yvwa-btn {
  opacity: 0;
  visibility: hidden;
  transform: translateY(calc(100% + 24px)) scale(0.85);
  transition:
    opacity 0.35s ease,
    transform 0.45s var(--yvwa-ease),
    visibility 0s linear 0.45s;
}

.yvwa.is-tucked:not(.is-open) .yvwa-tip {
  opacity: 0;
  visibility: hidden;
}

/* ---------- Reduced motion: no pulse, no movement — gentle fades only ---------- */

@media (prefers-reduced-motion: reduce) {
  .yvwa-halo::before,
  .yvwa-halo::after,
  .yvwa-typing span {
    animation: none !important;
  }
  .yvwa-halo::after {
    opacity: 0.6;
  }
  /* hidden states: fade out, then drop visibility */
  .yvwa .yvwa-btn,
  .yvwa .yvwa-tip,
  .yvwa .yvwa-panel,
  .yvwa .yvwa-bubble,
  .yvwa .yvwa-btn svg,
  .yvwa.is-tucked:not(.is-open) .yvwa-btn {
    transform: none !important;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s !important;
  }
  /* shown states */
  .yvwa.is-ready .yvwa-btn,
  .yvwa.show-tip .yvwa-tip,
  .yvwa.is-open .yvwa-panel,
  .yvwa.has-msg .yvwa-bubble {
    transform: none !important;
    transition: opacity 0.2s ease, visibility 0s !important;
  }
  .yvwa .yvwa-tip,
  .yvwa.show-tip .yvwa-tip {
    transform: translateY(-50%) !important;
  }
  .yvwa {
    transition: opacity 0.2s ease, visibility 0s, transform 0s !important;
  }
  .yvwa-close,
  .yvwa-cta,
  .yvwa-cta::before {
    transition: none !important;
    transform: none !important;
  }
}

@media print {
  .yvwa {
    display: none !important;
  }
}

/* QA fix 2026-11-16: reveal the chat bubble with keyframe animations that reproduce the
   original transition exactly (opacity .45s ease + 6px rise .55s). Chrome does not record a
   keyframe fade-in as Largest Contentful Paint, so an idle mobile visitor's LCP stays at the
   logo (~0.3s) instead of jumping to ~11.8s when the auto-preview opens. Pixel-identical result. */
@keyframes yvwaBubbleFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes yvwaBubbleRise { from { transform: translateY(6px); } to { transform: none; } }
.yvwa.has-msg .yvwa-bubble {
  animation: yvwaBubbleFade 0.45s ease both, yvwaBubbleRise 0.55s var(--yvwa-ease) both;
}
@media (prefers-reduced-motion: reduce) {
  .yvwa.has-msg .yvwa-bubble { animation: none; }
}
