/* Messenger calls — header buttons, recent list, overlay.
 * tip LOCK 20260804-gomax2-fast1 · tipSteal=0 */

.thread-header__actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  gap: 0;
}

.thread-header__actions[hidden] {
  display: none;
}

.thread-header__actions .btn-icon {
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
}

.view--calls {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.view--calls .view-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.calls-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.calls-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40vh;
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
}

.calls-empty strong {
  font-size: 17px;
  font-weight: 650;
  color: var(--text);
}

.calls-empty span {
  font-size: 14px;
  line-height: 1.4;
  max-width: 16em;
}

.call-row.is-missed .chat-row__name,
.call-row.is-missed .chat-row__preview {
  color: var(--danger, #dc2626);
}

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: #0b1220;
  color: #fff;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

.call-overlay[hidden],
.call-overlay.hidden {
  display: none;
}

.call-overlay__video {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #070b14;
}

.call-overlay:not(.call-overlay--video) .call-overlay__video {
  display: none;
}

.call-overlay__remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #070b14;
}

.call-overlay__pip {
  position: absolute;
  right: max(12px, env(safe-area-inset-right, 0px));
  top: max(12px, env(safe-area-inset-top, 0px));
  width: 108px;
  height: 152px;
  object-fit: cover;
  border-radius: 14px;
  background: #111827;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.call-overlay--video .call-overlay__pip {
  z-index: 2;
  top: max(56px, calc(env(safe-area-inset-top, 0px) + 52px));
}

.call-overlay__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.45) 28%, #0b1220);
}

.call-overlay:not(.call-overlay--video) .call-overlay__panel {
  flex: 1;
  justify-content: center;
  background: #0b1220;
}

/* Video: full-bleed remote; chrome sits on top, no solid half-screen slab. */
.call-overlay--video {
  display: block;
  background: #070b14;
}

.call-overlay--video .call-overlay__video {
  position: absolute;
  inset: 0;
  flex: none;
  min-height: 100%;
}

.call-overlay--video .call-overlay__panel {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  justify-items: center;
  align-content: stretch;
  gap: 4px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.38) 0%,
    rgba(0, 0, 0, 0.08) 18%,
    transparent 32%,
    transparent 62%,
    rgba(0, 0, 0, 0.22) 100%
  );
  pointer-events: none;
}

.call-overlay--video .call-overlay__name {
  grid-row: 1;
  font-size: 18px;
  font-weight: 650;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);
  pointer-events: auto;
}

.call-overlay--video .call-overlay__status {
  grid-row: 2;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  pointer-events: auto;
}

.call-overlay--video .call-overlay__actions {
  grid-row: 4;
  margin-top: 0;
  padding-top: 8px;
  pointer-events: auto;
}

.call-overlay--video .call-ctrl {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.call-overlay__name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-overlay__status {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.72);
  min-height: 1.2em;
}

.call-overlay[data-state="inbound"] .call-overlay__status {
  color: #93c5fd;
}

.call-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  margin-top: 20px;
  width: 100%;
  max-width: 420px;
  padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px));
}

.call-ctrl {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 72px;
  min-height: 72px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.call-ctrl svg {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  box-sizing: border-box;
}

.call-ctrl.is-off svg {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.45);
}

.call-ctrl--accept svg {
  background: #16a34a;
}

.call-ctrl--reject svg,
.call-ctrl--end svg {
  background: #dc2626;
}

.call-ctrl:active {
  transform: scale(0.96);
}

@media (prefers-reduced-motion: reduce) {
  .call-ctrl:active {
    transform: none;
  }
  .call-overlay[data-state="inbound"] .call-overlay__status {
    color: #fff;
  }
}

html[data-theme="dark"] .call-overlay {
  background: #05070c;
}
