/* ============================================================
   Ask Chelsea — chat widget
   chelseasproducts.com
   Self-contained: prefixed vars, no global selectors.
============================================================ */

#ask-chelsea-root {
  --ac-rose-gold:   #C28872;
  --ac-rose-lt:     #E0B5A2;
  --ac-blush:       #F4DDD2;
  --ac-blush-soft:  #FBEAE3;
  --ac-ivory:       #FBF6F0;
  --ac-cream:       #F5EBDF;
  --ac-ink:         #2D1B22;
  --ac-plum:        #5A3344;
  --ac-plum-deep:   #3D1F2A;
  --ac-cocoa:       #5C4438;
  --ac-muted:       #8A6F66;
  --ac-pearl:       #FFFFFF;
  --ac-hairline:    rgba(45,27,34,0.10);
  --ac-shadow-soft: 0 4px 24px rgba(93,51,68,0.10);
  --ac-shadow-card: 0 18px 56px rgba(93,51,68,0.22);
  --ac-shadow-glow: 0 12px 40px rgba(194,136,114,0.35);
  --ac-ease:        cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   Floating launcher
============================================================ */
#ac-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 14px 18px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ac-pearl);
  background: linear-gradient(135deg, #C28872 0%, #D89B8C 50%, #C9A961 100%);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: var(--ac-shadow-glow);
  transition: transform 0.25s var(--ac-ease), box-shadow 0.25s var(--ac-ease), opacity 0.25s var(--ac-ease);
  animation: acPulse 2.6s ease-in-out 3;
  -webkit-tap-highlight-color: transparent;
}

#ac-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 56px rgba(194,136,114,0.5);
}

#ac-launcher:focus-visible {
  outline: 3px solid rgba(194,136,114,0.5);
  outline-offset: 4px;
}

#ac-launcher .ac-launch-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#ac-launcher .ac-launch-icon svg {
  width: 100%;
  height: 100%;
}

#ac-launcher .ac-launch-label {
  font-family: 'Cormorant Garamond', 'Inter', serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
}

@keyframes acPulse {
  0%, 100% {
    box-shadow: 0 12px 40px rgba(194,136,114,0.35);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 18px 60px rgba(194,136,114,0.55);
    transform: scale(1.035);
  }
}

/* Mobile: hide floating launcher — the bottom mobile-bar + inline hero "Just ask Chelsea" CTA already provide entry points */
@media (max-width: 720px) {
  #ac-launcher { display: none !important; }
}

/* ============================================================
   Inactivity tooltip
============================================================ */
#ac-tooltip {
  position: fixed;
  right: 24px;
  bottom: 90px;
  z-index: 2147483599;
  background: var(--ac-ink);
  color: var(--ac-ivory);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  padding: 11px 16px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: var(--ac-shadow-soft);
  max-width: 240px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ac-ease), transform 0.4s var(--ac-ease);
  pointer-events: none;
}

#ac-tooltip.ac-show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  #ac-tooltip {
    right: 50%;
    bottom: 82px;
    transform: translate(50%, 8px);
    border-radius: 14px;
  }
  #ac-tooltip.ac-show { transform: translate(50%, 0); }
}

/* ============================================================
   Chat panel
============================================================ */
#ac-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483601;
  width: 400px;
  height: min(640px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--ac-ivory);
  border-radius: 28px;
  box-shadow: var(--ac-shadow-card);
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ac-cocoa);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.3s var(--ac-ease), transform 0.3s var(--ac-ease);
  pointer-events: none;
}

#ac-panel[hidden] { display: none; }

#ac-panel.ac-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

@media (max-width: 720px) {
  #ac-panel {
    inset: 0;
    right: 0; bottom: 0; left: 0; top: 0;
    width: 100%;
    height: 100dvh;
    height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

/* ----- Header ----- */
.ac-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 14px 18px;
  background: linear-gradient(180deg, var(--ac-blush-soft) 0%, var(--ac-ivory) 100%);
  border-bottom: 1px solid var(--ac-hairline);
  flex-shrink: 0;
}

.ac-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ac-rose-gold), var(--ac-rose-lt));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ac-pearl);
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(194,136,114,0.30);
  overflow: hidden;
}
.ac-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

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

.ac-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ac-plum-deep);
  line-height: 1.15;
  letter-spacing: -0.005em;
}

.ac-tagline {
  font-size: 13px;
  color: var(--ac-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ac-tagline::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ECB71;
  box-shadow: 0 0 6px rgba(78,203,113,0.5);
}

.ac-icon-btn {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ac-plum);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ac-icon-btn:hover { background: rgba(45,27,34,0.08); }
.ac-icon-btn:focus-visible {
  outline: 2px solid var(--ac-rose-gold);
  outline-offset: 2px;
}
.ac-icon-btn svg { width: 18px; height: 18px; }

/* ----- Settings dropdown ----- */
.ac-settings-menu {
  position: absolute;
  right: 14px;
  top: 64px;
  background: var(--ac-pearl);
  border: 1px solid var(--ac-hairline);
  border-radius: 14px;
  box-shadow: var(--ac-shadow-card);
  padding: 6px;
  min-width: 200px;
  display: none;
  z-index: 10;
}
.ac-settings-menu.ac-show { display: block; }

.ac-settings-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ac-ink);
  cursor: pointer;
  text-align: left;
}
.ac-settings-menu button:hover { background: var(--ac-blush-soft); }
.ac-settings-menu button[aria-checked="true"]::before {
  content: '✓';
  color: var(--ac-rose-gold);
  font-weight: 700;
}

/* ----- Messages ----- */
.ac-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.ac-messages::-webkit-scrollbar { width: 8px; }
.ac-messages::-webkit-scrollbar-track { background: transparent; }
.ac-messages::-webkit-scrollbar-thumb {
  background: rgba(45,27,34,0.15);
  border-radius: 4px;
}

.ac-msg {
  display: flex;
  max-width: 86%;
  animation: acFadeIn 0.32s var(--ac-ease);
}
@keyframes acFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ac-msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ac-msg.ac-chelsea { align-self: flex-start; }
.ac-msg.ac-chelsea .ac-msg-bubble {
  background: var(--ac-blush-soft);
  color: var(--ac-ink);
  border-bottom-left-radius: 6px;
}

.ac-msg.ac-user { align-self: flex-end; }
.ac-msg.ac-user .ac-msg-bubble {
  background: var(--ac-plum);
  color: var(--ac-ivory);
  border-bottom-right-radius: 6px;
}

/* Typing indicator */
.ac-typing {
  align-self: flex-start;
  background: var(--ac-blush-soft);
  padding: 14px 18px;
  border-radius: 18px 18px 18px 6px;
  display: inline-flex;
  gap: 6px;
  animation: acFadeIn 0.25s var(--ac-ease);
}
.ac-typing span {
  width: 8px;
  height: 8px;
  background: var(--ac-rose-gold);
  border-radius: 50%;
  opacity: 0.35;
  animation: acDot 1.2s infinite ease-in-out;
}
.ac-typing span:nth-child(2) { animation-delay: 0.18s; }
.ac-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes acDot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
  30% { opacity: 1; transform: scale(1); }
}

/* ----- Suggestion chips ----- */
.ac-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 2px 4px;
  align-self: stretch;
  animation: acFadeIn 0.35s var(--ac-ease) 0.1s both;
}

.ac-chip {
  appearance: none;
  background: var(--ac-pearl);
  border: 1px solid rgba(194,136,114,0.35);
  color: var(--ac-plum-deep);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 100px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s var(--ac-ease);
  -webkit-tap-highlight-color: transparent;
}
.ac-chip:hover {
  border-color: var(--ac-rose-gold);
  background: var(--ac-blush-soft);
  transform: translateY(-1px);
}
.ac-chip:focus-visible {
  outline: 2px solid var(--ac-rose-gold);
  outline-offset: 2px;
}

/* ----- Input row ----- */
.ac-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 14px;
  background: var(--ac-pearl);
  border-top: 1px solid var(--ac-hairline);
  flex-shrink: 0;
}

.ac-input-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(45,27,34,0.12);
  background: var(--ac-ivory);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  color: var(--ac-ink);
  padding: 12px 16px;
  border-radius: 100px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ac-input-row input:focus {
  border-color: var(--ac-rose-gold);
  box-shadow: 0 0 0 3px rgba(194,136,114,0.15);
}
.ac-input-row input::placeholder { color: var(--ac-muted); }

.ac-send, .ac-voice {
  appearance: none;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ac-pearl);
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ac-send svg, .ac-voice svg { width: 18px; height: 18px; }

.ac-voice {
  background: var(--ac-blush);
  color: var(--ac-plum);
}
.ac-voice:hover { background: var(--ac-blush-soft); }
.ac-voice:focus-visible { outline: 2px solid var(--ac-rose-gold); outline-offset: 2px; }
.ac-voice.ac-listening {
  background: var(--ac-rose-gold);
  color: var(--ac-pearl);
  animation: acListening 1.4s ease-in-out infinite;
}
@keyframes acListening {
  0%, 100% { box-shadow: 0 0 0 0 rgba(194,136,114,0.6); }
  50% { box-shadow: 0 0 0 10px rgba(194,136,114,0); }
}

.ac-send {
  background: linear-gradient(135deg, var(--ac-rose-gold), var(--ac-rose-lt));
}
.ac-send:hover:not(:disabled) { transform: translateY(-1px); }
.ac-send:focus-visible { outline: 2px solid var(--ac-rose-gold); outline-offset: 2px; }
.ac-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ----- Hand-off form ----- */
.ac-handoff {
  background: var(--ac-cream);
  border: 1px solid rgba(194,136,114,0.25);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  align-self: stretch;
  animation: acFadeIn 0.32s var(--ac-ease);
}

.ac-handoff label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ac-plum);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.ac-handoff input,
.ac-handoff select {
  width: 100%;
  border: 1px solid rgba(45,27,34,0.15);
  background: var(--ac-pearl);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  color: var(--ac-ink);
  outline: none;
  box-sizing: border-box;
}
.ac-handoff input:focus,
.ac-handoff select:focus {
  border-color: var(--ac-rose-gold);
  box-shadow: 0 0 0 3px rgba(194,136,114,0.12);
}

.ac-handoff-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ac-btn-primary,
.ac-btn-ghost {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 100px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.ac-btn-primary {
  background: var(--ac-plum-deep);
  color: var(--ac-ivory);
}
.ac-btn-primary:hover { background: var(--ac-plum); }
.ac-btn-primary:disabled { opacity: 0.5; cursor: wait; }
.ac-btn-ghost {
  background: transparent;
  color: var(--ac-plum);
  border-color: rgba(90,51,68,0.3);
}
.ac-btn-ghost:hover { background: var(--ac-blush-soft); }

/* ----- High-contrast mode ----- */
#ac-panel.ac-high-contrast {
  background: #FFFFFF;
}
.ac-high-contrast .ac-header {
  background: #FFFFFF;
  border-bottom: 2px solid #000000;
}
.ac-high-contrast .ac-name { color: #000000; }
.ac-high-contrast .ac-tagline { color: #2D1B22; }
.ac-high-contrast .ac-msg.ac-chelsea .ac-msg-bubble {
  background: #FFFFFF;
  color: #000000;
  border: 2px solid #2D1B22;
}
.ac-high-contrast .ac-msg.ac-user .ac-msg-bubble {
  background: #000000;
  color: #FFFFFF;
}
.ac-high-contrast .ac-chip {
  background: #FFFFFF;
  color: #000000;
  border: 2px solid #2D1B22;
}
.ac-high-contrast .ac-input-row {
  background: #FFFFFF;
  border-top: 2px solid #000000;
}
.ac-high-contrast .ac-input-row input {
  border: 2px solid #2D1B22;
  background: #FFFFFF;
  color: #000000;
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  #ac-launcher { animation: none; }
  #ac-panel,
  .ac-msg,
  .ac-typing,
  .ac-chips,
  .ac-handoff,
  #ac-tooltip { transition: none; animation: none; }
  .ac-typing span { animation: none; opacity: 0.6; }
}

/* ============================================================
   Hero CTA (use anywhere with class .ac-hero-cta + data-ask-chelsea="open")
============================================================ */
.ac-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: var(--ac-pearl, #FFFFFF);
  border: 1px solid rgba(194,136,114,0.4);
  border-radius: 100px;
  color: var(--ac-plum-deep, #3D1F2A);
  font-family: 'Cormorant Garamond', 'Inter', serif;
  font-style: italic;
  font-size: 19px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(93,51,68,0.10);
  transition: all 0.25s var(--ac-ease, ease);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.ac-hero-cta:hover {
  background: #FBEAE3;
  border-color: #C28872;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(194,136,114,0.30);
}
.ac-hero-cta:focus-visible {
  outline: 3px solid rgba(194,136,114,0.45);
  outline-offset: 4px;
}
.ac-hero-cta .ac-hero-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #C28872, #E0B5A2);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(194,136,114,0.4);
}
.ac-hero-cta .ac-hero-icon svg { width: 16px; height: 16px; }

/* sr-only */
.ac-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
