/* ===== Sutra Spa AI Chat Widget (scoped, does not override site theme) ===== */
#sutra-chat-widget {
  --w-gold: #fc5a1e;
  --w-gold-light: #fc591ea5;
  --w-gold-dark: #ff4b0a;
  --w-gold-deep: #db4b17;
  --w-white: #ffffff;
  --w-off-white: #faf7f3;
  --w-cream: #f5ede0;
  --w-warm-gray: #f0ebe3;
  --w-text-dark: #1e1b1b;
  --w-text-mid: #ff4400;
  --w-text-light: #ff4400;
  --w-border: rgba(200, 169, 110, 0.22);
  --w-border-hi: rgba(200, 169, 110, 0.45);
  --w-shadow: rgba(180, 140, 80, 0.15);
  --w-shadow-lg: rgba(0, 0, 0, 0.12);
  font-family: "Plus Jakarta Sans", sans-serif;
}
#sutra-chat-widget,
#sutra-chat-widget *,
#sutra-chat-widget *::before,
#sutra-chat-widget *::after {
  box-sizing: border-box;
}
#sutra-chat-widget button {
  margin: 0;
  padding:0px;
  font-family: inherit;
}

#sutra-chat-widget input {
  margin: 0;
  padding: 10px;
  font-family: inherit;
}

/* ── Bubble ── */
#spa-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--w-gold);
  box-shadow: 0 0 0 6px rgba(200, 169, 110, 0.1), 0 8px 32px rgba(0, 0, 0, 0.14),
    0 2px 8px var(--w-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  animation: bubbleIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    comboShake 4s ease-in-out 1s infinite;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.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, 0.1), 0 8px 24px rgba(0, 0, 0, 0.12),
      0 0 18px rgba(200, 169, 110, 0.45), 0 0 36px rgba(200, 169, 110, 0.2);
  }
  5% {
    transform: rotate(-9deg);
    box-shadow: 0 0 0 8px rgba(200, 169, 110, 0.2), 0 8px 28px rgba(0, 0, 0, 0.14),
      0 0 32px rgba(200, 169, 110, 0.8), 0 0 64px rgba(200, 169, 110, 0.4);
  }
  10% {
    transform: rotate(9deg);
  }
  15% {
    transform: rotate(-7deg);
    box-shadow: 0 0 0 8px rgba(200, 169, 110, 0.2), 0 8px 28px rgba(0, 0, 0, 0.14),
      0 0 32px rgba(200, 169, 110, 0.8), 0 0 64px rgba(200, 169, 110, 0.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, 0.15), 0 12px 40px rgba(0, 0, 0, 0.18),
    0 4px 16px var(--w-shadow);
}
#spa-bubble.open {
  animation: none;
  transform: scale(0.92) rotate(5deg);
}

.bubble-img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  object-position: top !important;
  border-radius: 50%;
  transition: opacity 0.3s, transform 0.3s;
}
.bubble-close-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fc5a1e;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7) rotate(354deg);
  transition: opacity 0.3s, transform 0.3s;
  font-size: 22px;
}
#spa-bubble.open .bubble-img {
  opacity: 0;
  transform: scale(1.7);
}
#spa-bubble.open .bubble-close-overlay {
  opacity: 1;
  transform: scale(1) rotate(354deg);
}

.pulse-ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1.5px solid #ff6a34;
  animation: pulseRing 2.5s ease-out infinite;
  pointer-events: none;
}
.pulse-ring:nth-child(2) {
  animation-delay: 0.9s;
}
@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 0.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(--w-white);
  border: 1px solid var(--w-border);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.13), 0 8px 24px rgba(180, 140, 80, 0.1),
    0 0 0 1px rgba(200, 169, 110, 0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.88) translateY(24px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.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(--w-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, 0.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, 0.2);
  letter-spacing: 5px;
}

.header-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--w-gold);
  overflow: hidden;
  position: relative;
  box-shadow: 0 3px 12px rgba(200, 169, 110, 0.2), 0 0 0 3px rgba(200, 169, 110, 0.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(--w-text-dark);
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-sub {
  font-family: "Plus Jakarta Sans", sans-serif !important;
  font-size: 11px;
  font-weight: 300;
  color: var(--w-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(--w-text-light);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.header-close:hover {
  background: var(--w-warm-gray);
  color: var(--w-gold-dark);
}

/* ── Messages ── */
.spa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--w-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, 0.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(--w-text-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.date-divider::before,
.date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 169, 110, 0.25), transparent);
}
.ornament {
  text-align: center;
  font-size: 12px;
  color: rgba(200, 169, 110, 0.3);
  letter-spacing: 10px;
  margin: 2px 0;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.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(--w-gold);
  overflow: hidden;
  margin-bottom: 2px;
  box-shadow: 0 2px 8px rgba(200, 169, 110, 0.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(--w-white);
  border: 1px solid var(--w-border);
  color: var(--w-text-dark);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.msg.user .bubble {
  background: linear-gradient(135deg, #fc5a1e, #f3622c);
  color: #fff;
  font-weight: 400;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(200, 169, 110, 0.3);
}
.msg-time {
  font-size: 10px;
  font-family: "Plus Jakarta Sans", sans-serif !important;
  font-weight: 300;
  color: var(--w-text-light);
  opacity: 0.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(--w-white);
  border: 1px solid var(--w-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, 0.06);
}
.t-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--w-gold);
  opacity: 0.5;
  animation: tdot 1.3s ease-in-out infinite;
}
.t-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.t-dot:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes tdot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

/* ── Input Area ── */
.spa-input-area {
  padding: 10px 14px 12px;
  background: var(--w-white);
  border-top: 1px solid var(--w-border);
  flex-shrink: 0;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  transition: min-height 0.2s ease;
}

/* service list bubble */
.svc-list {
  background: var(--w-off-white);
  border: 1px solid var(--w-border-hi);
  border-radius: 16px;
  padding: 10px 14px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 12.5px;
  color: var(--w-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, 0.3);
  border-radius: 4px;
}
.svc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(200, 169, 110, 0.1);
}
.svc-row:last-child {
  border-bottom: none;
}
.svc-row:hover {
  background: rgba(200, 169, 110, 0.1);
}
.svc-row.sel {
  background: rgba(200, 169, 110, 0.18);
  font-weight: 600;
}
.svc-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(200, 169, 110, 0.2);
  color: var(--w-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(--w-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 0.15s;
}
.yn-yes {
  background: linear-gradient(135deg, #fc5a1e, #f3622c);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(200, 169, 110, 0.3);
}
.yn-yes:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(200, 169, 110, 0.4);
}
.yn-no {
  background: var(--w-white);
  color: var(--w-gold-dark);
  border: 1.5px solid var(--w-gold);
}
.yn-no:hover {
  background: var(--w-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%;
  height: 45px;
  padding: 10px 14px;
  border-radius: 22px;
  border: 1.5px solid var(--w-border-hi);
  background: var(--w-off-white);
  color: var(--w-text-dark);
  font-family: "Plus Jakarta Sans", sans-serif !important;
  font-size: 14px;
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  line-height: 1.4;
}
.spa-field:focus {
  border-color: var(--w-gold);
  background: var(--w-white);
}
.spa-field::placeholder {
  color: rgba(97, 92, 85, 0.45);
}
.spa-field.err {
  border-color: #e74c3c;
  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: #e74c3c;
  padding: 0 4px;
  min-height: 14px;
  margin-top: 2px;
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #fc5a1e;
  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, 0.3);
  transition: transform 0.2s, box-shadow 0.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, 0.4);
}
.send-btn:active {
  transform: scale(0.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: 0.06em;
  background: var(--w-white);
  flex-shrink: 0;
}
.spa-power span {
  color: var(--w-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;
  }
}
