/* static/stream.css */

/* --- BASE --- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #e6e6e6;
  font-family: system-ui, -apple-system, monospace; /* Monospace looks cooler for this app */
}

/* Hide cursor when idle */
body.no-cursor,
body.no-cursor * { cursor: none !important; }

/* --- THE STAGE --- */
/* Centers video and clips overflow */
.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  z-index: 1;
}

/* --- WAITING ROOM (RECONNECT OVERLAY) --- */
#waiting-room {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92); /* Dark overlay */
  color: #0f0; /* Hacker Green */
  display: none; /* Hidden by default */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50; /* Above video, below UI */
  font-family: monospace;
  backdrop-filter: blur(5px); /* Nice blur effect */
}

#waiting-room.active { display: flex; }

.status-box {
  padding: 20px;
  text-align: center;
  border: 1px solid #333;
  background: #000;
  border-radius: 8px;
  min-width: 200px;
}

.spinner {
  margin: 15px auto 0;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 255, 0, 0.3);
  border-top-color: #0f0;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* --- VIDEO ELEMENT --- */
#video {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  display: block;
  object-fit: contain;
  object-position: center;
  background: #000;
  transform-origin: center center;
  will-change: transform; /* Performance hint */
}

/* Fit modes */
body.cover   #video { object-fit: cover;   }
body.contain #video { object-fit: contain; }

/* --- ROTATION LOGIC --- */
body.rot0   #video,
body.rot180 #video {
  width: 100vw; height: 100vh;
  transform: rotate(0deg);
}
body.rot180 #video { transform: rotate(180deg); }

/* Swapped dimensions for 90/270 */
body.rot90  #video,
body.rot270 #video {
  width: 100vh; height: 100vw;
  max-width: 100vh; max-height: 100vw;
}
body.rot90  #video { transform: rotate(90deg); }
body.rot270 #video { transform: rotate(270deg); }

/* --- UI TOOLBAR --- */
.ui {
  position: fixed;
  right: 12px;
  top: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 100; /* Always on top */
}

/* Hovering near top-right reveals UI, or JS can toggle this class */
body:hover .ui,
.ui:hover {
  opacity: 1;
  pointer-events: auto;
}

.ui button {
  background: rgba(0,0,0,.6);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ui button:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.5);
}

/* Mobile viewport fix */
@supports (height: 100svh) {
  body.rot0   #video, body.rot180 #video { height: 100svh; max-height: 100svh; }
  body.rot90  #video, body.rot270 #video { width: 100svh; max-width: 100svh; }
}