/* Call screen laid out like Discord's: black stage, 16:9 tiles, a stream in
   focus with a hover bar, a people strip that the arrow hides, ‹ › between
   streams, and grid / full screen buttons at the top. Loaded after stage.css. */

.stage,
.call-stage {
  background: #000;
}

.call-stage {
  position: relative;
}

.call-stage:fullscreen {
  padding-bottom: 8px;
}

/* ---------- top right: grid / full screen ---------- */

.stage-topbar {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 6;
  display: flex;
  gap: 8px;
}

.stage-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(30, 31, 34, 0.8);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.stage-top-btn:hover {
  background: #3a3c42;
}

.grid-glyph {
  font-size: 16px;
  line-height: 1;
}

/* ---------- grid of tiles ---------- */

.call-stage .stage-grid:not(.strip) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 8px;
  padding: 52px 16px 8px;
  overflow-y: auto;
}

/* Tile size by how many there are, centered like Discord (a lone last tile
   sits in the middle of its row). */
.call-stage .stage-grid:not(.strip) > * {
  width: calc(33.333% - 6px);
  max-width: 480px;
  aspect-ratio: 16 / 9;
  height: auto;
  flex: none;
}

.call-stage .stage-grid:not(.strip)[data-count='1'] > * {
  width: min(100%, 900px);
  max-width: none;
}

.call-stage .stage-grid:not(.strip):is([data-count='2'], [data-count='3'], [data-count='4']) > * {
  width: calc(50% - 4px);
  max-width: 620px;
}

.call-stage .tile.person {
  border: 0;
  border-radius: 8px;
  background: hsl(var(--tile-hue, 250) 32% 28%);
  box-shadow: inset 0 0 0 0 var(--ok);
  transition: box-shadow 0.12s;
}

.call-stage .tile.person.speaking {
  box-shadow: inset 0 0 0 3px var(--ok);
}

.call-stage .tile-name {
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  overflow: hidden;
}

.call-stage .tile-name svg {
  flex: none;
  color: var(--danger);
}

.tile-live {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ---------- a stream in focus ---------- */

.call-stage.has-focus .stage-focus {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 8px 12px 0;
}

.stage-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 40px;
  height: 72px;
  margin-top: -36px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.stage-arrow.left {
  left: 22px;
}

.stage-arrow.right {
  right: 22px;
}

.stage-focus:hover .stage-arrow,
.stage-arrow:focus-visible {
  opacity: 1;
}

.stage-arrow:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* The little arrow that hides / shows the people under the stream. */
.stage-strip-toggle {
  display: none;
}

.call-stage.has-focus .stage-strip-toggle {
  display: block;
  align-self: center;
  width: 56px;
  height: 18px;
  margin: 6px auto 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.stage-strip-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}

.chevron-shape {
  display: block;
  width: 8px;
  height: 8px;
  margin: -3px auto 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.chevron-shape.up {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.call-stage.strip-hidden .stage-grid.strip {
  display: none;
}

.call-stage .stage-grid.strip {
  justify-content: center;
  height: 112px;
  padding: 6px 12px 0;
}

.call-stage .stage-grid.strip > * {
  width: 180px;
  height: 100%;
}

.call-stage .stage-grid.strip .avatar {
  --avatar-size: 44px !important;
}

/* ---------- the stream viewer ---------- */

.viewer {
  border-radius: 8px;
}

.call-stage .stage-grid:not(.strip) .viewer.thumb {
  grid-column: auto;
}

.viewer.thumb .viewer-bar,
.viewer.thumb .viewer-close,
.viewer.thumb .viewer-zoom-chip {
  display: none;
}

.viewer-thumb-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}

.viewer.focus .viewer-thumb-label {
  display: none;
}

/* Bar that shows on hover: name + AO VIVO on the left, buttons on the right. */
.viewer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 32px 12px 10px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  opacity: 0;
  transition: opacity 0.15s;
}

.viewer.focus:hover .viewer-bar,
.viewer.focus:focus-within .viewer-bar,
.viewer:fullscreen:hover .viewer-bar {
  opacity: 1;
}

.viewer-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.viewer-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-bar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.viewer-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #fff;
  cursor: pointer;
}

.viewer-icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

.viewer-volume {
  display: flex;
  align-items: center;
}

.viewer-volume-range {
  width: 0;
  margin: 0;
  opacity: 0;
  accent-color: #fff;
  transition: width 0.15s, opacity 0.15s, margin 0.15s;
}

.viewer-volume:hover .viewer-volume-range,
.viewer-volume:focus-within .viewer-volume-range {
  width: 100px;
  margin: 0 8px 0 2px;
  opacity: 1;
}

/* X: stop watching (back to the grid). */
.viewer-close {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.viewer.focus:hover .viewer-close {
  opacity: 1;
}

.viewer-close:hover {
  background: var(--danger);
}

.viewer-zoom-chip {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 4;
  display: none;
  transform: translateX(-50%);
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.viewer.focus.zoomed .viewer-zoom-chip {
  display: block;
}

/* A stream you closed: dimmed, with "Assistir transmissão". */
.viewer-watch {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
}

.viewer.not-watching .viewer-watch {
  display: grid;
}

.viewer.not-watching .viewer-video {
  opacity: 0.2;
}

/* ---------- call buttons ---------- */

.call-stage .stage-controls {
  padding: 10px 0 14px;
}

.call-stage .round-btn {
  width: 48px;
  height: 48px;
  background: #2b2d31;
  color: #fff;
}

.call-stage .round-btn:hover {
  background: #3a3c42;
}

.call-stage .round-btn.on {
  background: var(--ok);
}

.call-stage .round-btn.danger {
  width: 60px;
  border-radius: 24px;
  background: var(--danger);
}
