/* ==========================================================================
   Zara — Future Host assistant
   1. The character in the homepage hero   2. The chat button and Zara's animated photo   3. The chat window
   Sizes for the hero character come from app/zara-character.json (--zw, --zh ...).
   ========================================================================== */

/* ---------- 1. Hero character ---------- */
.hero.has-zara { padding-bottom: 0; }
.hero.has-zara .hero-grid { align-items: stretch; }
.hero.has-zara .hero-content { align-self: center; padding-bottom: 70px; }

.zara-hero {
  position: relative; align-self: end; justify-self: end;
  width: var(--zw, min(48vw, 680px)); max-width: 100%;
  display: flex; justify-content: center; align-items: flex-end;
}
/* The figure is exactly the picture's shape (2:3), so the moving parts line up with the photo at every size.
   .zh-fig breathes and sways, .zh-par follows the pointer with subtle natural parallax, and zara.js draws the living head on top (.zh-face). */
.zh-fig {
  position: relative; z-index: 1; flex: none;
  width: min(100%, calc(var(--zh, 90vh) * .66667)); aspect-ratio: 1024 / 1536;
  transform-origin: 50% 100%; animation: zh-float 6.5s ease-in-out infinite;
}
.zh-par {
  position: absolute; inset: 0;
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0);
  transition: transform .3s ease-out;
}
.zara-hero picture { display: block; width: 100%; height: 100%; line-height: 0; }
.zh-img {
  display: block; width: 100%; height: 100%;
  object-fit: var(--zfit, contain); object-position: var(--zpos, center bottom);
  -webkit-user-drag: none; user-select: none;
}
/* once the living head is drawn (zara.js, .zh-face), the still picture keeps the body only: a soft join across the neck and hair */
.zh-rig picture .zh-img { -webkit-mask-image: linear-gradient(to bottom, transparent 32.500%, #000 35.200%); mask-image: linear-gradient(to bottom, transparent 32.500%, #000 35.200%); }
.zface.zh-face { position: absolute; left: 11.719%; top: 0; width: 76.563%; height: 41.667%; pointer-events: none; z-index: 3; }   /* the head-and-hair part of the photo */
/* light behind her, so the dark jacket reads against the dark page */
.zh-glow {
  position: absolute; z-index: 0; inset: 4% -6% 0; pointer-events: none;
  background:
    radial-gradient(46% 38% at 50% 34%, rgba(255, 56, 116, .34), transparent 72%),
    radial-gradient(58% 46% at 50% 74%, rgba(58, 96, 160, .42), transparent 76%);
  filter: blur(6px);
}
.zh-ring {
  position: absolute; z-index: 0; left: 50%; top: 12%; width: 82%; aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .09); pointer-events: none;
  box-shadow: inset 0 0 80px rgba(255, 56, 116, .08);
}
/* she fades into the page instead of ending on a hard edge */
.zara-hero::after {
  content: ""; position: absolute; z-index: 2; left: -12%; right: -12%; bottom: -1px; height: 16%;
  background: linear-gradient(to top, #000 4%, rgba(0, 0, 0, 0)); pointer-events: none;
}

.zh-bubble {
  position: absolute; z-index: 3; left: -4%; bottom: 20%;
  width: min(270px, 62%); padding: 14px 16px 13px; text-align: start;
  display: flex; flex-direction: column; gap: 6px;
  font: inherit; color: #fff; cursor: pointer;
  background: rgba(12, 12, 15, .78); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 20px 20px 20px 6px;
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 56, 116, .08);
  transition: transform .35s cubic-bezier(.2, .7, .1, 1), border-color .3s, box-shadow .3s;
}
.zh-bubble:hover, .zh-bubble:focus-visible { transform: translateY(-3px); border-color: rgba(255, 56, 116, .6); box-shadow: 0 22px 60px -18px rgba(255, 56, 116, .45); outline: none; }
.zh-who { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: rgba(255, 255, 255, .72); letter-spacing: .01em; }
.zh-who b { color: #fff; font-weight: 700; }
.zh-voice-pill {
  display: inline-flex; align-items: center; justify-content: center;
  margin-inline-start: auto; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255, 56, 116, .2); color: #ff5c8d; border: 1px solid rgba(255, 56, 116, .45);
  cursor: pointer; transition: background .2s, transform .2s, color .2s; flex: none;
}
.zh-voice-pill:hover { background: rgba(255, 56, 116, .5); transform: scale(1.15); color: #fff; }
.zh-voice-pill.is-speaking { background: #FF3874; color: #fff; animation: zp-speak 1.3s infinite; }
@keyframes zp-speak { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 56, 116, .6); } 50% { box-shadow: 0 0 0 7px rgba(255, 56, 116, 0); } }
.zh-dot, .zl-dot { width: 9px; height: 9px; border-radius: 50%; background: #2fd772; box-shadow: 0 0 0 0 rgba(47, 215, 114, .6); animation: zara-pulse 2.4s ease-out infinite; flex: none; }
.zh-text { font-size: 15px; line-height: 1.45; font-weight: 500; }
.zh-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13.5px; font-weight: 700; color: #ff5c8d; }
[dir="rtl"] .zh-bubble { left: auto; right: -4%; border-radius: 20px 20px 6px 20px; }
[dir="rtl"] .zh-cta svg, [dir="rtl"] .zf-send svg { transform: scaleX(-1); }

@keyframes zh-float {
  0%, 100% { transform: translateY(0) rotate(-.45deg) scale(1); }
  50% { transform: translateY(-7px) rotate(.45deg) scale(1.012); }
}
@keyframes zara-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 215, 114, .55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(47, 215, 114, 0); } }

@media (max-width: 1024px) {
  .hero.has-zara .hero-content { padding-bottom: 0; }
  .hero-visual.zara-hero { order: 0; justify-self: center; width: var(--zw-t, min(58vw, 540px)); max-width: 100%; margin: 26px auto 0; }
  .zh-fig { width: min(100%, calc(var(--zh-t, 70vh) * .66667)); }
  .zh-par { transform: none; }
  .zh-bubble { left: -10%; bottom: 16%; }
  [dir="rtl"] .zh-bubble { left: auto; right: -10%; }
}
@media (max-width: 767px) {
  .hero-visual.zara-hero { width: var(--zw-m, min(90vw, 420px)); margin-top: 18px; }
  .zh-fig { width: min(100%, calc(var(--zh-m, 56vh) * .66667)); }
  .zh-bubble, [dir="rtl"] .zh-bubble { left: 50%; right: auto; bottom: 18px; width: min(94%, 330px); transform: translateX(-50%); border-radius: 18px; }
  .zh-bubble:hover, .zh-bubble:focus-visible { transform: translateX(-50%) translateY(-2px); }
  .zh-text { font-size: 14.5px; }
  .zara-hero::after { height: 22%; }
}

/* ---------- 2. Chat button ----------
   Side and height come from Admin -> Zara assistant -> Chat Button Position:
   .zara--right / .zara--left on the widget, --zb for the distance from the bottom,
   and data-chat-side on <html> so the WhatsApp and back-to-top buttons line up with it. */
.zara { font-family: var(--font, system-ui, sans-serif); }
.zara-launch {
  position: fixed; z-index: 90; right: 18px; bottom: var(--zb, 90px);
  width: 64px; height: 64px; padding: 0; display: block; border-radius: 50%; cursor: pointer; direction: ltr;
  background: #0D1927; border: 2px solid rgba(255, 56, 116, .8);
  box-shadow: 0 12px 34px -10px rgba(255, 56, 116, .6);
  transition: transform .3s ease-in-out, box-shadow .3s ease-in-out, opacity .25s ease-in-out;
}
.zara--left .zara-launch { right: auto; left: 18px; }
.zara-launch:hover, .zara-launch:focus-visible { transform: translateY(-2px); box-shadow: 0 16px 40px -10px rgba(255, 56, 116, .8); outline: none; }
.zl-face, .zp-face { display: block; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 38%, #27425f, #132337 60%, #0D1927); }
.zl-face { width: 100%; height: 100%; }
.zl-dot { position: absolute; right: 1px; bottom: 3px; width: 13px; height: 13px; border: 2px solid #0D1927; }
.zara--left .zl-dot { right: auto; left: 1px; }
.zl-label {
  position: absolute; top: 50%; right: calc(100% + 10px); transform: translateY(-50%) translateX(6px);
  padding: 8px 13px; white-space: nowrap; font-size: 13.5px; font-weight: 700; color: #fff;
  background: rgba(13, 25, 39, .96); border: 1px solid rgba(255, 56, 116, .5); border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease-in-out, transform .25s ease-in-out;
}
.zara--left .zl-label { right: auto; left: calc(100% + 10px); transform: translateY(-50%) translateX(-6px); }
@media (hover: hover) {
  .zara-launch:hover .zl-label, .zara-launch:focus-visible .zl-label { opacity: 1; transform: translateY(-50%); }
}
.zara.open .zara-launch { opacity: 0; pointer-events: none; transform: scale(.9); }

/* the WhatsApp button sits under the chat button on the same side; "back to top" moves to the other side */
html[data-chat-side="right"] .wa-float { right: 22px; left: auto; }
html[data-chat-side="left"] .wa-float { left: 22px; right: auto; }
html[data-chat-side="right"] .to-top { left: 26px; right: auto; }
html[data-chat-side="left"] .to-top { right: 26px; left: auto; }

.zara-tease {
  position: fixed; z-index: 90; right: 94px; bottom: calc(var(--zb, 90px) + 8px); max-width: 240px; padding: 12px 34px 12px 14px;
  font-size: 14px; line-height: 1.45; color: #fff; cursor: pointer;
  background: rgba(12, 12, 15, .94); border: 1px solid rgba(255, 255, 255, .16); border-radius: 16px 16px 5px 16px;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, .9); animation: zara-in .45s ease-in-out both;
}
.zara--left .zara-tease { right: auto; left: 94px; border-radius: 16px 16px 16px 5px; }
.zara-tease button { position: absolute; top: 4px; right: 6px; width: 26px; height: 26px; border: 0; background: none; color: rgba(255, 255, 255, .6); font-size: 18px; line-height: 1; cursor: pointer; }
.zara-tease[dir="rtl"] { padding: 12px 14px 12px 34px; }
.zara-tease[dir="rtl"] button { right: auto; left: 6px; }
.zara.open .zara-tease { display: none; }
.zara:has(.zara-tease) .zl-label { display: none; }   /* the nudge already says it */

/* ---------- Zara's face ----------
   zara.js draws her photo on a mesh with depth (the rig in zara-rig.json) into a <canvas class="zface">:
   blinking, gaze, talking, smiling and head turns all happen there. Until it is ready, the still photo shows. */
.zface { display: block; width: 100%; height: 100%; }
.zl-face img, .zp-face img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- 3. Chat window ---------- */
.zara-panel {
  position: fixed; z-index: 95; right: 18px; bottom: 24px;
  width: 390px; max-width: calc(100vw - 28px); height: min(640px, calc(100vh - 48px)); height: min(640px, calc(100dvh - 48px));
  display: flex; flex-direction: column; overflow: hidden;
  color: #fff; background: #0b0b0e; border: 1px solid rgba(255, 255, 255, .14); border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255, 56, 116, .1);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transform-origin: bottom right;
  transition: opacity .25s ease-in-out, transform .3s ease-in-out, visibility 0s .3s;
}
.zara--left .zara-panel { right: auto; left: 18px; transform-origin: bottom left; }
.zara.open .zara-panel { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.zp-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 14px; background: linear-gradient(135deg, #0D1927, #17101a 70%, #2a0d19); border-bottom: 1px solid rgba(255, 255, 255, .1); }
.zp-face { width: 64px; height: 64px; flex: none; border: 2px solid rgba(255, 56, 116, .75); }
.zp-id { flex: 1; min-width: 0; line-height: 1.25; }
.zp-id strong { display: block; font-size: 16px; }
.zp-id span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: rgba(255, 255, 255, .7); }
.zp-id .zh-dot { width: 7px; height: 7px; }
.zp-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .07); color: #fff; cursor: pointer; transition: background .2s, color .2s, transform .2s; }
.zp-btn:hover, .zp-btn:focus-visible { background: rgba(255, 255, 255, .16); outline: none; }
.zp-btn svg { width: 18px; height: 18px; }
.zp-btn.wa { color: #25D366; }
.zp-btn.zp-voice { color: rgba(255, 255, 255, .82); }
.zp-btn.zp-voice.is-muted { color: rgba(255, 255, 255, .32); }
.zp-btn.zp-voice.is-speaking { color: #ff5c8d; animation: zara-pulse 1.3s infinite; }

.zp-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
.zm { max-width: 86%; padding: 10px 13px; font-size: 14.5px; line-height: 1.5; border-radius: 16px; overflow-wrap: anywhere; animation: zara-in .3s cubic-bezier(.2, .7, .1, 1) both; }
.zm p { margin: 0; }
.zm p + p, .zm ul + p, .zm p + ul { margin-top: 7px; }
.zm ul { margin: 0; padding: 0; list-style: none; }
.zm li { position: relative; padding-inline-start: 16px; }
.zm li::before { content: ""; position: absolute; inset-inline-start: 3px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: #FF3874; }
.zm li + li { margin-top: 5px; }
.zm .zr-wait { display: none; }   /* lines Zara has not reached yet while she is "saying" a reply */
.zm a { color: #ff7aa0; text-decoration: underline; text-underline-offset: 2px; }
.zm a[dir="ltr"] { display: inline-block; max-width: 100%; }   /* a web address stays in one left-to-right piece inside Arabic text */
.zm.a { align-self: flex-start; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); border-end-start-radius: 5px; }
.zm.u { align-self: flex-end; background: linear-gradient(135deg, #FF3874, #d81e57); border-end-end-radius: 5px; }
.zm.typing { display: flex; gap: 5px; align-items: center; padding: 14px 15px; }
.zm.typing i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .65); animation: zara-dot 1.2s infinite ease-in-out; }
.zm.typing i:nth-child(2) { animation-delay: .15s; }
.zm.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes zara-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes zara-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.zp-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 14px 10px; }
.zp-chips button { padding: 7px 12px; font: inherit; font-size: 13px; color: #fff; cursor: pointer; background: transparent; border: 1px solid rgba(255, 56, 116, .55); border-radius: 999px; transition: background .2s; }
.zp-chips button:hover, .zp-chips button:focus-visible { background: rgba(255, 56, 116, .18); outline: none; }

.zf { align-self: stretch; display: grid; gap: 8px; padding: 13px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 56, 116, .35); border-radius: 16px; animation: zara-in .3s both; }
.zf strong { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.zf input { width: 100%; padding: 10px 12px; font: inherit; font-size: 14.5px; color: #fff; background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; }
.zf input:focus { outline: none; border-color: #FF3874; }
.zf input::placeholder, .zp-input textarea::placeholder { color: rgba(255, 255, 255, .45); }
.zf .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.zf button { padding: 11px 14px; font: inherit; font-size: 14.5px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(135deg, #FF3874, #d81e57); border: 0; border-radius: 999px; }
.zf button:disabled { opacity: .6; cursor: default; }
.zf small { font-size: 12.5px; color: #ff9db8; min-height: 0; }

.zp-input { position: relative; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .1); background: #0e0e12; }
.zp-input textarea { flex: 1; min-height: 44px; max-height: 110px; padding: 11px 14px; resize: none; font: inherit; font-size: 15px; line-height: 1.4; color: #fff; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 22px; }
.zp-input textarea:focus { outline: none; border-color: rgba(255, 56, 116, .8); }
.zf-mic {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .15); border-radius: 50%;
  color: rgba(255, 255, 255, .85); cursor: pointer; background: rgba(255, 255, 255, .08);
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s, color .2s;
}
.zf-mic:hover, .zf-mic:focus-visible {
  background: rgba(255, 56, 116, .22); border-color: rgba(255, 56, 116, .65);
  color: #fff; transform: scale(1.06); outline: none;
}
.zf-mic.is-recording {
  background: linear-gradient(135deg, #FF3874, #d81e57);
  border-color: #FF3874; color: #fff;
  box-shadow: 0 0 0 0 rgba(255, 56, 116, .7);
  animation: zf-mic-pulse 1.3s infinite ease-out;
}
.zf-mic svg { width: 19px; height: 19px; }
@keyframes zf-mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 56, 116, .7); transform: scale(1.05); }
  60% { box-shadow: 0 0 0 12px rgba(255, 56, 116, 0); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(255, 56, 116, 0); transform: scale(1.05); }
}
.zp-listening-bar {
  display: flex; align-items: center; justify-content: center; gap: 9px; padding: 7px 14px;
  background: rgba(255, 56, 116, .14); border-top: 1px solid rgba(255, 56, 116, .3);
  font-size: 12.5px; font-weight: 600; color: #ff9db8; animation: zara-in .25s ease-out;
}
.zp-listening-wave { display: inline-flex; align-items: center; gap: 3px; height: 14px; }
.zp-listening-wave span {
  display: block; width: 3px; height: 100%; border-radius: 999px;
  background: #ff5c8d; animation: zp-wave .75s ease-in-out infinite alternate;
}
.zp-listening-wave span:nth-child(2) { animation-delay: .18s; }
.zp-listening-wave span:nth-child(3) { animation-delay: .36s; }
.zp-listening-wave span:nth-child(4) { animation-delay: .54s; }
@keyframes zp-wave { from { height: 4px; } to { height: 14px; } }
.zf-send { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; cursor: pointer; background: linear-gradient(135deg, #FF3874, #d81e57); transition: transform .2s, opacity .2s; }
.zf-send:hover { transform: scale(1.05); }
.zf-send:disabled { opacity: .45; cursor: default; transform: none; }
.zf-send svg { width: 19px; height: 19px; }
.zp-note { margin: 0; padding: 0 14px 9px; font-size: 11px; line-height: 1.4; text-align: center; color: rgba(255, 255, 255, .42); background: #0e0e12; }

@media (max-width: 767px) {
  .zara-launch { width: 58px; height: 58px; right: 14px; bottom: calc(max(var(--zb, 90px), 78px) + env(safe-area-inset-bottom)); }   /* never lower than the bottom bar */
  .zara--left .zara-launch { right: auto; left: 14px; }
  .zl-label, .zara-tease { display: none; }
  html[data-chat-side="right"] .wa-float { right: 14px; }
  html[data-chat-side="left"] .wa-float { left: 14px; }
  html[data-chat-side="right"] .to-top { left: 16px; }
  html[data-chat-side="left"] .to-top { right: 16px; }
  .zara-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 115;
  }
  .zara.open .zara-backdrop {
    display: block;
    animation: zara-in .25s ease-out;
  }
  .zara-panel, .zara--left .zara-panel {
    inset: auto;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    max-width: 410px;
    margin: 0 auto;
    height: min(510px, calc(100dvh - 100px));
    height: min(510px, calc(100vh - 100px));
    max-height: calc(100dvh - 24px);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 22px;
    box-shadow: 0 25px 70px -10px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255, 56, 116, .25);
    z-index: 120;
    transform: translateY(16px) scale(.98);
  }
  .zara.open .zara-panel { transform: none; }
  .zp-head { padding: 10px 14px; }
  .zp-face { width: 48px; height: 48px; }
  .zp-id strong { font-size: 15px; }
  .zp-id span { font-size: 11.5px; }
  .zp-btn { width: 35px; height: 35px; }
  .zp-log { padding: 12px 12px 6px; gap: 8px; }
  .zm { font-size: 13.5px; padding: 8px 12px; }
  .zp-chips { padding: 4px 12px 6px; gap: 6px; }
  .zp-chips button { padding: 5px 11px; font-size: 12px; }
  .zp-input { padding: 8px 10px; gap: 6px; }
  .zp-input textarea, .zf input {
    font-size: 16px;   /* stops iOS zooming into the field */
    min-height: 44px;
    line-height: 1.35;
    padding: 10px 14px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .zp-input textarea::-webkit-scrollbar { display: none; }
  .zf-mic, .zf-send { width: 40px; height: 40px; }
  .zp-note { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); font-size: 10.5px; }
  body.zara-lock { overflow: hidden; }
}
/* visitors who ask their device for less motion get a still face that only blinks */
@media (prefers-reduced-motion: reduce) {
  .zh-fig, .zh-dot, .zl-dot, .zm, .zm.typing i, .zf, .zara-tease { animation: none; }
  .zh-par { transform: none; transition: none; }
  .zara-panel, .zara-launch, .zh-bubble, .zl-label { transition: none; }
}
@media print { .zara, .zh-bubble { display: none !important; } }
