/* ============================================================
   Ask VirtualWorks — chat widget
   virtualworks.ai
   Self-contained: prefixed vars, no global selectors.
   Palette mirrors vw-shared.css (dark navy, blue accents).
============================================================ */

#ask-vw-root {
  /* token names retained from the Chelsea base for minimal edit churn;
     values swapped to the VirtualWorks navy/blue palette. */
  --vwc-rose-gold:   #378ADD;
  --vwc-rose-lt:     #5BA3F5;
  --vwc-blush:       #142242;
  --vwc-blush-soft:  #101B30;
  --vwc-ivory:       #0D1526;
  --vwc-cream:       #0A0F1E;
  --vwc-ink:         #F0F4FF;
  --vwc-plum:        #378ADD;
  --vwc-plum-deep:   #F0F4FF;
  --vwc-cocoa:       #C9D2E5;
  --vwc-muted:       #8899BB;
  --vwc-pearl:       #FFFFFF;
  --vwc-hairline:    rgba(55,138,221,0.16);
  --vwc-shadow-soft: 0 4px 24px rgba(0,0,0,0.35);
  --vwc-shadow-card: 0 18px 56px rgba(0,0,0,0.55);
  --vwc-shadow-glow: 0 12px 40px rgba(55,138,221,0.40);
  --vwc-ease:        cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   Floating launcher
============================================================ */
#vwc-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(--vwc-pearl);
  background: linear-gradient(135deg, #378ADD 0%, #4595E0 50%, #5BA3F5 100%);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: var(--vwc-shadow-glow);
  transition: transform 0.25s var(--vwc-ease), box-shadow 0.25s var(--vwc-ease), opacity 0.25s var(--vwc-ease);
  animation: vwcPulse 2.6s ease-in-out 3;
  -webkit-tap-highlight-color: transparent;
}

#vwc-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 56px rgba(55,138,221,0.5);
}

#vwc-launcher:focus-visible {
  outline: 3px solid rgba(55,138,221,0.5);
  outline-offset: 4px;
}

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

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

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

@keyframes vwcPulse {
  0%, 100% {
    box-shadow: 0 12px 40px rgba(55,138,221,0.35);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 18px 60px rgba(55,138,221,0.55);
    transform: scale(1.035);
  }
}

/* Mobile: bottom-center pill */
@media (max-width: 720px) {
  #vwc-launcher {
    right: 50%;
    bottom: 16px;
    transform: translateX(50%);
    padding: 13px 20px 13px 16px;
  }
  #vwc-launcher:hover { transform: translateX(50%) translateY(-2px); }
  @keyframes vwcPulse {
    0%, 100% {
      box-shadow: 0 12px 40px rgba(55,138,221,0.35);
      transform: translateX(50%) scale(1);
    }
    50% {
      box-shadow: 0 18px 60px rgba(55,138,221,0.55);
      transform: translateX(50%) scale(1.035);
    }
  }
}

/* ============================================================
   Inactivity tooltip
============================================================ */
#vwc-tooltip {
  position: fixed;
  right: 24px;
  bottom: 90px;
  z-index: 2147483599;
  background: var(--vwc-ink);
  color: var(--vwc-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(--vwc-shadow-soft);
  max-width: 240px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--vwc-ease), transform 0.4s var(--vwc-ease);
  pointer-events: none;
}

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

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

/* ============================================================
   Chat panel
============================================================ */
#vwc-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(--vwc-ivory);
  border-radius: 28px;
  box-shadow: var(--vwc-shadow-card);
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--vwc-cocoa);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.3s var(--vwc-ease), transform 0.3s var(--vwc-ease);
  pointer-events: none;
}

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

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

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

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

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

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

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

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

.vwc-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);
}

.vwc-icon-btn {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--vwc-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;
}
.vwc-icon-btn:hover { background: rgba(55,138,221,0.08); }
.vwc-icon-btn:focus-visible {
  outline: 2px solid var(--vwc-rose-gold);
  outline-offset: 2px;
}
.vwc-icon-btn svg { width: 18px; height: 18px; }

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

.vwc-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(--vwc-ink);
  cursor: pointer;
  text-align: left;
}
.vwc-settings-menu button:hover { background: var(--vwc-blush-soft); }
.vwc-settings-menu button[aria-checked="true"]::before {
  content: '✓';
  color: var(--vwc-rose-gold);
  font-weight: 700;
}

/* ----- Messages ----- */
.vwc-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;
}

.vwc-messages::-webkit-scrollbar { width: 8px; }
.vwc-messages::-webkit-scrollbar-track { background: transparent; }
.vwc-messages::-webkit-scrollbar-thumb {
  background: rgba(55,138,221,0.15);
  border-radius: 4px;
}

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

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

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

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

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

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

.vwc-chip {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(55,138,221,0.35);
  color: var(--vwc-ink);
  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(--vwc-ease);
  -webkit-tap-highlight-color: transparent;
}
.vwc-chip:hover {
  border-color: var(--vwc-rose-gold);
  background: rgba(55,138,221,0.10);
  transform: translateY(-1px);
}
.vwc-chip:focus-visible {
  outline: 2px solid var(--vwc-rose-gold);
  outline-offset: 2px;
}

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

.vwc-input-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(55,138,221,0.20);
  background: var(--vwc-blush-soft);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  color: var(--vwc-ink);
  padding: 12px 16px;
  border-radius: 100px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.vwc-input-row input:focus {
  border-color: var(--vwc-rose-gold);
  box-shadow: 0 0 0 3px rgba(55,138,221,0.15);
}
.vwc-input-row input::placeholder { color: var(--vwc-muted); }

.vwc-send, .vwc-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(--vwc-pearl);
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.vwc-send svg, .vwc-voice svg { width: 18px; height: 18px; }

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

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

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

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

.vwc-handoff input,
.vwc-handoff select {
  width: 100%;
  border: 1px solid rgba(55,138,221,0.20);
  background: var(--vwc-blush-soft);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  color: var(--vwc-ink);
  outline: none;
  box-sizing: border-box;
}
.vwc-handoff input:focus,
.vwc-handoff select:focus {
  border-color: var(--vwc-rose-gold);
  box-shadow: 0 0 0 3px rgba(55,138,221,0.12);
}

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

.vwc-btn-primary,
.vwc-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;
}
.vwc-btn-primary {
  background: var(--vwc-plum-deep);
  color: var(--vwc-ivory);
}
.vwc-btn-primary:hover { background: var(--vwc-plum); }
.vwc-btn-primary:disabled { opacity: 0.5; cursor: wait; }
.vwc-btn-ghost {
  background: transparent;
  color: var(--vwc-ink);
  border-color: rgba(55,138,221,0.30);
}
.vwc-btn-ghost:hover { background: var(--vwc-blush-soft); }

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

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

/* ============================================================
   Hero CTA (use anywhere with class .vwc-hero-cta + data-ask-vw="open")
============================================================ */
.vwc-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: var(--vwc-blush-soft, #101B30);
  border: 1px solid rgba(55,138,221,0.4);
  border-radius: 100px;
  color: var(--vwc-ink, #F0F4FF);
  font-family: 'Inter', sans-serif;
  font-style: normal;
  font-size: 19px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,0.30);
  transition: all 0.25s var(--vwc-ease, ease);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.vwc-hero-cta:hover {
  background: rgba(55,138,221,0.10);
  border-color: #378ADD;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(55,138,221,0.30);
}
.vwc-hero-cta:focus-visible {
  outline: 3px solid rgba(55,138,221,0.45);
  outline-offset: 4px;
}
.vwc-hero-cta .vwc-hero-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #378ADD, #5BA3F5);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(55,138,221,0.4);
}
.vwc-hero-cta .vwc-hero-icon svg { width: 16px; height: 16px; }

/* sr-only */
.vwc-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;
}
