/* ============================================
   Spa AI chat widget — fully self-contained.
   Everything is scoped under #spa-widget so it
   can never inherit from, or be overridden by,
   the site's own theme/fonts, and never leaks
   its own resets/fonts back onto the site.
   ============================================ */
/* #spa-widget,
#spa-widget *,
#spa-widget *::before,
#spa-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
} */

#spa-widget {
  font-family: 'Plus Jakarta Sans', sans-serif;

  --gold: #6d3002;
  --gold-light: #ba5000;
  --gold-dark: #9c4400;
  --gold-deep: #9c4400;
  --white: #ffffff;
  --off-white: #faf7f3;
  --cream: #f5ede0;
  --warm-gray: #f0ebe3;
  --text-dark: #1E1B1B;
  --text-mid: #6d3002;
  --text-light: #6d3002;
  --border: rgba(200, 169, 110, 0.22);
  --border-hi: rgba(200, 169, 110, 0.45);
  --shadow: rgba(180, 140, 80, 0.15);
  --shadow-lg: rgba(0, 0, 0, 0.12);
}

/* ── Bubble (moved to the left so it never overlaps the
   site's right-side WhatsApp/Call floating buttons) ── */
#spa-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 6px rgba(200, 169, 110, .1), 0 8px 32px rgba(0, 0, 0, .14), 0 2px 8px var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  animation: bubbleIn .7s cubic-bezier(.34, 1.56, .64, 1) both, comboShake 4s ease-in-out 1s infinite;
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s;
}

@keyframes bubbleIn {
  from { transform: scale(0) rotate(-20deg); opacity: 0 }
  to { transform: scale(1) rotate(0); opacity: 1 }
}

@keyframes comboShake {
  0%, 100% { transform: rotate(0); box-shadow: 0 0 0 5px rgba(200, 169, 110, .1), 0 8px 24px rgba(0, 0, 0, .12), 0 0 18px rgba(200, 169, 110, .45), 0 0 36px rgba(200, 169, 110, .2) }
  5% { transform: rotate(-9deg); box-shadow: 0 0 0 8px rgba(200, 169, 110, .2), 0 8px 28px rgba(0, 0, 0, .14), 0 0 32px rgba(200, 169, 110, .8), 0 0 64px rgba(200, 169, 110, .4) }
  10% { transform: rotate(9deg) }
  15% { transform: rotate(-7deg); box-shadow: 0 0 0 8px rgba(200, 169, 110, .2), 0 8px 28px rgba(0, 0, 0, .14), 0 0 32px rgba(200, 169, 110, .8), 0 0 64px rgba(200, 169, 110, .4) }
  20% { transform: rotate(5deg) }
  25% { transform: rotate(-3deg) }
  30% { transform: rotate(2deg) }
  35%, 60% { transform: rotate(0) }
}

#spa-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 8px rgba(200, 169, 110, .15), 0 12px 40px rgba(0, 0, 0, .18), 0 4px 16px var(--shadow)
}

#spa-bubble.open {
  animation: none;
  transform: scale(.92) rotate(5deg)
}

.bubble-img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  object-position: top !important;
  border-radius: 50%;
  transition: opacity .3s, transform .3s
}

.bubble-close-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #6d3002;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.7);
  transition: opacity .3s, transform .3s;
  transform: rotate(354deg);
}

#spa-bubble.open .bubble-img {
  opacity: 0;
  transform: scale(1.7)
}

#spa-bubble.open .bubble-close-overlay {
  opacity: 1;
  transform: scale(1);
  transform: rotate(354deg);
}

.pulse-ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1.5px solid #6d3002;
  animation: pulseRing 2.5s ease-out infinite;
  pointer-events: none;
}

.pulse-ring:nth-child(2) { animation-delay: .9s }

@keyframes pulseRing {
  0% { transform: scale(1); opacity: .7 }
  100% { transform: scale(1.5); opacity: 0 }
}

.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #4ecb71;
  border: 2.5px solid white;
  animation: notifPulse 1.8s ease-in-out infinite;
  z-index: 99;
}

@keyframes notifPulse {
  0%, 100% { transform: scale(1) }
  50% { transform: scale(1.25) }
}

/* ── Chat Window ── */
#spa-chat {
  position: fixed;
  bottom: 112px;
  right: 28px;
  z-index: 9998;
  width: 380px;
  height: 610px;
  border-radius: 22px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: 0 32px 80px rgba(0, 0, 0, .13), 0 8px 24px rgba(180, 140, 80, .1), 0 0 0 1px rgba(200, 169, 110, .07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.88) translateY(24px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease;
  touch-action: pan-y;
}

#spa-chat.visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all
}

/* ── Header ── */
.spa-header {
  background: linear-gradient(135deg, #fffdf9 0%, #faf5ec 100%);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.spa-header::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -20px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 169, 110, .08) 0%, transparent 70%);
  pointer-events: none
}

.spa-header::after {
  content: '✦  ✦  ✦';
  position: absolute;
  bottom: 8px;
  right: 14px;
  font-size: 8px;
  color: rgba(200, 169, 110, .2);
  letter-spacing: 5px
}

.header-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--gold);
  overflow: hidden;
  position: relative;
  box-shadow: 0 3px 12px rgba(200, 169, 110, .2), 0 0 0 3px rgba(200, 169, 110, .08);
}

.header-avatar img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  object-position: top !important;
  display: block
}

.online-ring {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4ecb71;
  border: 2px solid white;
  z-index: 2
}

.header-text { flex: 1; min-width: 0 }

.header-name {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-dark);
  letter-spacing: .03em;
  overflow: hidden;
  text-overflow: ellipsis
}

.header-sub {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 11px;
  font-weight: 300;
  color: var(--text-light);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px
}

.dot-live {
  width: 6px;
  height: 6px;
  border-radius: 100%;
  background: #4ecb71;
  flex-shrink: 0
}

.header-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: background .2s, color .2s;
  flex-shrink: 0
}

.header-close:hover {
  background: var(--warm-gray);
  color: var(--gold-dark)
}

/* ── Messages ── */
.spa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--off-white);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.spa-messages::-webkit-scrollbar { width: 3px }
.spa-messages::-webkit-scrollbar-thumb { background: rgba(200, 169, 110, .25); border-radius: 4px }

.date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-light);
  letter-spacing: .1em;
  text-transform: uppercase
}

.date-divider::before,
.date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 169, 110, .25), transparent)
}

.ornament {
  text-align: center;
  font-size: 12px;
  color: rgba(200, 169, 110, .3);
  letter-spacing: 10px;
  margin: 2px 0
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn .38s cubic-bezier(.34, 1.56, .64, 1)
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(14px) scale(.94) }
  to { opacity: 1; transform: none }
}

.msg.bot { justify-content: flex-start }
.msg.bot > div { display: flex; flex-direction: column; align-items: flex-start; max-width: 82% }
.msg.user { justify-content: flex-end }
.msg.user > div { display: flex; flex-direction: column; align-items: flex-end; max-width: 82% }

.msg-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--gold);
  overflow: hidden;
  margin-bottom: 2px;
  box-shadow: 0 2px 8px rgba(200, 169, 110, .2)
}

.msg-av img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  object-position: top !important;
  display: block
}

.bubble {
  padding: 11px 15px;
  border-radius: 18px;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere
}

.msg.bot .bubble {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06)
}

.msg.user .bubble {
  background: linear-gradient(135deg, #6d3002, #9c4400);
  color: #fff;
  font-weight: 400;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(200, 169, 110, .3)
}

.msg-time {
  font-size: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-weight: 300;
  color: var(--text-light);
  opacity: .8;
  margin-top: 4px
}

.msg.bot .msg-time { text-align: left }
.msg.user .msg-time { text-align: right }

/* typing */
.typing-wrap { display: flex; align-items: flex-end; gap: 8px }

.typing-bubble {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 5px;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06)
}

.t-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .5;
  animation: tdot 1.3s ease-in-out infinite
}

.t-dot:nth-child(2) { animation-delay: .2s }
.t-dot:nth-child(3) { animation-delay: .4s }

@keyframes tdot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5 }
  30% { transform: translateY(-7px); opacity: 1 }
}

/* ── Input Area ── */
.spa-input-area {
  padding: 10px 14px 12px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* service list bubble */
.svc-list {
  background: var(--off-white);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  padding: 10px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  color: var(--text-dark);
  line-height: 1.8;
  max-height: 200px;
  overflow-y: auto;
}

.svc-list::-webkit-scrollbar { width: 3px }
.svc-list::-webkit-scrollbar-thumb { background: rgba(200, 169, 110, .3); border-radius: 4px }

.svc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid rgba(200, 169, 110, .1);
}

.svc-row:last-child { border-bottom: none }
.svc-row:hover { background: rgba(200, 169, 110, .1) }
.svc-row.sel { background: rgba(200, 169, 110, .18); font-weight: 600 }

.svc-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(200, 169, 110, .2);
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0
}

.svc-name { flex: 1; font-size: 13px }
.svc-dur { font-size: 11px; color: var(--text-light); flex-shrink: 0 }

/* yes/no */
.yn-row { display: flex; gap: 10px }

.yn-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  transition: all .15s;
}

.yn-yes {
  background: linear-gradient(135deg, #6d3002, #9c4400);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(200, 169, 110, .3)
}

.yn-yes:hover { transform: scale(1.02); box-shadow: 0 6px 18px rgba(200, 169, 110, .4) }

.yn-no {
  background: var(--white);
  color: var(--gold-dark);
  border: 1.5px solid var(--gold)
}

.yn-no:hover { background: var(--cream) }

/* text input + send row */
.input-send-row { display: flex; flex-direction: row; align-items: center; gap: 10px }
.field-wrap { flex: 1; position: relative }

.spa-field {
  width: 100%;
  padding: 11px 38px 11px 16px;
  border-radius: 22px;
  border: 1.5px solid var(--border-hi);
  background: var(--off-white);
  color: var(--text-dark);
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 14px;
  font-weight: 300;
  outline: none;
  transition: border-color .2s, background .2s;
  line-height: 1.4;
}

.spa-field:focus { border-color: var(--gold); background: var(--white) }
.spa-field::placeholder { color: rgba(97, 92, 85, 0.45) }
.spa-field.err { border-color: #9c4400; background: #fff8f8 }
.spa-field.ok { border-color: #4ecb71 }

.f-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
  line-height: 1
}

.f-err {
  font-size: 11px;
  color: #9c4400;
  padding: 0 4px;
  min-height: 14px;
  margin-top: 2px
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6d3002;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(200, 169, 110, .3);
  transition: transform .2s, box-shadow .2s;
}

.send-btn svg { width: 18px; height: 18px; display: block }
.send-btn:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(200, 169, 110, .4) }
.send-btn:active { transform: scale(.93) }

/* powered */
.spa-power {
  text-align: center;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 10px;
  font-weight: 300;
  color: #000;
  padding: 5px 0 9px;
  letter-spacing: .06em;
  background: var(--white);
  flex-shrink: 0
}

.spa-power span { color: var(--gold-dark) }

/* ── Mobile ── */
@media (max-width: 480px) {
  #spa-chat {
    width: calc(100vw - 16px);
    left: 8px;
    right: 8px;
    bottom: 92px;
    height: calc(100dvh - 130px);
    max-height: 590px;
    border-radius: 16px
  }

  #spa-bubble {
    bottom: 18px;
    right: 18px;
    width: 70px;
    height: 70px
  }

  .spa-field { font-size: 16px }
  .spa-input-area { position: sticky; bottom: 0 }
}
