/**
 * LiveKit Video Modal Styles
 * Full-screen video call overlay
 */

.livekit-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.livekit-modal {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #1a1a2e;
}

/* Header */
.livekit-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  z-index: 10;
}

.livekit-participant-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.livekit-status {
  color: #4ade80;
  font-size: 0.9rem;
}

.livekit-timer {
  font-family: monospace;
  font-size: 1rem;
  color: #94a3b8;
}

.livekit-participant-count {
  color: #64748b;
  font-size: 0.85rem;
}

/* Video Container */
.livekit-video-container {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Remote Videos - Grid Layout */
.livekit-remote-videos {
  flex: 1;
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}

/* Adaptive grid based on participant count */
.livekit-remote-videos:has(.livekit-participant:nth-child(2)) {
  grid-template-columns: repeat(2, 1fr);
}

.livekit-remote-videos:has(.livekit-participant:nth-child(5)) {
  grid-template-columns: repeat(3, 1fr);
}

.livekit-remote-videos:has(.livekit-participant:nth-child(10)) {
  grid-template-columns: repeat(4, 1fr);
}

/* Individual Participant */
.livekit-participant {
  position: relative;
  background: #2d2d44;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.livekit-participant .participant-name {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Local Video - Picture in Picture */
.livekit-local-video {
  position: absolute;
  bottom: 5rem;
  right: 1rem;
  width: 180px;
  height: 135px;
  background: #2d2d44;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #4ade80;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 5;
  transition: opacity 0.3s;
}

.livekit-local-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror local video */
}

/* Controls */
.livekit-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.7);
}

.livekit-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #374151;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.livekit-btn:hover {
  background: #4b5563;
  transform: scale(1.05);
}

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

.livekit-btn-end {
  background: #ef4444;
}

.livekit-btn-end:hover {
  background: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
  .livekit-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .livekit-local-video {
    width: 120px;
    height: 90px;
    bottom: 4.5rem;
    right: 0.5rem;
  }

  .livekit-btn {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .livekit-controls {
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .livekit-remote-videos {
    gap: 0.25rem;
    padding: 0.25rem;
  }
}

/* Empty State - Waiting for participants */
.livekit-remote-videos:empty::before {
  content: 'Waiting for others to join...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #64748b;
  font-size: 1.25rem;
}

/* Connection Quality Indicator */
.livekit-quality {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 2px;
}

.livekit-quality-bar {
  width: 4px;
  height: 12px;
  background: #4ade80;
  border-radius: 2px;
}

.livekit-quality-bar.weak {
  background: #fbbf24;
}

.livekit-quality-bar.poor {
  background: #ef4444;
}

/* Audio Level Indicator */
.livekit-audio-indicator {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.livekit-audio-indicator.speaking {
  background: #4ade80;
  animation: pulse 0.5s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Screen Share */
.livekit-screen-share {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
}

.livekit-screen-share video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: black;
}
