/* ПОМОР — Фаза 2: стили оверлея голосового звонка (Трек B2).
 * Поверх tokens.css; подключается из base.html.
 * Палитра/радиусы/тени берём из дизайн-токенов (:root в tokens.css).
 * [x-cloak] { display:none } уже задан глобально в styles.css. */

/* Полноэкранный оверлей поверх модалки (.modal z-index 200) и FAB (90). */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.call-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 27, 38, .62);
  backdrop-filter: blur(6px);
  animation: callFade .25s var(--ease);
}

.call-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.75rem, 5vw, 2.5rem) clamp(1.25rem, 4vw, 2rem) clamp(1.5rem, 4vw, 2rem);
  text-align: center;
  animation: callCardIn .35s var(--ease);
}

/* ---- Аватар / иконка ---- */
.call-avatar {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  background: var(--teal-050);
  color: var(--teal-600);
  display: grid;
  place-items: center;
}
.call-avatar-icon {
  font-size: 2.4rem;
  line-height: 1;
}
.call-card.is-incall .call-avatar {
  background: rgba(31, 174, 111, .14);
  color: var(--ok);
}
.call-card.is-error .call-avatar {
  background: rgba(229, 72, 77, .12);
  color: var(--danger);
}

/* Пульсирующие кольца дозвона. */
.call-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(15, 163, 163, .45);
  animation: callPulse 1.8s ease-out infinite;
}

/* ---- Тексты ---- */
.call-peer {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 .35rem;
}
.call-status {
  color: var(--muted);
  font-size: .98rem;
  margin: 0;
  min-height: 1.4em;
}
.call-timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ok);
  margin: 0;
  letter-spacing: .02em;
}
.call-error {
  color: var(--danger);
  font-size: .98rem;
  font-weight: 500;
  margin: 0;
}
.call-hint {
  color: var(--muted);
  font-size: .85rem;
  margin: .75rem 0 0;
}

/* ---- Кнопки управления ---- */
.call-actions {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 1.6rem;
}
.call-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.call-btn > span:first-child {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  box-shadow: var(--shadow);
  transition: transform .18s var(--ease), background-color .2s var(--ease),
    box-shadow .2s var(--ease);
}
.call-btn:hover > span:first-child {
  transform: translateY(-2px);
}
.call-btn:active > span:first-child {
  transform: translateY(0);
}
.call-btn-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}

.call-btn--mute.is-muted > span:first-child {
  background: var(--graphite);
  color: #fff;
}
.call-btn--hangup > span:first-child {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 24px rgba(229, 72, 77, .35);
}
.call-btn--hangup:hover > span:first-child {
  box-shadow: 0 14px 30px rgba(229, 72, 77, .45);
}

/* Кнопка «Закрыть» — обычная пилюля. */
.call-btn--close {
  flex-direction: row;
  font-size: 1rem;
  padding: .7rem 1.6rem;
  border-radius: 999px;
  background: var(--bg);
  font-weight: 700;
  transition: background-color .2s var(--ease);
}
.call-btn--close:hover {
  background: var(--line);
}
.call-btn--close .call-btn-label {
  color: var(--ink);
  font-size: 1rem;
}

/* Кнопка «Позвонить онлайн» на странице контактов (styles.css не трогаем). */
.contact-call-online {
  margin-top: 1rem;
  align-self: start;
}

/* Скрытый аудиоэлемент: не занимает место, но в DOM. */
.call-remote-audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---- Адаптив ---- */
@media (max-width: 420px) {
  .call-overlay {
    /* На узких экранах карточку прижимаем книзу как нативный звонок. */
    place-items: end center;
    padding-bottom: 2rem;
  }
  .call-card {
    max-width: 100%;
  }
  .call-actions {
    gap: 1.1rem;
  }
}

/* ---- Анимации ---- */
@keyframes callFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes callCardIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes callPulse {
  0% { box-shadow: 0 0 0 0 rgba(15, 163, 163, .45); }
  70% { box-shadow: 0 0 0 18px rgba(15, 163, 163, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 163, 163, 0); }
}

/* ---- Уважаем prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  .call-backdrop,
  .call-card,
  .call-pulse {
    animation: none;
  }
  .call-btn:hover > span:first-child,
  .call-btn:active > span:first-child {
    transform: none;
  }
}
