/* Enhanced WebRTC Calls CSS with Group Call Support */

/* Base call interface styles */
.webrtc-call-interface {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: white;
}

/* Call header */
.webrtc-call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.webrtc-call-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.webrtc-participant-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

/* Video container for 1:1 calls */
.webrtc-video-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.webrtc-remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.webrtc-local-video {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 120px;
  height: 90px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Group call video grid */
.webrtc-video-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  padding: 20px;
  overflow-y: auto;
}

.webrtc-video-grid.speaker-layout {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
}

.webrtc-participant-video {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
  min-height: 150px;
}

.webrtc-participant-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.webrtc-participant-name {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.webrtc-participant-status {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.webrtc-participant-status.local {
  background: rgba(76, 175, 80, 0.8);
}

/* Audio placeholder for voice calls */
.webrtc-audio-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
}

.webrtc-audio-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.webrtc-audio-text {
  font-size: 24px;
  font-weight: 500;
  margin: 0;
}

/* Call controls */
.webrtc-call-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.webrtc-call-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  font-size: 20px;
  color: white;
}

.webrtc-call-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.webrtc-call-btn:active {
  transform: scale(0.95);
}

/* Specific button styles */
.webrtc-call-btn.decline {
  background: #f44336;
}

.webrtc-call-btn.accept {
  background: #4CAF50;
}

/* Call popup styles */
.webrtc-call-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  backdrop-filter: blur(5px);
}

.webrtc-call-container {
  background: white;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.webrtc-caller-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 20px;
  object-fit: cover;
  border: 4px solid #e0e0e0;
}

.webrtc-caller-name {
  margin: 0 0 10px 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
}

.webrtc-call-type {
  margin: 0 0 30px 0;
  font-size: 16px;
  color: #666;
}

.webrtc-call-buttons {
  display: flex;
  justify-content: center;
  gap: 30px;
}

/* Incoming call popup */
.webrtc-incoming-call .webrtc-call-container {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Call ended popup */
.webrtc-call-ended .webrtc-call-container {
  animation: fadeIn 0.3s ease-out;
}

.webrtc-call-ended-icon {
  font-size: 48px;
  color: #f44336;
  margin-bottom: 20px;
}

.webrtc-call-ended-title {
  margin: 0 0 10px 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.webrtc-call-ended-message {
  margin: 0 0 20px 0;
  color: #666;
}

.webrtc-close-btn {
  background: #6c757d;
}

/* Error popup */
.webrtc-error-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  backdrop-filter: blur(5px);
}

.webrtc-error-popup > div {
  background: white;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Call history popup */
.webrtc-history-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10003;
  backdrop-filter: blur(5px);
}

.webrtc-history-container {
  background: white;
  border-radius: 20px;
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.webrtc-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
}

.webrtc-history-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.webrtc-history-close {
  background: #6c757d;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.webrtc-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.webrtc-history-item {
  display: flex;
  align-items: center;
  padding: 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.webrtc-history-item:hover {
  background-color: #f8f9fa;
}

.webrtc-history-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 15px;
}

.webrtc-history-info {
  flex: 1;
}

.webrtc-history-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
}

.webrtc-history-details {
  font-size: 14px;
  color: #666;
}

.webrtc-history-timestamp {
  font-size: 12px;
  color: #999;
}

.webrtc-history-empty {
  text-align: center;
  color: #666;
  padding: 40px 20px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .webrtc-call-header {
    padding: 15px;
  }
  
  .webrtc-call-title {
    font-size: 16px;
  }
  
  .webrtc-participant-count {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .webrtc-video-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    padding: 15px;
  }
  
  .webrtc-participant-video {
    min-height: 120px;
  }
  
  .webrtc-local-video {
    width: 80px;
    height: 60px;
    top: 15px;
    right: 15px;
  }
  
  .webrtc-call-controls {
    gap: 15px;
    padding: 15px;
  }
  
  .webrtc-call-btn {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }
  
  .webrtc-call-container {
    padding: 30px 20px;
  }
  
  .webrtc-caller-avatar {
    width: 80px;
    height: 80px;
  }
  
  .webrtc-caller-name {
    font-size: 20px;
  }
  
  .webrtc-call-buttons {
    gap: 20px;
  }
}

/* UI visibility controls */
.webrtc-ui-hidden .webrtc-call-header,
.webrtc-ui-hidden .webrtc-call-controls {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.webrtc-ui-visible .webrtc-call-header,
.webrtc-ui-visible .webrtc-call-controls {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

/* Video fit modes */
.webrtc-fit-cover {
  object-fit: cover;
}

.webrtc-fit-contain {
  object-fit: contain;
}

/* Screen sharing indicator */
.webrtc-sharing {
  border: 3px solid #FF9800;
}

.webrtc-sharing::before {
  content: "Screen Sharing";
  position: absolute;
  top: 10px;
  left: 10px;
  background: #FF9800;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  z-index: 1000;
}

/* Phone authentication modal styles */
.modal-box {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10004;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--navbar-bg );
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideInUp 0.3s ease-out;
}

.modal-title {
  margin: 0 0 20px 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
  text-align: center;
}

.auth-step {
  margin-bottom: 20px;
}

.otp-instruction {
  text-align: center;
  color: #666;
  margin-bottom: 20px;
  font-size: 14px;
}

.btn-phone {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-phone:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.message-box {
  margin-top: 15px;
}

.message {
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* reCAPTCHA container */
#recaptcha-container {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

/* Loading states */
.webrtc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.webrtc-loading::after {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
