/* ─────────────────────────────────────────────────────────────────────────
   Assistant Manager call — the phone-call screen.

   Deliberately shaped like a native call screen, because that is the whole
   idea: this is not a chat with audio bolted on, it is a call. The furniture
   people already know — a running timer, the caller's name large at the top,
   a grid of round controls, one red button to hang up — carries the metaphor
   without a word of explanation.

   The palette is ours, not Apple's: the pitch-green and cyan the rest of the
   site runs on, over the app's near-black, rather than the iOS blue-grey.
   ───────────────────────────────────────────────────────────────────────── */

.amc-overlay {
  position: fixed;
  inset: 0;
  z-index: 2900;              /* above the voice overlay and the nav */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 20px
           calc(28px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  /* A call screen is a place, not a panel: full bleed, no card edges. */
  background:
    radial-gradient(90% 58% at 50% -6%, rgba(255, 197, 0, 0.1) 0%, transparent 65%),
    radial-gradient(78% 48% at 50% 108%, rgba(194, 21, 0, 0.09) 0%, transparent 68%),
    linear-gradient(180deg, #121214 0%, #0d0d0f 48%, #0a0a0b 100%);
  color: #fff;
}

.amc-overlay.show { opacity: 1; pointer-events: auto; }

/* ── Header: timer, name, status ─────────────────────────────────────── */

.amc-head {
  width: 100%;
  max-width: 460px;
  text-align: center;
  margin-top: 12px;
}

/* Tabular figures so the seconds do not jitter the layout on every tick. */
.amc-timer {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  min-height: 1.2em;
}

.amc-name {
  margin: 6px 0 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 7vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.amc-sub {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
}

/* ── The orb ─────────────────────────────────────────────────────────── */

.amc-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 100%;
  min-height: 0;              /* so the caption scrolls rather than pushes */
}

.amc-orb {
  position: relative;
  width: clamp(184px, 24vw, 248px);
  aspect-ratio: 1;
  border-radius: 50%;
  isolation: isolate;
  filter: drop-shadow(0 22px 38px rgba(0, 0, 0, 0.46));
  animation: amcFloat 5.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.amc-orb-canvas,
.amc-orb-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform: scale(calc(1 + (var(--amc-level, 0) * 0.085)));
  transition: transform 90ms linear, filter 180ms ease, opacity 180ms ease;
}

.amc-orb-canvas { display: block; }
.amc-orb-fallback { display: none; }

.amc-orb.is-fallback .amc-orb-canvas { display: none; }
.amc-orb.is-fallback .amc-orb-fallback {
  display: block;
  background:
    radial-gradient(circle at 28% 22%, #fff 0 8%, rgba(255,255,255,0.92) 14%, transparent 38%),
    radial-gradient(circle at 72% 70%, #c21500 0%, #f75001 34%, transparent 68%),
    linear-gradient(155deg, #fff 5%, #ffc500 40%, #f75001 72%, #c21500 100%);
}

.amc-overlay[data-state="ringing"] .amc-orb { animation-duration: 3.2s; }
.amc-overlay[data-state="speaking"] .amc-orb { filter: drop-shadow(0 26px 44px rgba(0, 0, 0, 0.58)); }
.amc-overlay[data-state="held"] .amc-orb { filter: grayscale(0.82) brightness(0.68); }
.amc-overlay[data-state="error"] .amc-orb { filter: saturate(0.72) brightness(0.82); }

@keyframes amcFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

/* ── Live caption ────────────────────────────────────────────────────── */

/* The call is not written to the chat, so this line is the only record of
   what was said — and the only way to follow it with the sound down. */
.amc-caption {
  width: 100%;
  max-width: 460px;
  max-height: 5.2em;
  overflow-y: auto;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  padding: 0 4px;
  overflow-wrap: anywhere;
}

.amc-caption:empty { display: none; }
.amc-caption.is-off { display: none; }

/* ── Hold banner ─────────────────────────────────────────────────────── */

.amc-banner {
  width: 100%;
  max-width: 400px;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  margin-bottom: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.amc-banner.show { display: flex; }
.amc-banner-text { flex: 1 1 auto; min-width: 0; text-align: left; }
.amc-banner-title { font-size: 0.9rem; font-weight: 700; }
.amc-banner-sub { font-size: 0.78rem; color: rgba(255, 255, 255, 0.6); margin-top: 1px; }

.amc-banner-btn {
  flex: 0 0 auto;
  padding: 7px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: #06130c;
  background: var(--tac-cyan, #22d3ee);
}

/* ── Controls ────────────────────────────────────────────────────────── */

.amc-pad {
  width: 100%;
  max-width: 340px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 5vw, 26px) clamp(18px, 8vw, 34px);
  justify-items: center;
}

.amc-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #fff;
  font: inherit;
}

.amc-key-face {
  width: clamp(58px, 17vw, 70px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.095);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
}

.amc-key:active .amc-key-face { transform: scale(0.94); }
.amc-key:focus-visible .amc-key-face { outline: 2px solid var(--tac-cyan, #22d3ee); outline-offset: 3px; }

/* Engaged controls invert, the way a call screen shows an active toggle. */
.amc-key[aria-pressed="true"] .amc-key-face { background: #fff; border-color: #fff; color: #0a0a0b; }

.amc-key-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.amc-key.is-end .amc-key-face {
  background: var(--tac-risk, #a52d25);
  color: #fff;
}

.amc-key[disabled] { opacity: 0.35; cursor: default; }
.amc-key[disabled]:active .amc-key-face { transform: none; }

/* ── Composer button ─────────────────────────────────────────────────── */

/* Sits with the mic and waveform buttons and inherits .chat-icon-btn, so it
   needs no sizing of its own — only the green that marks a call in progress. */
#btnAssistantCall.is-live { color: var(--tac-cyan, #22d3ee); }

/* ── Motion and contrast preferences ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .amc-overlay, .amc-orb, .amc-orb-canvas, .amc-orb-fallback, .amc-key-face { transition: none; }
  .amc-overlay[data-state] .amc-orb { animation: none; }
}

@media (prefers-contrast: more) {
  .amc-key-face { background: rgba(255, 255, 255, 0.22); }
  .amc-banner { border-width: 2px; }
}

/* Short screens: the orb yields first, so the controls stay reachable. */
@media (max-height: 680px) {
  .amc-orb { width: clamp(132px, 21vw, 170px); }
  .amc-stage { gap: 14px; }
  .amc-name { font-size: clamp(1.5rem, 6vw, 1.9rem); }
}

@media (max-width: 520px) {
  .amc-overlay {
    padding-inline: 18px;
    padding-top: calc(22px + env(safe-area-inset-top, 0px));
  }
  .amc-head { margin-top: 4px; }
  .amc-orb { width: clamp(174px, 52vw, 214px); }
  .amc-pad { max-width: 328px; }
  .amc-key-face { width: clamp(60px, 17vw, 68px); }
}
