/* ==========================================================================
   Facebook Messenger Web Calling System - Light & Dark Theme
   ========================================================================== */

/* Modal Dialog Reset */
#modal .modal-dialog {
  max-width: 440px !important;
  margin: 2rem auto !important;
  transition: max-width 0.3s ease, margin 0.3s ease;
}
#modal:has(.is-video) .modal-dialog {
  max-width: 720px !important;
}
#modal .modal-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
}

/* Main Messenger Card Container */
.fb-messenger-call {
  position: relative !important;
  width: 100% !important;
  min-height: 480px !important;
  background: #ffffff !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 20px 24px 24px !important;
  color: #050505 !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  user-select: none !important;
  box-sizing: border-box !important;
  transition: background 0.3s ease, color 0.3s ease !important;
}

/* Night / Dark Mode Support */
body.night-mode .fb-messenger-call {
  background: #242526 !important;
  color: #e4e6eb !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

.fb-messenger-call.is-video {
  min-height: 540px !important;
}

/* Header Bar */
.fb-call-header {
  position: relative !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  height: 40px !important;
  margin-bottom: 8px !important;
}
.fb-header-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  background: #e4e6eb !important;
  border: none !important;
  color: #050505 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  outline: none !important;
}
.fb-header-btn:hover {
  background: #d8dadf !important;
  transform: scale(1.05) !important;
}
body.night-mode .fb-header-btn {
  background: #3a3b3c !important;
  color: #e4e6eb !important;
}
body.night-mode .fb-header-btn:hover {
  background: #4e4f50 !important;
}

.fb-header-title {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #050505 !important;
  letter-spacing: -0.2px !important;
}
.fb-header-title i {
  color: #0084ff !important;
  font-size: 18px !important;
}
body.night-mode .fb-header-title {
  color: #e4e6eb !important;
}

.fb-header-spacer {
  width: 36px !important;
}

/* Voice Call Center Body */
.fb-call-body {
  position: relative !important;
  z-index: 10 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 !important;
  padding: 15px 0 20px !important;
  text-align: center !important;
}
.fb-avatar-box {
  position: relative !important;
  width: 112px !important;
  height: 112px !important;
  margin: 0 auto 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.fb-avatar-img {
  width: 104px !important;
  height: 104px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 3px solid #ffffff !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15) !important;
  position: relative !important;
  z-index: 3 !important;
}
body.night-mode .fb-avatar-img {
  border-color: #3e4042 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

/* Pulsing Concentric Ripple */
.fb-avatar-box::before,
.fb-avatar-box::after {
  content: "" !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: 50% !important;
  border: 2px solid rgba(0, 132, 255, 0.5) !important;
  animation: fbMessengerPulse 2.4s infinite cubic-bezier(0.2, 0.8, 0.4, 1) !important;
  z-index: 1 !important;
  pointer-events: none !important;
}
.fb-avatar-box::after {
  animation-delay: 1.2s !important;
}
@keyframes fbMessengerPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}

.fb-caller-name {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #050505 !important;
  margin: 0 0 6px !important;
  letter-spacing: -0.3px !important;
}
body.night-mode .fb-caller-name {
  color: #ffffff !important;
}

.fb-call-status {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #65676b !important;
  margin: 0 0 8px !important;
}
body.night-mode .fb-call-status {
  color: #b0b3b8 !important;
}

.fb-call-timer {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #050505 !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: 0.5px !important;
  background: #f0f2f5 !important;
  padding: 4px 16px !important;
  border-radius: 20px !important;
  display: inline-block !important;
}
body.night-mode .fb-call-timer {
  background: #3a3b3c !important;
  color: #e4e6eb !important;
}

.fb-audio-waves {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  height: 22px !important;
  margin-top: 10px !important;
}
.fb-audio-waves span {
  width: 3.5px !important;
  height: 6px !important;
  background: #0084ff !important;
  border-radius: 2px !important;
  transition: height 0.08s ease !important;
}

/* Video Call Viewport */
.fb-video-wrapper {
  position: relative !important;
  width: 100% !important;
  height: 380px !important;
  background: #000000 !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  margin-bottom: 16px !important;
  z-index: 10 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
}
.fb-video-wrapper .video-call-stream {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #000000 !important;
}
.fb-video-wrapper .video-call-stream video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
.fb-video-wrapper .video-call-stream-local {
  position: absolute !important;
  bottom: 14px !important;
  right: 14px !important;
  width: 110px !important;
  height: 150px !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  border: 2px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  z-index: 15 !important;
  background: #1e293b !important;
  transition: transform 0.2s ease !important;
}
.fb-video-wrapper .video-call-stream-local:hover {
  transform: scale(1.05) !important;
}
.fb-video-wrapper .video-call-stream-local video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  transform: scaleX(-1) !important;
}
.fb-video-top-info {
  position: absolute !important;
  top: 12px !important;
  left: 14px !important;
  right: 14px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  z-index: 12 !important;
  background: linear-gradient(180deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%) !important;
  padding: 6px 12px !important;
  border-radius: 10px !important;
}
.fb-video-caller-name {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  margin: 0 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8) !important;
}
.fb-video-status {
  text-align: center !important;
  z-index: 10 !important;
  position: relative !important;
}

/* Bottom Controls Dock (Facebook Floating Capsule) */
.fb-call-dock-container {
  position: relative !important;
  z-index: 10 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  padding-top: 10px !important;
}
.fb-call-dock {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  background: #f0f2f5 !important;
  border: 1px solid #e4e6eb !important;
  border-radius: 40px !important;
  padding: 8px 16px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
}
body.night-mode .fb-call-dock {
  background: #3a3b3c !important;
  border-color: #4e4f50 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

.fb-dock-action {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  border: none !important;
  background: #e4e6eb !important;
  color: #050505 !important;
  font-size: 17px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.4, 1) !important;
  outline: none !important;
}
.fb-dock-action:hover {
  background: #d8dadf !important;
  transform: translateY(-2px) scale(1.05) !important;
}
.fb-dock-action:active {
  transform: translateY(1px) scale(0.96) !important;
}
body.night-mode .fb-dock-action {
  background: #4e4f50 !important;
  color: #e4e6eb !important;
}
body.night-mode .fb-dock-action:hover {
  background: #5c5d5e !important;
}

.fb-dock-action.active-muted {
  background: #e41e3f !important;
  color: #ffffff !important;
}
.fb-dock-action.btn-hangup {
  width: 52px !important;
  height: 52px !important;
  background: #e41e3f !important;
  color: #ffffff !important;
  font-size: 20px !important;
  box-shadow: 0 4px 14px rgba(228, 30, 63, 0.35) !important;
}
.fb-dock-action.btn-hangup:hover {
  background: #d01737 !important;
  box-shadow: 0 6px 18px rgba(228, 30, 63, 0.55) !important;
  transform: translateY(-2px) scale(1.06) !important;
}
.fb-dock-action.btn-close-call {
  background: #e4e6eb !important;
  color: #050505 !important;
}

/* Incoming Call Controls (Decline / Accept) */
.fb-incoming-dock {
  position: relative !important;
  z-index: 10 !important;
  display: flex !important;
  justify-content: space-around !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 280px !important;
  margin: 0 auto !important;
  padding: 10px 0 !important;
}
.fb-incoming-btn-box {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
}
.fb-circle-btn {
  width: 60px !important;
  height: 60px !important;
  border-radius: 50% !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 22px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.4, 1) !important;
  outline: none !important;
}
.fb-circle-btn:hover {
  transform: translateY(-2px) scale(1.06) !important;
}
.fb-circle-btn:active {
  transform: translateY(1px) scale(0.96) !important;
}
.fb-circle-btn.btn-decline {
  background: #e41e3f !important;
  box-shadow: 0 6px 18px rgba(228, 30, 63, 0.35) !important;
}
.fb-circle-btn.btn-decline:hover {
  background: #d01737 !important;
  box-shadow: 0 8px 22px rgba(228, 30, 63, 0.55) !important;
}
.fb-circle-btn.btn-accept {
  background: #31a24c !important;
  box-shadow: 0 6px 18px rgba(49, 162, 76, 0.35) !important;
  animation: fbAcceptRing 1.8s infinite !important;
}
.fb-circle-btn.btn-accept:hover {
  background: #2b9144 !important;
  box-shadow: 0 8px 22px rgba(49, 162, 76, 0.55) !important;
}
@keyframes fbAcceptRing {
  0% { box-shadow: 0 0 0 0 rgba(49, 162, 76, 0.7); }
  70% { box-shadow: 0 0 0 14px rgba(49, 162, 76, 0); }
  100% { box-shadow: 0 0 0 0 rgba(49, 162, 76, 0); }
}
.fb-incoming-btn-label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #65676b !important;
  letter-spacing: -0.1px !important;
}
body.night-mode .fb-incoming-btn-label {
  color: #b0b3b8 !important;
}

/* Mobile Responsiveness (Full-screen native experience) */
@media (max-width: 576px) {
  #modal .modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #modal .modal-content {
    height: 100% !important;
    border-radius: 0 !important;
  }
  .fb-messenger-call {
    height: 100vh !important;
    min-height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)) !important;
  }
  .fb-video-wrapper {
    height: calc(100vh - 190px) !important;
    border-radius: 14px !important;
  }
  .fb-call-dock {
    width: 100% !important;
    max-width: 340px !important;
    justify-content: space-around !important;
    gap: 8px !important;
    padding: 8px 12px !important;
  }
  .fb-dock-action {
    width: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
  }
  .fb-dock-action.btn-hangup {
    width: 48px !important;
    height: 48px !important;
    font-size: 18px !important;
  }
}
