/* Support.Monster voice widget. Values from Figma "Card: Talk to me". */
.sm-voice {
  --vw-white: #ffffff;
  --vw-line: #eadfec;
  --vw-line-strong: #d9c6dc;
  --vw-tint: #f6eef7;
  --vw-ink: #15132b;
  --vw-muted: #5a5870;
  --vw-grad: linear-gradient(90deg, #9a0f8c 0%, #7a0873 100%);
  --vw-whatsapp: #25d366;
  --vw-end: #d92d4b;
  --vw-live: #22c55e;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  font-family: 'Plus Jakarta Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--vw-ink);
}
.sm-voice[hidden] { display: none; }

/* Card */
.sm-voice-card {
  box-sizing: border-box;
  width: 358px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  background: var(--vw-white);
  border: 1px solid var(--vw-line);
  border-radius: 22px;
  box-shadow: 0 24px 48px -20px rgba(80, 10, 75, 0.35);
  transform-origin: bottom right;
  animation: sm-voice-in 280ms cubic-bezier(.2, .8, .2, 1);
}
.sm-voice[data-collapsed="true"] .sm-voice-card { display: none; }

@keyframes sm-voice-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Photo header */
.sm-voice-media {
  position: relative;
  aspect-ratio: 16 / 9; /* same box as the live avatar, so nothing resizes */
  border-radius: 13px;
  overflow: hidden;
  background: #ffa2d1;
}
.sm-voice-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  display: block;
}
.sm-voice-media.is-missing .sm-voice-photo { display: none; }

.sm-voice-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--vw-tint);
  color: var(--vw-ink);
  cursor: pointer;
}
.sm-voice-close:hover { background: #efe2f1; }

/* Status chip (shown during a call) */
.sm-voice-status {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: none;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(21, 19, 43, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(6px);
}
.sm-voice[data-state="connecting"] .sm-voice-status,
.sm-voice[data-state="live"][data-call="voice"] .sm-voice-status { display: inline-flex; }
.sm-voice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5b8e4;
}
.sm-voice[data-state="live"] .sm-voice-dot { background: var(--vw-live); }
.sm-voice[data-state="connecting"] .sm-voice-dot { animation: sm-voice-blink 1s ease-in-out infinite; }
.sm-voice-timer { font-variant-numeric: tabular-nums; opacity: .8; }
.sm-voice-timer:empty { display: none; }

@keyframes sm-voice-blink { 50% { opacity: .25; } }

/* Speaking ring around the photo while the agent talks */
.sm-voice[data-speaking="true"] .sm-voice-media { box-shadow: inset 0 0 0 3px #9a0f8c; }

/* Buttons */
.sm-voice-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sm-voice-actions--live { display: none; }
.sm-voice[data-state="connecting"] .sm-voice-actions--idle,
.sm-voice[data-state="live"] .sm-voice-actions--idle { display: none; }
.sm-voice[data-state="connecting"] .sm-voice-actions--live,
.sm-voice[data-state="live"] .sm-voice-actions--live { display: flex; }

.sm-voice-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--vw-line-strong);
  border-radius: 999px;
  background: var(--vw-white);
  color: var(--vw-ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.sm-voice-btn:hover { background: var(--vw-tint); }
.sm-voice-btn:active { transform: translateY(1px); }
.sm-voice-btn--whatsapp { border: 1.5px solid var(--vw-whatsapp); }
.sm-voice-btn--primary {
  border: 0;
  background: var(--vw-grad);
  color: #fff;
}
.sm-voice-btn--primary:hover { background: linear-gradient(90deg, #870c7b 0%, #680662 100%); }
.sm-voice-btn--primary[disabled] { opacity: .7; cursor: progress; }
.sm-voice-btn[aria-disabled="true"] { cursor: default; }

.sm-voice-actions--live .sm-voice-btn { flex: 1 1 0; }
.sm-voice-btn--end {
  border: 0;
  background: var(--vw-end);
  color: #fff;
}
.sm-voice-btn--end:hover { background: #bd2440; }
.sm-voice-ico-micoff { display: none; }
.sm-voice-btn[aria-pressed="true"] .sm-voice-ico-mic { display: none; }
.sm-voice-btn[aria-pressed="true"] .sm-voice-ico-micoff { display: inline; }
.sm-voice-btn[aria-pressed="true"] { background: var(--vw-tint); border-color: #9a0f8c; }

.sm-voice-note {
  margin: 0;
  font-size: 10px;
  line-height: 16px;
  color: var(--vw-muted);
  text-align: center;
}
.sm-voice-note.is-alert { color: #a3123a; font-weight: 600; }

/* Collapsed launcher */
.sm-voice-launcher {
  display: none;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--vw-grad);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 16px 32px -14px rgba(80, 10, 75, 0.55);
  cursor: pointer;
}
.sm-voice[data-collapsed="true"] .sm-voice-launcher { display: inline-flex; }
.sm-voice-launcher-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--vw-live);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .25);
}

/* Focus */
.sm-voice button:focus-visible {
  outline: 2px solid #9a0f8c;
  outline-offset: 2px;
}

/* Small screens: card spans the width, slightly shorter photo */
@media (max-width: 600px) {
  .sm-voice { left: 16px; right: 16px; bottom: 16px; }
  .sm-voice-card { width: 100%; }
  .sm-voice[data-collapsed="true"] { left: auto; }
}
@media (max-width: 1099px) {
  body.summary-bar-visible .sm-voice { bottom: 96px; }
}
@media (max-width: 360px) {
  .sm-voice-btn { padding: 0 9px; gap: 4px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .sm-voice-card { animation: none; }
  .sm-voice[data-state="connecting"] .sm-voice-dot { animation: none; }
  .sm-voice-btn { transition: none; }
}

/* ---------- Call My Phone screen (Figma "Card: Call me back") ---------- */
.sm-voice-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sm-voice-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.sm-voice-head,
.sm-voice-phone { display: none; }

.sm-voice[data-mode="phone"] .sm-voice-media { display: none; }
.sm-voice[data-mode="phone"] .sm-voice-head { display: flex; }
.sm-voice[data-mode="phone"] .sm-voice-phone { display: flex; }
.sm-voice[data-mode="phone"] .sm-voice-card { gap: 0; }

.sm-voice-head {
  position: relative;
  align-items: center;
  gap: 16px;
  height: 56px;
}
.sm-voice-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #ffa2d1;
  flex: none;
}
.sm-voice-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-voice-head-label { font-size: 13px; font-weight: 500; color: var(--vw-muted); }
.sm-voice-head-number { font-size: 19px; font-weight: 700; color: var(--vw-ink); white-space: nowrap; }
.sm-voice-head .sm-voice-close { position: absolute; top: 10px; right: 0; }

.sm-voice-phone {
  margin-top: 22px;
  align-items: center;
  gap: 9px;
  height: 52px;
  padding: 0 5px;
  border: 1px solid var(--vw-line-strong);
  border-radius: 14px;
  background: var(--vw-white);
}
.sm-voice-phone:focus-within { border-color: #9a0f8c; box-shadow: 0 0 0 3px rgba(154, 15, 140, .12); }
.sm-voice-phone.is-invalid { border-color: #d92d4b; }

.sm-voice-cc {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 40px;
  border-radius: 10px;
  background: var(--vw-tint);
  flex: none;
}
.sm-voice-cc-select {
  appearance: none;
  -webkit-appearance: none;
  height: 40px;
  padding: 0 30px 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--vw-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.sm-voice-cc svg { position: absolute; right: 8px; pointer-events: none; color: var(--vw-ink); }

.sm-voice-num { flex: 1 1 auto; min-width: 0; }
.sm-voice-num-input {
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--vw-ink);
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.sm-voice-num-input::placeholder { color: #ceced2; }
.sm-voice-num-input:disabled { color: var(--vw-muted); }

.sm-voice[data-mode="phone"] .sm-voice-actions { margin-top: 22px; gap: 9px; }
.sm-voice[data-mode="phone"] .sm-voice-btn { height: 48px; }
.sm-voice[data-mode="phone"] .sm-voice-btn--whatsapp,
.sm-voice[data-mode="phone"] .sm-voice-btn--callme { font-size: 14px; }
.sm-voice[data-mode="phone"] .sm-voice-note { margin-top: 22px; font-size: 11px; }

/* Swap emphasis: Call My Phone becomes the main button, Web Call the plain one */
.sm-voice[data-mode="phone"] [data-action="web-call"] {
  border: 1px solid var(--vw-line-strong);
  background: var(--vw-white);
  color: var(--vw-ink);
}
.sm-voice[data-mode="phone"] [data-action="web-call"]:hover { background: var(--vw-tint); }
.sm-voice[data-mode="phone"] .sm-voice-btn--callme {
  flex: 1 1 auto;
  border: 0;
  background: var(--vw-grad);
  color: #fff;
}
.sm-voice[data-mode="phone"] .sm-voice-btn--callme:hover { background: linear-gradient(90deg, #870c7b 0%, #680662 100%); }
.sm-voice-btn--callme[disabled] { opacity: .7; cursor: progress; }

/* Progress line while we ring the visitor */
.sm-voice-note.is-progress { color: var(--vw-ink); font-weight: 600; }

@media (max-width: 360px) {
  .sm-voice[data-mode="phone"] .sm-voice-btn--whatsapp,
  .sm-voice[data-mode="phone"] .sm-voice-btn--callme { font-size: 12px; }
  .sm-voice-head-number { font-size: 17px; }
}

/* ---------- Web Call: HeyGen LiveAvatar in the card ---------- */
.sm-voice-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
  opacity: 0;
  transition: opacity 300ms ease;
}
.sm-voice[data-state="live"][data-call="video"] .sm-voice-frame { opacity: 1; }
.sm-voice[data-state="live"][data-call="video"] .sm-voice-photo { visibility: hidden; }


/* Keep the close button above the video */
.sm-voice-media .sm-voice-close { z-index: 2; }
.sm-voice-status { z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .sm-voice-frame { transition: none; }
}

/* WhatsApp button is a link when switched on */
a.sm-voice-btn { text-decoration: none; }
.sm-voice a.sm-voice-btn--whatsapp,
.sm-voice a.sm-voice-btn--whatsapp:visited,
.sm-voice a.sm-voice-btn--whatsapp:hover,
.sm-voice a.sm-voice-btn--whatsapp:focus { color: var(--vw-ink); }
a.sm-voice-btn:visited { color: var(--vw-ink); }

/* ---------- Video / voice switching ---------- */
.sm-voice-only-voice,
.sm-voice-only-video { display: none; }
.sm-voice[data-call="voice"] .sm-voice-only-voice,
.sm-voice[data-call="video"] .sm-voice-only-video { display: inline-flex; }
.sm-voice[data-call="voice"][data-state="live"] .sm-voice-dot { background: var(--vw-live); }
.sm-voice-actions--live .sm-voice-btn { min-width: 0; padding: 0 10px; }

/* While the keyboard is open, keep the card short enough to fit above it */
/* Keyboard open: pin to the top of what's visible (--sm-vvtop = how far the phone scrolled the view) */
.sm-voice.is-kb,
body.summary-bar-visible .sm-voice.is-kb {
  top: calc(var(--sm-vvtop, 0px) + 12px);
  bottom: auto;
}
.sm-voice.is-kb .sm-voice-card {
  max-height: calc(var(--sm-vvh, 100vh) - 24px);
  overflow-y: auto;
  animation: none;
}
.sm-voice.is-kb[data-mode="phone"] .sm-voice-note { margin-top: 12px; }
.sm-voice.is-kb[data-mode="phone"] .sm-voice-phone,
.sm-voice.is-kb[data-mode="phone"] .sm-voice-actions { margin-top: 14px; }
