/* WebRTC Call Styles */

.call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 39, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-container {
  width: 100%;
  height: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.call-videos {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1f2937;
  border-radius: 16px;
  overflow: hidden;
}

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

.local-video {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.call-controls {
  padding: 20px;
  text-align: center;
}

.call-status {
  color: white;
  font-size: 18px;
  margin-bottom: 20px;
}

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

.call-btn {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.call-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

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

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

.call-btn.muted {
  background: #f59e0b;
}

.call-btn.hand-raised {
  background: #f59e0b;
  animation: recordingPulse 1.5s infinite;
}

.call-btn.speaking {
  background: #059669;
}

/* Incoming call modal */
.incoming-call-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.incoming-call-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.incoming-call-content h3 {
  margin-bottom: 10px;
  color: var(--dark);
}

.incoming-call-content p {
  color: var(--gray);
  margin-bottom: 30px;
}

.incoming-call-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.incoming-call-actions .btn {
  padding: 12px 25px;
  border-radius: 30px;
}

@media (max-width: 768px) {
  .local-video {
    width: 120px;
    height: 90px;
    bottom: 10px;
    right: 10px;
  }
}

/* ===== Audio meeting room ===== */
.audio-room {
  max-width: 720px;
  margin: 0 auto;
  padding: 30px 20px;
}

.audio-room-timer {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-muted, #666);
  margin-bottom: 20px;
  direction: ltr;
}

.audio-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  margin-bottom: 30px;
}

.audio-participant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 120px;
}

.audio-participant-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6a5af9, #4a3ff0);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  border: 3px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}

.audio-participant-avatar.speaking {
  border-color: #34d399;
  box-shadow: 0 0 0 4px rgba(52,211,153,.25);
}

.audio-participant-avatar.is-muted {
  opacity: .55;
}

.audio-participant-name {
  font-weight: 600;
  font-size: .95rem;
  text-align: center;
}

.audio-participant-role {
  font-size: .8rem;
  color: var(--text-muted, #888);
}

/* Waiting room */
.waiting-room-screen {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
  padding: 30px 20px;
}

.waiting-guest-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.waiting-guest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background: var(--card-bg, #f7f7fb);
  border-radius: 10px;
}

.waiting-guest-item .admit-btn,
.waiting-guest-item .deny-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .85rem;
  border: none;
  cursor: pointer;
  margin-inline-start: 6px;
}

.waiting-guest-item .admit-btn {
  background: #34d399;
  color: #fff;
}

.waiting-guest-item .deny-btn {
  background: #f87171;
  color: #fff;
}

/* Recording indicator */
.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ef4444;
  font-weight: 600;
  font-size: .85rem;
}

.recording-indicator .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: recordingPulse 1.2s infinite;
}

@keyframes recordingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.call-btn.recording-active {
  background: #ef4444 !important;
  color: #fff !important;
}

/* Booking UI */
.booking-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.booking-slot-btn {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color, #ddd);
  background: #fff;
  cursor: pointer;
  font-size: .9rem;
  direction: ltr;
}

.booking-slot-btn.selected {
  background: #6a5af9;
  color: #fff;
  border-color: #6a5af9;
}

.booking-slot-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  text-decoration: line-through;
}

.booking-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .8rem;
  font-weight: 600;
}

.booking-status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.booking-status-badge.confirmed {
  background: #d1fae5;
  color: #065f46;
}

.booking-status-badge.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.booking-status-badge.completed {
  background: #e0e7ff;
  color: #3730a3;
}

/* Meeting chat */
.meeting-chat-panel {
  border: 1px solid var(--border-color, #eee);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 320px;
  margin-top: 20px;
}

.meeting-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meeting-chat-message {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--card-bg, #f2f2f7);
  font-size: .9rem;
}

.meeting-chat-message strong {
  display: block;
  font-size: .8rem;
  color: #6a5af9;
  margin-bottom: 2px;
}

.meeting-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border-color, #eee);
}

.meeting-chat-input-row input {
  flex: 1;
  border-radius: 20px;
  border: 1px solid var(--border-color, #ddd);
  padding: 8px 14px;
}

/* ===== Parent-Teacher Video Meeting Room (LiveKit) ===== */
.video-meeting-room {
  max-width: 1200px;
  margin: 0 auto;
}

.video-meeting-header {
  text-align: center;
  margin-bottom: 16px;
}

.video-meeting-header h2 {
  margin-bottom: 4px;
}

.video-meeting-header p {
  color: #888;
  margin: 0;
}

.video-meeting-body {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.video-meeting-main {
  flex: 1;
  min-width: 0;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.video-tile {
  position: relative;
  background: #111827;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(1);
}

.video-tile.is-local video {
  transform: scaleX(-1);
}

.video-tile .video-tile-avatar {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6a5af9, #8b7bff);
}

.video-tile.video-off .video-tile-avatar {
  display: flex;
}

.video-tile.video-off video {
  visibility: hidden;
}

.video-tile .video-tile-avatar .initial {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
}

.video-tile-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  color: #fff;
  font-size: 0.85rem;
}

.video-tile-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-tile-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-tile-icons .mic-off-icon {
  color: #ef4444;
}

.video-tile-icons .hand-icon {
  color: #fbbf24;
  animation: recordingPulse 1.2s infinite;
}

.screen-share-wrap {
  text-align: center;
  margin-bottom: 16px;
}

.screen-share-wrap video {
  max-width: 100%;
  border-radius: 12px;
  background: #000;
}

.video-meeting-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.call-btn.muted {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

.video-meeting-sidebar {
  width: 320px;
  flex-shrink: 0;
}

.video-meeting-sidebar .meeting-chat-panel {
  height: 560px;
  display: flex;
  flex-direction: column;
}

.video-meeting-sidebar .meeting-chat-messages {
  flex: 1;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .video-meeting-body {
    flex-direction: column;
  }

  .video-meeting-sidebar {
    width: 100%;
  }

  .video-meeting-sidebar .meeting-chat-panel {
    height: 360px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 560px) {
  .video-meeting-controls .call-btn,
  .video-meeting-controls .btn {
    flex: 1 1 45%;
    font-size: 0.85rem;
    padding: 10px 8px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .video-tile-name {
    font-size: 0.75rem;
  }
}
