/* NAREBA LIVE - OBS Overlay Engine (Browser Source CSS) */
html, body {
  background-color: transparent !important;
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

#overlay-container {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Cam Card */
.cam-wrapper {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  box-sizing: border-box;
  transform: translateZ(0); /* Force GPU layer */
  will-change: transform, box-shadow;
  transition: all 0.25s ease-out;
}

.cam-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: translateZ(0);
}

/* Voice Speaking Indicator Glow */
.cam-wrapper.is-speaking {
  box-shadow: 0 0 24px var(--voice-glow-color, #10b981) !important;
  border-color: var(--voice-border-color, #10b981) !important;
}

/* Name Tag Badge */
.name-tag {
  position: absolute;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 17, 26, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.name-tag .audio-wave {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  transition: background 0.2s, transform 0.2s;
}

.is-speaking .name-tag .audio-wave {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 1s infinite alternate;
}

/* Name tag positions */
.pos-bottom-left .name-tag { bottom: 12px; left: 12px; }
.pos-bottom-center .name-tag { bottom: 12px; left: 50%; transform: translateX(-50%); }
.pos-top-left .name-tag { top: 12px; left: 12px; }

/* LAYOUT MODES */

/* 1. Auto Grid */
.layout-auto-grid {
  display: grid;
  width: 100%;
  height: 100%;
  gap: 16px;
  justify-content: center;
  align-content: center;
}

.layout-auto-grid[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1280px;
  max-height: 720px;
  margin: auto;
}

.layout-auto-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.layout-auto-grid[data-count="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.layout-auto-grid[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.layout-auto-grid[data-count="5"],
.layout-auto-grid[data-count="6"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.layout-auto-grid[data-count="7"],
.layout-auto-grid[data-count="8"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.layout-auto-grid[data-count="9"],
.layout-auto-grid[data-count="10"],
.layout-auto-grid[data-count="11"],
.layout-auto-grid[data-count="12"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
}

/* 2. Side-by-Side */
.layout-side-by-side {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  width: 100%;
  height: 100%;
  gap: 16px;
}

/* 3. Focus-One (1 big spotlight, others in a strip) */
.layout-focus-one {
  display: grid;
  grid-template-columns: 3fr 1fr;
  width: 100%;
  height: 100%;
  gap: 16px;
}

.layout-focus-one .cam-wrapper:first-child {
  grid-row: span 2;
}

/* 4. Picture In Picture */
.layout-pip {
  position: relative;
  width: 100%;
  height: 100%;
}

.layout-pip .cam-wrapper:first-child {
  width: 100%;
  height: 100%;
}

.layout-pip .cam-wrapper:not(:first-child) {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 320px;
  height: 180px;
  z-index: 20;
}

/* 5. Vertical Stack (Stories, TikTok, or Left-bar OBS) */
.layout-vertical-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 16px;
}

.layout-vertical-stack .cam-wrapper {
  flex: 1;
}

/* 6. Circle (Round Facecam) */
.layout-circle .cam-wrapper {
  border-radius: 50% !important;
  aspect-ratio: 1 / 1 !important;
}

/* Single Cam View (for /cam endpoint) */
.single-cam-root {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.single-cam-root .cam-wrapper {
  width: 100%;
  height: 100%;
}

/* Placeholder for empty slot in OBS */
.cam-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 26, 0.4);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  color: #64748b;
  font-weight: 600;
  font-size: 0.95rem;
  gap: 8px;
}
