/* ─────────────────────────────────────────────────────────────────────────
   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(120% 80% at 50% 0%, rgba(0, 255, 135, 0.16) 0%, transparent 58%),
    radial-gradient(100% 70% at 50% 100%, rgba(4, 245, 255, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, #0f1a17 0%, #0b0f14 45%, #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: 22px;
  width: 100%;
  min-height: 0;              /* so the caption scrolls rather than pushes */
}

.amc-orb {
  width: clamp(112px, 30vw, 150px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #7dffc4 0%, #00ff87 38%, #04b8d6 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 12px 60px rgba(0, 255, 135, 0.22);
  /* Swells with whoever is talking; --amc-level is written every frame. */
  transform: scale(calc(1 + (var(--amc-level, 0) * 0.11)));
  transition: transform 0.09s linear;
}

.amc-overlay[data-state="ringing"] .amc-orb { animation: amcRing 1.4s ease-in-out infinite; }
.amc-overlay[data-state="listening"] .amc-orb { animation: amcBreathe 2.8s ease-in-out infinite; }
.amc-overlay[data-state="speaking"] .amc-orb { animation: amcPulse 0.9s ease-in-out infinite; }
.amc-overlay[data-state="held"] .amc-orb { filter: grayscale(0.85) brightness(0.6); }

@keyframes amcRing {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset, 0 12px 60px rgba(0,255,135,0.18); }
  50%      { box-shadow: 0 0 0 1px rgba(255,255,255,0.2) inset, 0 12px 80px rgba(0,255,135,0.42); }
}
@keyframes amcBreathe {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.13); }
}
@keyframes amcPulse {
  0%, 100% { filter: brightness(1.05) saturate(1); }
  50%      { filter: brightness(1.3) saturate(1.2); }
}

/* ── 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: 16px;
  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(--pl-green, #00ff87);
}

/* ── 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.12);
  transition: background 0.16s ease, color 0.16s ease, transform 0.1s ease;
}

.amc-key:active .amc-key-face { transform: scale(0.94); }
.amc-key:focus-visible .amc-key-face { outline: none; box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.5); }

/* Engaged controls invert, the way a call screen shows an active toggle. */
.amc-key[aria-pressed="true"] .amc-key-face { background: #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(--pl-red, #ff2d55);
  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(--pl-green, #00ff87); }

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

@media (prefers-reduced-motion: reduce) {
  .amc-overlay, .amc-orb, .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(84px, 20vw, 110px); }
  .amc-stage { gap: 14px; }
  .amc-name { font-size: clamp(1.5rem, 6vw, 1.9rem); }
}
