/* fix79d — Voice call UI */

.voice-modal {
  position: fixed; inset: 0;
  background: rgba(8, 12, 24, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  animation: voice-fade 0.2s ease-out;
}

@keyframes voice-fade {
  from { opacity: 0; } to { opacity: 1; }
}

.voice-modal-card {
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px;
  min-width: 280px; max-width: 90vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.voice-incoming-pulse {
  width: 96px; height: 96px;
  border-radius: 50%;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #4f8cff, #6c5ce7);
  position: relative;
}

.voice-incoming-pulse::before,
.voice-incoming-pulse::after {
  content: ''; position: absolute; inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(79,140,255,0.5);
  animation: voice-pulse 1.6s ease-out infinite;
}
.voice-incoming-pulse::after { animation-delay: 0.8s; }

@keyframes voice-pulse {
  0%   { transform: scale(0.95); opacity: 0.9; }
  100% { transform: scale(1.4);  opacity: 0; }
}

.voice-incoming-name {
  font-size: 22px; font-weight: 600; margin-bottom: 4px; color: #1a1f36;
}

.voice-incoming-sub {
  font-size: 14px; color: #64748b; margin-bottom: 24px;
}

.voice-incoming-actions {
  display: flex; gap: 12px; justify-content: center;
}

.voice-btn {
  border: none; border-radius: 24px;
  padding: 10px 22px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform 0.1s ease, opacity 0.15s;
  font-family: inherit;
}

.voice-btn:active { transform: scale(0.96); }
.voice-btn:hover { opacity: 0.9; }

.voice-btn-accept {
  background: #10b981; color: #fff;
}
.voice-btn-decline {
  background: #ef4444; color: #fff;
}

.voice-incall-bar {
  position: fixed;
  bottom: 16px; right: 16px;
  background: #1a1f36;
  color: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex; gap: 12px; align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 9999;
  font-size: 13px;
  max-width: calc(100vw - 32px);
}

.voice-incall-name { font-weight: 600; }
.voice-incall-status { color: #94a3b8; font-size: 12px; }
.voice-incall-duration { color: #4f8cff; font-variant-numeric: tabular-nums; }

.voice-btn-mute {
  background: #334155; color: #fff;
  padding: 6px 14px; font-size: 12px;
}
.voice-btn-mute.voice-btn-muted { background: #f59e0b; }

.voice-btn-hangup {
  background: #ef4444; color: #fff;
  padding: 6px 14px; font-size: 12px;
}

@media (max-width: 600px) {
  .voice-incall-bar {
    bottom: 8px; right: 8px; left: 8px;
    justify-content: space-between;
  }
}

/* ============================================================ *
 * FIX82C-EARPIECE — speaker toggle button styling              *
 * ============================================================ */
.voice-btn-speaker {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    transition: background 0.15s ease;
}
.voice-btn-speaker:active {
    background: rgba(255, 255, 255, 0.25);
}
.voice-btn-speaker.voice-btn-speaker-on {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #000;
}

/* ============================================================ *
 * FIX86-MODAL — full-screen in-call UI                         *
 * Replaces the cramped bottom bar with a phone-call-style      *
 * modal. Blocks all page interaction during call.              *
 * ============================================================ */

.voice-incall-modal {
  /* inherits .voice-modal: position fixed, inset 0, backdrop, z-10000 */
  pointer-events: auto;
  cursor: default;
}

.voice-incall-card {
  background: linear-gradient(160deg, #1a1f36 0%, #0f1424 100%);
  color: #fff;
  border-radius: 24px;
  padding: 36px 28px 28px;
  min-width: 300px;
  max-width: 90vw;
  width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.voice-incall-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8cff, #6c5ce7);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(79,140,255,0.35);
}

.voice-incall-name-lg {
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  margin: 0;
}

.voice-incall-modal .voice-incall-status {
  font-size: 14px;
  color: #94a3b8;
  margin: 4px 0 2px;
}

.voice-incall-modal .voice-incall-duration {
  font-size: 18px;
  color: #4f8cff;
  font-variant-numeric: tabular-nums;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.voice-incall-controls {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
  width: 100%;
}

.voice-ctrl-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 80px;
  transition: transform 0.1s ease;
}

.voice-ctrl-btn:active {
  transform: scale(0.94);
}

.voice-ctrl-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  transition: background 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.voice-ctrl-btn:hover .voice-ctrl-icon {
  background: rgba(255,255,255,0.18);
}

.voice-ctrl-label {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
  user-select: none;
  -webkit-user-select: none;
}

.voice-ctrl-hangup .voice-ctrl-icon {
  background: #ef4444;
  transform: rotate(135deg);
}

.voice-ctrl-hangup:hover .voice-ctrl-icon {
  background: #dc2626;
}

.voice-ctrl-muted .voice-ctrl-icon {
  background: #f59e0b;
  color: #1a1f36;
}

/* Block all pointer events on the underlying page during a call.
 * Backdrop is fully opaque to clicks so users can't accidentally tap
 * page content. They can still scroll the modal itself. */
body:has(.voice-incall-modal) {
  overflow: hidden;
}

/* Mobile sizing — keep card centered, plenty of breathing room */
@media (max-width: 600px) {
  .voice-incall-card {
    width: calc(100vw - 32px);
    max-width: 360px;
    padding: 28px 20px 24px;
  }
  .voice-incall-avatar {
    width: 80px;
    height: 80px;
    font-size: 28px;
  }
  .voice-incall-name-lg {
    font-size: 22px;
  }
  .voice-ctrl-icon {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
  .voice-incall-controls {
    gap: 32px;
  }
}

/* Safari/iOS safe area awareness */
@supports (padding: env(safe-area-inset-bottom)) {
  .voice-incall-card {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
}

/* ============================================================ *
 * FIX87-DUAL-MODE — bar (default) + modal (expand)             *
 * Bar lets user keep browsing. Modal is focus mode.            *
 * ============================================================ */

/* --- Bar mode (default): compact bottom widget --- */
.voice-incall-bar {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: linear-gradient(135deg, #1a1f36 0%, #0f1424 100%);
  color: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 9999;
  font-size: 13px;
  /* Allow buttons to wrap if absolutely needed; flex-shrink prevents overflow */
}

.voice-bar-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 30%;
}

.voice-bar-status {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  flex: 0 0 auto;
  display: none;  /* hidden on narrow screens; status shown via duration */
}

.voice-bar-duration {
  font-size: 12px;
  color: #4f8cff;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  letter-spacing: 0.5px;
}

.voice-bar-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}
.voice-bar-btn:active { transform: scale(0.92); }
.voice-bar-btn:hover { background: rgba(255,255,255,0.18); }

.voice-bar-icon {
  font-size: 16px;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}

.voice-bar-btn.voice-bar-end {
  background: #ef4444;
}
.voice-bar-btn.voice-bar-end:hover { background: #dc2626; }
.voice-bar-btn.voice-bar-end .voice-bar-icon {
  transform: rotate(135deg);
  display: inline-block;
}

.voice-bar-btn.voice-bar-muted {
  background: #f59e0b;
}

.voice-bar-btn.voice-spk-on {
  background: #10b981;
}

/* On wider screens, show status text and shrink margins */
@media (min-width: 700px) {
  .voice-incall-bar {
    left: auto;
    right: 16px;
    width: 480px;
  }
  .voice-bar-status {
    display: inline;
  }
  .voice-bar-name {
    max-width: 40%;
  }
}

/* iPhone safe-area awareness for the bar */
@supports (padding: env(safe-area-inset-bottom)) {
  .voice-incall-bar {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* --- Modal mode: minimize button + speaker control --- */
.voice-modal-minimize {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;
  transition: background 0.15s ease;
}
.voice-modal-minimize:hover { background: rgba(255,255,255,0.22); }
.voice-modal-minimize:active { transform: scale(0.92); }

/* Speaker active state — green tint */
.voice-ctrl-btn.voice-spk-on .voice-ctrl-icon {
  background: #10b981;
  color: #fff;
}

/* Modal needs more space for the new minimize button */
.voice-incall-card {
  position: relative;
}

/* When in bar mode, DO NOT block page scroll */
body:has(.voice-incall-bar:not(.voice-incall-modal)) {
  overflow: auto;
}
