/* style.css - v1.2.0 */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  height: 100vh;
  overflow: hidden;
}

.screen { height: 100vh; width: 100vw; }
.hidden { display: none !important; }

/* Join screen */
#join-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1e293b, #0f172a);
}

.join-card {
  background: #1e293b;
  padding: 2.5rem;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.join-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
  color: #38bdf8;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

.join-card label {
  display: block;
  font-size: 0.8rem;
  margin: 0.75rem 0 0.35rem;
  color: #94a3b8;
}

.join-card input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.room-row {
  display: flex;
  gap: 0.5rem;
}

.room-row input { flex: 1; }

.room-row button {
  background: #334155;
  border: none;
  border-radius: 8px;
  color: #e2e8f0;
  cursor: pointer;
  padding: 0 0.75rem;
  font-size: 1rem;
}

.primary-btn {
  margin-top: 1.5rem;
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: #38bdf8;
  color: #0f172a;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.primary-btn:hover { background: #0ea5e9; }

.error-msg {
  color: #f87171;
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: 0.75rem;
}

/* Room screen */
#room-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: #94a3b8;
}

.room-info button {
  background: #334155;
  border: none;
  color: #e2e8f0;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.danger-btn {
  background: #ef4444;
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.video-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  overflow-y: auto;
  align-content: start;
}

/* Modo destaque (spotlight) - usado quando alguém compartilha a tela, similar ao Google Meet */
.video-grid.spotlight-active {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  overflow: hidden;
}

#stageArea {
  flex: 1;
  min-width: 0;
  display: flex;
}

#stageArea .video-tile {
  width: 100%;
  height: 100%;
  aspect-ratio: unset;
}

#thumbRow {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex-shrink: 0;
  width: 220px;
}

#thumbRow .video-tile {
  width: 100%;
  flex-shrink: 0;
  aspect-ratio: 16/9;
}

@media (max-width: 768px) {
  .video-grid.spotlight-active {
    flex-direction: column;
  }
  #thumbRow {
    flex-direction: row;
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
  }
  #thumbRow .video-tile {
    width: 160px;
    min-width: 160px;
  }
}

.video-tile {
  position: relative;
  background: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
}

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

.video-tile .name-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.55);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.video-tile.muted .name-tag::after {
  content: ' 🔇';
}

.controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: #1e293b;
  border-top: 1px solid #334155;
}

.control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: #334155;
  color: #e2e8f0;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}

.control-btn:hover { background: #475569; }
.control-btn.off { background: #ef4444; }
