/* ==========================================================================
   Direct messages: delivery states (sending / failed / seen) + private call controls
   ========================================================================== */

/* ---------- delivery states ---------- */
.sx-modal[data-view="thread"] .dm-bubble.pending {
  opacity: 0.62;
  transition: opacity 0.25s ease;
}

.sx-modal[data-view="thread"] .dm-row.mine .dm-bubble.failed {
  background: #3a1d1f;
  box-shadow: inset 0 0 0 1px rgba(255, 90, 82, 0.55);
  color: #ffd9d6;
  cursor: pointer;
}

.sx-modal[data-view="thread"] .dm-row.mine .dm-bubble.emoji.failed {
  background: none;
  box-shadow: none;
  opacity: 0.6;
}

.dm-row.is-failed {
  align-items: center;
  gap: 6px;
}

.dm-fail-ico {
  order: -1;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ff453a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.dm-fail {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 4px 2px;
  color: #ff6b62;
  font-size: 0.72rem;
  font-weight: 650;
  animation: dmFailIn 0.25s ease both;
}

.dm-fail-btn {
  padding: 3px 7px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #f2f2f4;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.dm-fail-btn.muted {
  background: none;
  color: #8e8e96;
}

.dm-fail-btn:active {
  transform: scale(0.95);
}

.sx-modal[data-view="thread"] .dm-seen.is-sending {
  color: #8e8e96;
  animation: dmSending 1.4s ease-in-out infinite;
}

.sx-modal[data-view="thread"] .dm-seen.is-seen {
  color: #c7c7cc;
}

.dm-preview.is-unsent .dm-preview-time,
.dm-list .dm-preview.is-unsent .dm-preview-time {
  color: #ff6b62;
  font-weight: 700;
}

@keyframes dmFailIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}

@keyframes dmSending {
  50% {
    opacity: 0.45;
  }
}

/* ---------- private call: labelled controls ---------- */
.pc-dock {
  gap: 14px;
  padding: 14px 18px 12px;
  border-radius: 30px;
}

.pc-ctl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 58px;
}

.pc-label {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.pc-ctl-gift:has(.pc-btn.hidden),
.pc.is-audio .pc-ctl-cam,
.pc.is-audio .pc-ctl-flip {
  display: none;
}

.pc-ctl .pc-btn.end {
  width: 58px;
  height: 58px;
}

.pc-ctl .pc-btn.end svg {
  width: 27px;
  height: 27px;
}

/* active states: white disc like iOS */
.pc.speaker-on #pcSpeakerBtn {
  background: #fff;
  color: #14181c;
}

#pcSpeakerBtn .pc-wave {
  transition: opacity 0.2s ease;
}

.pc:not(.speaker-on) #pcSpeakerBtn .pc-wave {
  opacity: 0.35;
}

.pc-btn:focus-visible {
  outline: 2px solid #5eead4;
  outline-offset: 3px;
}

/* back camera is not mirrored */
.pc.is-rear .pc-local {
  transform: none;
}

/* ---------- partner state + reconnecting ---------- */
.pc-peer-note {
  position: absolute;
  left: 50%;
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(14, 16, 20, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 650;
  text-align: center;
  transform: translateX(-50%);
  animation: pcNoteIn 0.3s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}

@keyframes pcNoteIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* partner turned the camera off: show their photo instead of a frozen / black frame */
.pc.is-video.peer-cam-off .pc-remote {
  opacity: 0;
}

.pc.is-video.peer-cam-off .pc-center {
  opacity: 1;
}

.pc.is-video.peer-cam-off .pc-bg,
.pc.is-video.peer-cam-off::before {
  opacity: 1;
}

.pc.is-reconnecting .pc-status {
  color: #ffd27a;
  animation: callBlink 1.4s ease-in-out infinite;
}

.pc.is-reconnecting .pc-remote {
  filter: blur(6px) brightness(0.7);
  transition: filter 0.4s ease, opacity 0.4s ease;
}

/* ---------- video call: tap to hide controls ---------- */
.pc.controls-hidden .pc-top {
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pc.controls-hidden .pc-controls {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pc.controls-hidden .pc-controls .pc-dock {
  pointer-events: none;
}

.pc-top,
.pc-controls {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ---------- audio output picker ---------- */
.pc-sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.45);
  animation: pcNoteIn 0.2s ease both;
}

.pc-sheet-card {
  width: min(420px, 100%);
  padding: 8px;
  border-radius: 22px;
  background: rgba(28, 30, 34, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.pc-sheet-title {
  margin: 8px 12px 6px;
  color: #8e8e96;
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pc-sheet-list {
  display: flex;
  flex-direction: column;
}

.pc-sheet-item,
.pc-sheet-cancel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: #f2f2f4;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.pc-sheet-item:hover,
.pc-sheet-item:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.pc-sheet-item.is-on {
  color: #5eead4;
}

.pc-sheet-check {
  font-weight: 900;
}

.pc-sheet-cancel {
  justify-content: center;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #c7c7cc;
}

@media (max-width: 380px) {
  .pc-dock {
    gap: 8px;
    padding: 12px 12px 10px;
  }

  .pc-ctl {
    min-width: 52px;
  }

  .pc-btn,
  .pc-ctl .pc-btn.end {
    width: 52px;
    height: 52px;
  }

  .pc-btn svg {
    width: 22px;
    height: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dm-fail,
  .pc-peer-note,
  .pc-sheet,
  .sx-modal[data-view="thread"] .dm-seen.is-sending,
  .pc.is-reconnecting .pc-status {
    animation: none;
  }
}

/* ---------- report: private call button + account reports ---------- */
.pc-report {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(14, 16, 20, 0.5);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

.pc-report svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pc-report:hover {
  background: rgba(255, 69, 58, 0.35);
}

.pc.controls-hidden .pc-report {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.report-modal.is-account .rp-shot,
.report-modal.is-account .rp-reason:has(input[value="weapon"]) {
  display: none;
}

.rp-account-note {
  margin: 4px 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #a1a1a6;
  font-size: 0.78rem;
  line-height: 1.45;
}
