/* BVR Pro /stream page only. Intentionally standalone: do not include the old styles1.css. */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.stream-page {
  background: #f4f6fa;
  color: #172033;
  font-family: 'Baloo Tamma 2', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.stream-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: 58px;
  border-bottom: 1px solid #e2e7ef;
  box-shadow: 0 2px 10px rgba(20, 30, 50, .05);
}
.stream-navbar .navbar-brand img { width: 30px; height: 24px; object-fit: contain; }
.stream-navbar .btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 9px;
  background: #11151d;
  color: #fff !important;
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
}

.stream-shell {
  width: min(1760px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 40px;
}
.stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.stream-header h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.15rem);
  font-weight: 600;
  line-height: 1.1;
}
.stream-header p {
  margin: 4px 0 0;
  color: #69758b;
  font-size: .94rem;
}
.stream-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid #d8deea;
  border-radius: 999px;
  background: #fff;
  color: #48546a;
  font-size: .88rem;
  font-weight: 600;
}
.stream-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #98a4b8;
}
.stream-status.is-connecting .stream-status-dot { background: #e6a11d; }
.stream-status.is-connected .stream-status-dot { background: #20a366; }
.stream-status.is-disconnected .stream-status-dot,
.stream-status.is-error .stream-status-dot { background: #d84d4d; }

/* Small QR at top-left, large stream in the middle, controls at right. */
.stream-workspace {
  display: grid;
  grid-template-columns: 175px minmax(0, 1fr) 185px;
  gap: 12px;
  align-items: start;
}
.stream-panel,
.stream-video-card,
.stream-section,
.stream-advanced {
  border: 1px solid #dde3ed;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(25, 36, 58, .06);
}
.stream-panel { padding: 12px; }
.stream-panel-title {
  margin-bottom: 8px;
  color: #202a40;
  font-size: .9rem;
  font-weight: 700;
}

.qr-frame {
  width: 136px;
  height: 136px;
  margin: 0 auto 9px;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e5ed;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.qr-frame #qrcode {
  display: block;
  width: 124px !important;
  height: 124px !important;
  max-width: 124px !important;
  max-height: 124px !important;
  object-fit: contain !important;
}
.stream-label {
  display: block;
  margin: 0 0 3px;
  color: #536077;
  font-size: .75rem;
  font-weight: 600;
}
.stream-room-input { height: 36px; font-size: .8rem; }
.stream-help {
  margin: 8px 0 10px;
  color: #737e92;
  font-size: .72rem;
  line-height: 1.3;
}
.stream-options { display: grid; gap: 7px; }
.stream-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-height: 31px;
  color: #455168;
  font-size: .76rem;
}

.stream-center { min-width: 0; }
.stream-video-card { overflow: hidden; }
.stream-video-heading {
  min-height: 48px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e5e9f0;
}
.stream-video-heading strong { display: block; line-height: 1.1; }
#streamStatusText {
  display: block;
  margin-top: 2px;
  color: #788398;
  font-size: .77rem;
}
.stream-video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  max-height: calc(100vh - 190px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #05070a;
}
#remoteVideo {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  background: #05070a;
}
.stream-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  color: #aeb7c8;
  font-size: .9rem;
}
.stream-video-placeholder-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  color: #d4dae6;
  background: rgba(255,255,255,.06);
}

.stream-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stream-action-button {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #cbd3e1;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #f2f4f8);
  color: #273349;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(24,35,56,.07);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.stream-action-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #aab5c9;
  box-shadow: 0 5px 12px rgba(24,35,56,.11);
}
.stream-action-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.stream-action-primary {
  border-color: #315ee8;
  background: linear-gradient(180deg, #4c78f4, #315ee8);
  color: #fff;
}
.stream-action-primary:hover:not(:disabled) { color: #fff; border-color: #264fcf; }
.stream-action-secondary { margin-top: auto; }

.stream-section { margin-top: 12px; padding: 14px; }
.stream-section-heading h2 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.stream-section-heading p { margin: 2px 0 9px; color: #7a8499; font-size: .78rem; }
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}
.snapshot-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e0e5ee;
  border-radius: 10px;
  background: #f7f8fb;
}
.snapshot-card img { display: block; width: 100%; height: auto; object-fit: contain; background: #0b0d12; }
.snapshot-card img[src=""] { display: none; }
.snapshot-card span {
  display: block;
  min-height: 25px;
  padding: 4px 7px;
  color: #69748a;
  font-size: .7rem;
  text-align: center;
}

.stream-advanced { margin-top: 12px; overflow: hidden; }
.stream-advanced > summary { padding: 12px 14px; font-weight: 700; cursor: pointer; }
.stream-advanced[open] > summary { border-bottom: 1px solid #e3e7ef; }
.stream-advanced-grid {
  display: grid;
  grid-template-columns: minmax(230px,.8fr) minmax(250px,1fr) minmax(280px,1fr);
  gap: 12px;
  padding: 12px;
}
.advanced-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e3e7ef;
  border-radius: 11px;
  background: #f9fafc;
}
.advanced-card h3 { margin: 0 0 9px; font-size: .92rem; font-weight: 700; }
.advanced-card label { margin: 7px 0 3px; color: #556078; font-size: .76rem; font-weight: 600; }
#localVideo {
  display: block;
  width: 100% !important;
  height: 210px !important;
  object-fit: contain !important;
  background: #06080d;
  border-radius: 8px;
}
.advanced-card textarea { resize: vertical; min-height: 86px; font-family: monospace; font-size: .75rem; }
.stream-error { margin-top: 7px; color: #b83232; font-size: .75rem; }

@media (max-width: 1050px) {
  .stream-workspace { grid-template-columns: 155px minmax(0,1fr); }
  .stream-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
  }
  .stream-action-secondary { margin-top: 0; }
  .snapshot-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 720px) {
  .stream-shell { width: min(100% - 16px, 1760px); padding-top: 9px; }
  .stream-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .stream-workspace { grid-template-columns: 1fr; }
  .stream-setup { display: grid; grid-template-columns: 130px minmax(0,1fr); column-gap: 10px; }
  .stream-setup .stream-panel-title { grid-column: 1 / -1; }
  .stream-setup .qr-frame { grid-row: span 4; width: 126px; height: 126px; margin: 0; }
  .stream-setup .qr-frame #qrcode { width: 114px !important; height: 114px !important; }
  .stream-options { grid-column: 1 / -1; grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 8px; }
  .stream-video-stage { min-height: 260px; max-height: 70vh; }
  .stream-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .snapshot-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stream-advanced-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   StreamX2 / StreamX4
   ============================================================ */
.multi-stream-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 14px;
  align-items: start;
}

.multi-stream-grid {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.multi-stream-grid.streams-2,
.multi-stream-grid.streams-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.multi-stream-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dde3ed;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(25, 36, 58, .06);
}

.multi-stream-card-head {
  min-height: 52px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e5e9f0;
}

.multi-stream-title {
  min-width: 0;
}

.multi-stream-title strong {
  display: block;
  color: #202a40;
  font-size: .95rem;
  line-height: 1.1;
}

.multi-stream-title small {
  display: block;
  margin-top: 3px;
  color: #7a8498;
  font-size: .72rem;
}

.multi-camera-status {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #d8deea;
  border-radius: 999px;
  background: #f8f9fc;
  color: #667289;
  font-size: .7rem;
  font-weight: 700;
}

.multi-camera-status.is-connecting {
  border-color: #ead39c;
  background: #fff9e9;
  color: #9b6a00;
}

.multi-camera-status.is-live {
  border-color: #b8dec9;
  background: #effaf4;
  color: #187a4b;
}

.multi-camera-status.is-error,
.multi-camera-status.is-disconnected {
  border-color: #efc4c4;
  background: #fff2f2;
  color: #ad3838;
}

.multi-stream-card-body {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  min-height: 310px;
  background: #080a0f;
}

.multi-qr-block {
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-right: 1px solid #202631;
  background: #f8f9fc;
}

.multi-qr-frame {
  width: 100px;
  height: 100px;
  padding: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #dfe5ee;
  border-radius: 9px;
  background: #fff;
}

.multi-qr-frame img {
  display: block !important;
  width: 90px !important;
  height: 90px !important;
  min-width: 90px !important;
  min-height: 90px !important;
  max-width: 90px !important;
  max-height: 90px !important;
  object-fit: contain !important;
}

.multi-qr-caption {
  margin: 0;
  color: #5c687e;
  font-size: .67rem;
  line-height: 1.2;
  text-align: center;
}

.multi-room-code {
  display: block;
  width: 100%;
  overflow: hidden;
  color: #7c8798;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .56rem;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-video-stage {
  position: relative;
  min-width: 0;
  width: 100%;
  min-height: 310px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #05070a;
}

.multi-video-stage video {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  background: #05070a;
}

.multi-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  pointer-events: none;
  color: #aeb7c8;
  font-size: .8rem;
  text-align: center;
}

.multi-video-placeholder-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  color: #d9dfeb;
}

.multi-control-rail {
  position: sticky;
  top: 72px;
  padding: 12px;
  border: 1px solid #dde3ed;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(25, 36, 58, .06);
}

.multi-control-rail h2 {
  margin: 0 0 8px;
  font-size: .95rem;
  font-weight: 700;
}

.multi-control-rail p {
  margin: 0 0 10px;
  color: #737e92;
  font-size: .72rem;
  line-height: 1.3;
}

.multi-control-rail .stream-action-button + .stream-action-button {
  margin-top: 8px;
}

.multi-summary-status {
  margin-top: 10px;
  padding: 8px 9px;
  border-radius: 9px;
  background: #f4f6fa;
  color: #566278;
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
}

.multi-snapshots {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #dde3ed;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(25, 36, 58, .05);
}

.multi-snapshots > summary {
  padding: 11px 13px;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 700;
}

.multi-snapshots[open] > summary {
  border-bottom: 1px solid #e4e8ef;
}

.multi-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.multi-snapshot-card {
  overflow: hidden;
  border: 1px solid #e2e7ef;
  border-radius: 9px;
  background: #f7f8fb;
}

.multi-snapshot-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #080a0f;
}

.multi-snapshot-card img[src=""] {
  display: none;
}

.multi-snapshot-card span {
  display: block;
  min-height: 24px;
  padding: 4px 5px;
  color: #6f7a8e;
  font-size: .65rem;
  text-align: center;
}

@media (min-width: 1400px) {
  .multi-stream-grid.streams-2 .multi-stream-card-body {
    min-height: 420px;
  }

  .multi-stream-grid.streams-2 .multi-video-stage {
    min-height: 420px;
  }

  .multi-stream-grid.streams-4 .multi-stream-card-body {
    min-height: 320px;
  }

  .multi-stream-grid.streams-4 .multi-video-stage {
    min-height: 320px;
  }
}

@media (max-width: 1180px) {
  .multi-stream-layout {
    grid-template-columns: 1fr;
  }

  .multi-control-rail {
    position: static;
    display: grid;
    grid-template-columns: minmax(160px, 1fr) repeat(3, minmax(130px, .7fr));
    gap: 8px;
    align-items: center;
  }

  .multi-control-rail h2,
  .multi-control-rail p {
    display: none;
  }

  .multi-control-rail .stream-action-button + .stream-action-button {
    margin-top: 0;
  }

  .multi-summary-status {
    margin-top: 0;
  }
}

@media (max-width: 900px) {
  .multi-stream-grid.streams-2,
  .multi-stream-grid.streams-4 {
    grid-template-columns: 1fr;
  }

  .multi-stream-card-body,
  .multi-video-stage {
    min-height: 360px;
  }

  .multi-snapshot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .multi-stream-card-body {
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 250px;
  }

  .multi-video-stage {
    min-height: 250px;
  }

  .multi-qr-block {
    padding: 8px 5px;
  }

  .multi-qr-frame {
    width: 78px;
    height: 78px;
  }

  .multi-qr-frame img {
    width: 70px !important;
    height: 70px !important;
    min-width: 70px !important;
    min-height: 70px !important;
    max-width: 70px !important;
    max-height: 70px !important;
  }

  .multi-control-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .multi-summary-status {
    grid-column: 1 / -1;
  }

  .multi-snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
