/* [BRAND: SERENA_TOUCH] - AI Spa Receptionist Widget Styles */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* =========================================================
   FLOATING TRIGGER BUTTON (Modernized, 1.5x Half Bigger)
   ========================================================= */
#spa-ai-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 84px;
  height: 84px;
  border-radius: 26px;
  background: linear-gradient(135deg, #14271f 0%, #1f3a2f 50%, #14271f 100%);
  color: #d8b875;
  border: 2px solid rgba(216, 184, 117, 0.7);
  box-shadow: 0 16px 40px rgba(15, 28, 22, 0.55), 0 0 25px rgba(216, 184, 117, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1050;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  padding: 0;
  overflow: visible;
}

#spa-ai-chat-btn:hover {
  transform: translateY(-5px) scale(1.06);
  border-color: #d8b875;
  box-shadow: 0 22px 50px rgba(15, 28, 22, 0.7), 0 0 35px rgba(216, 184, 117, 0.5);
}

#spa-ai-chat-btn:focus-visible,
.spa-chat-close-btn:focus-visible,
.spa-chat-clear-btn:focus-visible,
.spa-chat-input-bar button:focus-visible {
  outline: 3px solid #d8b875;
  outline-offset: 4px;
}

.spa-btn-content {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spa-btn-content .spa-s-logo-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.spa-btn-badge-live {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #14271f;
  border: 2px solid #d8b875;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spa-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: spaLivePulse 1.8s infinite;
}

@keyframes spaLivePulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* =========================================================
   CHAT WINDOW (Matches spa.calcom.run.place Luxury Theme)
   ========================================================= */
#spa-ai-chat-window {
  position: fixed;
  bottom: 122px;
  right: 28px;
  width: calc(100vw - 32px);
  max-width: 440px;
  height: 620px;
  max-height: calc(100vh - 140px);
  background: linear-gradient(145deg, rgba(20, 39, 31, 0.74) 0%, rgba(15, 28, 22, 0.82) 100%), url('/spa-bg.jpg');
  background-size: cover;
  background-position: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(216, 184, 117, 0.55);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 35px rgba(216, 184, 117, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483000;
  color: #f7f4ee;
  font-family: 'Plus Jakarta Sans', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  animation: spaChatFadeIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile Phone ONLY: Full Screen Mode (< 768px) */
@media (max-width: 767.98px) {
  #spa-ai-chat-window {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  #spa-ai-chat-btn {
    display: none !important;
  }
  .spa-chat-header {
    padding-top: max(16px, env(safe-area-inset-top)) !important;
  }
  .spa-chat-input-bar {
    padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
  }
}

/* Tablet viewports (768px – 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  #spa-ai-chat-window {
    width: 390px !important;
    max-width: 440px !important;
    height: 72vh !important;
    max-height: 750px !important;
    right: 24px !important;
    bottom: 110px !important;
  }
}

/* Desktop ONLY: Adopt 30% of the full screen (>= 992px) */
@media (min-width: 992px) {
  #spa-ai-chat-window {
    width: 30vw !important;
    min-width: 390px !important;
    max-width: 30vw !important;
    height: 78vh !important;
    max-height: 860px !important;
    right: 28px !important;
    bottom: 122px !important;
  }
}

@keyframes spaChatFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#spa-ai-chat-window.open {
  display: flex;
}

/* Header */
.spa-chat-header {
  background: rgba(15, 28, 22, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid rgba(216, 184, 117, 0.35);
}

.spa-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spa-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spa-header-logo-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #14271f;
  border: 1.5px solid rgba(216, 184, 117, 0.65);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  flex-shrink: 0;
}

.spa-header-logo-wrap .spa-s-logo-svg {
  width: 100%;
  height: 100%;
}

.spa-header-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spa-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spa-title-row h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: 'Playfair Display', Georgia, serif;
  color: #d8b875;
}

.spa-ai-agent-pill {
  font-size: 10.5px;
  background: rgba(15, 28, 22, 0.75);
  border: 1px solid rgba(216, 184, 117, 0.65);
  color: #d8b875;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.spa-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spa-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 6px #34d399;
}

.spa-status-text {
  font-size: 12.5px;
  color: rgba(247, 244, 238, 0.92);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Header Action Buttons (>= 44px touch targets for elderly patrons & WCAG AAA) */
.spa-chat-clear-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(216, 184, 117, 0.5);
  color: #f7f4ee;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.spa-chat-clear-btn:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #f87171;
  color: #fca5a5;
  transform: scale(1.08);
}

.spa-chat-close-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(216, 184, 117, 0.35);
  color: #f7f4ee;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.spa-chat-close-btn:hover {
  background: rgba(216, 184, 117, 0.25);
  border-color: #d8b875;
  color: #d8b875;
  transform: scale(1.08);
}

/* Notice Banner */
.spa-ai-banner {
  background: rgba(216, 184, 117, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(216, 184, 117, 0.3);
  padding: 10px 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #f7f4ee;
  display: flex;
  align-items: center;
  gap: 10px;
}

.spa-ai-banner-icon {
  font-size: 16px;
}

/* Messages Area - Elderly Friendly High Legibility */
.spa-chat-messages {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: transparent;
  font-size: 16.5px !important;
  line-height: 1.65 !important;
}

.spa-chat-msg {
  max-width: 88%;
  padding: 14px 18px;
  border-radius: 18px;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 16.5px !important;
  line-height: 1.65 !important;
}

.spa-chat-msg.assistant {
  align-self: flex-start;
  background: rgba(20, 39, 31, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #ffffff;
  border: 1px solid rgba(216, 184, 117, 0.45);
  border-left: 4px solid #d8b875;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.spa-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.spa-msg-meta .spa-s-logo-svg {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.spa-msg-author {
  font-size: 13.5px;
  font-weight: 700;
  color: #d8b875;
  font-family: 'Playfair Display', Georgia, serif;
}

.spa-msg-badge {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(15, 28, 22, 0.75);
  border: 1px solid rgba(216, 184, 117, 0.5);
  color: #d8b875;
  padding: 2px 6.5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spa-msg-body {
  font-size: 16.5px !important;
  line-height: 1.65 !important;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: 0.015em;
}

.spa-chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #d8b875 0%, #d4b470 100%);
  color: #14271f;
  font-size: 16.5px !important;
  line-height: 1.65 !important;
  font-weight: 600;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
}

.spa-chat-msg.loading {
  font-style: italic;
  color: #d8b875;
  background: rgba(20, 39, 31, 0.65);
}

/* Input Bar - Transparent & Elderly Readable */
.spa-chat-input-bar {
  display: flex;
  padding: 14px 16px;
  background: rgba(15, 28, 22, 0.48);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1.5px solid rgba(216, 184, 117, 0.35);
  gap: 10px;
}

.spa-chat-input-bar input {
  flex: 1;
  background: rgba(20, 39, 31, 0.35);
  border: 1.5px solid rgba(216, 184, 117, 0.45);
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 16.5px /* min 16px */ !important;
  line-height: 1.65 !important;
  font-weight: 500;
  outline: none;
  color: #ffffff;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.spa-chat-input-bar input::placeholder {
  color: rgba(247, 244, 238, 0.82);
}

.spa-chat-input-bar input:focus {
  border-color: #d8b875;
  background: rgba(20, 39, 31, 0.55);
  box-shadow: 0 0 0 2px rgba(216, 184, 117, 0.3);
}

.spa-chat-input-bar button {
  background: linear-gradient(135deg, #d8b875 0%, #d4b470 100%);
  color: #14271f;
  border: 1px solid rgba(216, 184, 117, 0.65);
  border-radius: 24px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(216, 184, 117, 0.35);
}

.spa-chat-input-bar button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(216, 184, 117, 0.5);
}
