/* ══════════════════════════════════════════════════════════════════
   SORRY KITTY — DIRECT CHAT CALL & VIDEO CALL STYLES (v3.0)
   Modern FaceTime / Premium Messenger UI
   Edge-to-Edge Video, Floating Frosted Capsule Dock, Upper-Right PiP,
   Frosted Circular Back Button, and Luxury Voice Call Experience.
   ══════════════════════════════════════════════════════════════════ */

/* Top bar call action buttons in normal chat header */
.moment-call-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .18s cubic-bezier(.34,1.56,.64,1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
  padding: 0;
}
.moment-call-btn:hover {
  background: #e2e8f0;
  color: #102a56;
  transform: scale(1.08);
}
.moment-call-btn:active {
  transform: scale(0.92);
}
.moment-call-btn--video {
  color: #0284c7;
}
.moment-call-btn--video:hover {
  background: #e0f2fe;
  color: #0369a1;
}
.moment-call-btn--voice {
  color: #059669;
}
.moment-call-btn--voice:hover {
  background: #d1fae5;
  color: #047857;
}

/* ══════════════════════════════════════════════════════════════════
   DIRECT CALL ACTIVE OVERLAY (FULL SCREEN VIEWPORT)
   ══════════════════════════════════════════════════════════════════ */
.direct-call-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 200000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity .26s ease;
  background: #090d16;
}
.direct-call-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Ambient Deep Backdrop */
.dc-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 25%, #1e293b 0%, #0f172a 65%, #020617 100%);
  opacity: 0.98;
  z-index: 0;
}
.direct-call-overlay.is-video-call .dc-backdrop {
  opacity: 0;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════
   TOP NAVIGATION HEADER BAR
   Frosted circular back button, centered title, duration badge
   ══════════════════════════════════════════════════════════════════ */
.dc-top-bar {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  left: 18px;
  right: 18px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
}

/* Circular Frosted Back Button (as in reference UI) */
.dc-back-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all .18s cubic-bezier(.34,1.4,.64,1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.dc-back-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.06);
}
.dc-back-btn:active {
  transform: scale(0.92);
}

/* Centered Header Title & Subtitle */
.dc-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  max-width: calc(100% - 100px);
  margin: 0 10px;
}
.dc-header-title {
  font-size: 16.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.dc-header-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.dc-call-type-badge {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 1.5px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
.direct-call-overlay.is-video-call .dc-call-type-badge {
  display: none;
}
.dc-duration {
  font-family: 'Space Grotesk', -apple-system, monospace, sans-serif;
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1.5px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Empty spacer on right for balance */
.dc-top-spacer {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   MAIN CALL STAGE
   ══════════════════════════════════════════════════════════════════ */
.dc-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* ══════════════════════════════════════════════════════════════════
   VIDEO CALL STAGE (FULL SCREEN EDGE-TO-EDGE)
   Remote video fills screen, PiP in upper right
   ══════════════════════════════════════════════════════════════════ */
.dc-video-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000000;
  z-index: 2;
}

/* Gradient scrim overlays so controls & top title remain super clear */
.dc-scrim {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 15;
}
.dc-scrim-top {
  top: 0;
  height: 150px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.22) 55%, transparent 100%);
}
.dc-scrim-bottom {
  bottom: 0;
  height: 180px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.28) 60%, transparent 100%);
}

.dc-remote-video-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  overflow: hidden;
}
.dc-remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000000;
  z-index: 2;
}
.dc-remote-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #1e293b 0%, #0f172a 60%, #020617 100%);
  gap: 12px;
}
.dc-remote-label {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Video In-Call Speech Bubble Caption */
.dc-video-caption {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  left: 18px;
  right: 135px; /* Leaves space for upper-right PiP */
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 10px 14px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  z-index: 22;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  animation: dcCaptionIn .24s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes dcCaptionIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ══════════════════════════════════════════════════════════════════
   PICTURE-IN-PICTURE (SELF VIDEO FEED IN UPPER RIGHT)
   Matches the exact corner placement & aspect ratio in reference image
   ══════════════════════════════════════════════════════════════════ */
.dc-local-pip-wrap {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  right: 18px;
  width: 108px;
  height: 154px;
  border-radius: 18px;
  overflow: hidden;
  background: #1e293b;
  border: 2.2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.2);
  z-index: 26;
  transition: transform .22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.dc-local-pip-wrap:hover {
  transform: scale(1.03);
}
.dc-local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror selfie feed */
  display: block;
}
.dc-local-cam-off {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.94);
  color: #ef4444;
}
.dc-flip-cam-btn {
  display: none; /* Flip camera is placed directly in the bottom dock! */
}

/* ══════════════════════════════════════════════════════════════════
   AUDIO CALL STAGE (VOICE CALL EXPERIENCE)
   Centered avatar with glowing aura, ripples & voice equalizer waves
   ══════════════════════════════════════════════════════════════════ */
.dc-audio-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 5;
  padding: 20px;
  box-sizing: border-box;
}

/* Soft ambient pulsating radial aura behind the avatar */
.dc-audio-aura {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18) 0%, rgba(236, 72, 153, 0.1) 45%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  animation: dcPulseAura 4s ease-in-out infinite alternate;
}
@keyframes dcPulseAura {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

.dc-avatar-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dc-avatar-circle {
  position: relative;
  z-index: 4;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  overflow: hidden;
}
.dc-avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Concentric Voice Waves / Ripples */
.dc-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.4);
  pointer-events: none;
  animation: dcRipple 2.6s cubic-bezier(0.1, 0.2, 0.3, 1) infinite;
}
.dc-ripple-1 { animation-delay: 0s; }
.dc-ripple-2 { animation-delay: 0.85s; border-color: rgba(236, 72, 153, 0.35); }
.dc-ripple-3 { animation-delay: 1.7s; border-color: rgba(56, 189, 248, 0.25); }

@keyframes dcRipple {
  0% { transform: scale(0.85); opacity: 0.95; }
  100% { transform: scale(1.75); opacity: 0; }
}

.dc-peer-name {
  color: #ffffff;
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 6px 0;
  letter-spacing: -0.4px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 4;
}
.dc-status-text {
  color: #94a3b8;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 22px 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 4;
}

/* Audio wave bars */
.dc-wave-container {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 6px 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 4;
}
.dc-wave-bar {
  width: 4px;
  height: 6px;
  background: #38bdf8;
  border-radius: 4px;
  animation: dcWave 1.2s ease-in-out infinite alternate;
}
.dc-wave-bar:nth-child(1) { animation-delay: 0.1s; }
.dc-wave-bar:nth-child(2) { animation-delay: 0.3s; }
.dc-wave-bar:nth-child(3) { animation-delay: 0.5s; height: 18px; }
.dc-wave-bar:nth-child(4) { animation-delay: 0.2s; height: 22px; }
.dc-wave-bar:nth-child(5) { animation-delay: 0.6s; height: 14px; }
.dc-wave-bar:nth-child(6) { animation-delay: 0.4s; }
.dc-wave-bar:nth-child(7) { animation-delay: 0.2s; }

@keyframes dcWave {
  0% { height: 4px; opacity: 0.4; }
  100% { height: 24px; opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════
   BOTTOM CONTROLS FLOATING CAPSULE DOCK
   Matches the reference image exactly:
   Cam | Mic | Flip | Speaker | Red Hangup
   ══════════════════════════════════════════════════════════════════ */
.dc-controls-tray {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 36px);
  max-width: 350px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(36, 36, 42, 0.72);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 44px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
}

.dc-ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .18s cubic-bezier(.34,1.4,.64,1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 0;
  flex-shrink: 0;
}
.dc-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.08);
}
.dc-ctrl-btn:active {
  transform: scale(0.92);
}
.dc-ctrl-btn.is-muted,
.dc-ctrl-btn.is-off {
  background: rgba(239, 68, 68, 0.22);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.38);
}

/* Distinct Prominent Red Hangup Button (as in reference UI) */
.dc-ctrl-btn--hangup {
  background: #ef4444 !important;
  color: #ffffff !important;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}
.dc-ctrl-btn--hangup:hover {
  background: #dc2626 !important;
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.65);
}
.dc-ctrl-btn--hangup:active {
  transform: scale(0.92);
}

/* ══════════════════════════════════════════════════════════════════
   INCOMING CALL SHEET / NOTIFICATION MODAL
   ══════════════════════════════════════════════════════════════════ */
.direct-incoming-overlay {
  position: fixed;
  inset: 0;
  z-index: 200010 !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-left: 16px;
  padding-right: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .24s ease;
  font-family: 'Nunito', sans-serif;
}
.direct-incoming-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.di-card {
  width: 100%;
  max-width: 400px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: diSlideDown .36s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

@keyframes diSlideDown {
  from { transform: translateY(-40px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.di-caller-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 14px;
}

.di-caller-avatar-wrap {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.di-avatar {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
  border: 3px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 8px 20px rgba(255, 117, 140, 0.35);
  overflow: hidden;
}
.di-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.di-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  animation: diPulse 2s cubic-bezier(0.1, 0.2, 0.3, 1) infinite;
}
.di-ripple-1 { animation-delay: 0s; }
.di-ripple-2 { animation-delay: 1s; }

@keyframes diPulse {
  0% { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

.di-caller-name {
  color: #f8fafc;
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 4px 0;
}
.di-subtext {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 20px 0;
}

.di-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 100%;
}
.di-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.di-action-btn svg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 14px;
  box-sizing: border-box;
  transition: all .18s cubic-bezier(.34,1.56,.64,1);
}
.di-action-btn--decline svg {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}
.di-action-btn--decline:hover svg {
  background: #dc2626;
  transform: scale(1.1);
}
.di-action-btn--decline:active svg {
  transform: scale(0.92);
}
.di-action-btn--accept svg {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
  animation: diAcceptPulse 1.8s ease-in-out infinite;
}
.di-action-btn--accept:hover svg {
  background: #059669;
  transform: scale(1.1);
}
.di-action-btn--accept:active svg {
  transform: scale(0.92);
}

@keyframes diAcceptPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.6); }
}

@media (max-width: 480px) {
  .dc-avatar-container {
    width: 120px;
    height: 120px;
  }
  .dc-avatar-circle {
    width: 104px;
    height: 104px;
    font-size: 44px;
  }
  .dc-peer-name {
    font-size: 22px;
  }
  .dc-local-pip-wrap {
    width: 96px;
    height: 138px;
    right: 14px;
    top: calc(env(safe-area-inset-top, 0px) + 66px);
  }
  .dc-controls-tray {
    width: calc(100% - 30px);
    padding: 7px 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  }
  .dc-ctrl-btn {
    width: 40px;
    height: 40px;
  }
  .dc-ctrl-btn--hangup {
    width: 44px;
    height: 44px;
  }
}
