/* pages/public/call.css */

/* Pre-join screen */
.prejoin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px;
}

.prejoin-preview {
  width: 320px;
  height: 240px;
  background: #222;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.prejoin-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.prejoin-preview .no-camera {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 14px;
}

.prejoin-controls {
  display: flex;
  gap: 12px;
}

.prejoin-controls button {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: #eee;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.prejoin-controls button:hover {
  background: rgba(255,255,255,0.2);
}

.prejoin-controls button.active {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}

.prejoin-controls button.off {
  opacity: 0.5;
}

.join-btn {
  padding: 12px 32px;
  border-radius: 10px;
  border: none;
  background: #fff;
  color: #111;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.join-btn:hover {
  opacity: 0.85;
}

.join-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* In-call view */
.call-view {
  position: fixed;
  inset: 0;
  background: #111;
  display: flex;
  flex-direction: column;
}

.video-grid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  flex-wrap: wrap;
}

.video-tile {
  position: relative;
  background: #222;
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
  max-width: 640px;
  min-width: 280px;
  aspect-ratio: 16/9;
}

/* Remote peers container */
.remote-container {
  display: contents;
}

/* When 2+ remote peers, shrink tiles to fit in a grid */
.remote-container.remote-count-2 .video-tile,
.remote-container.remote-count-3 .video-tile {
  max-width: 480px;
}

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

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

.video-tile .label {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 12px;
  color: #fff;
  background: rgba(0,0,0,0.5);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Controls bar */
.call-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0,0,0,0.4);
}

.call-controls button {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #eee;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-controls button:hover {
  background: rgba(255,255,255,0.25);
}

.call-controls button.off {
  background: rgba(255,255,255,0.08);
  color: #888;
}

.call-controls button.end-call {
  background: #e53935;
  color: #fff;
  width: 56px;
  height: 56px;
  border-radius: 28px;
}

.call-controls button.end-call:hover {
  background: #c62828;
}

/* Status messages */
.call-status {
  text-align: center;
  color: #888;
  font-size: 14px;
  padding: 8px;
}

/* Connecting overlay */
.connecting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}

.connecting-overlay .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
