/* Viewer-only monitoring workspace and explicit fullscreen controls. */

.viewer-shell {
  display: block;
  min-height: 100vh;
}

.viewer-monitoring {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 28px 30px 40px;
}

.viewer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 0 2px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.13);
}

.viewer-heading h1 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(1.65rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
}

.viewer-logout {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  color: #9fb0c2;
  background: rgba(13, 22, 31, 0.78);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
}

.viewer-logout:hover {
  border-color: rgba(94, 234, 212, 0.28);
  color: #f8fafc;
}

.viewer-department-filter {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 14px;
  background: rgba(8, 16, 24, 0.72);
}

.viewer-department-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.viewer-department-heading > div {
  display: grid;
  gap: 3px;
}

.viewer-department-heading strong {
  color: #f2f7fb;
  font-size: 0.92rem;
}

.viewer-department-heading span,
.viewer-department-heading > small,
.viewer-department-empty {
  color: #7f93a7;
  font-size: 0.72rem;
}

.viewer-department-heading > small {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.09);
  color: #5eead4;
  font-weight: 750;
}

.viewer-department-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer-department-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  min-width: 150px;
  padding: 8px 10px 8px 13px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 10px;
  background: rgba(12, 22, 31, 0.82);
  color: #9fb0c2;
  font-size: 0.78rem;
  font-weight: 720;
  text-align: left;
}

.viewer-department-button small {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.09);
  color: #8297aa;
  font-size: 0.68rem;
}

.viewer-department-button:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.28);
  color: #e8f2f7;
}

.viewer-department-button.active {
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(13, 104, 96, 0.3);
  color: #ffffff;
  box-shadow: inset 2px 0 0 #2dd4bf;
}

.viewer-department-button.active small {
  background: rgba(45, 212, 191, 0.18);
  color: #8cf8e8;
}

.viewer-department-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.viewer-department-empty {
  margin: 0;
}

.viewer-grid-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.viewer-grid-toolbar .grid-options {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  background: rgba(7, 13, 20, 0.72);
}

.viewer-grid-toolbar .grid-options button {
  min-width: 54px;
  min-height: 38px;
}

.viewer-stream-grid {
  gap: 20px;
}

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

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

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

.viewer-stream-grid.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.viewer-stream-card .video-shell {
  height: clamp(260px, 29vw, 520px);
}

.viewer-stream-grid.grid-3 .video-shell {
  height: clamp(220px, 22vw, 390px);
}

.viewer-stream-grid.grid-4 .video-shell {
  height: clamp(180px, 17vw, 300px);
}

.viewer-stream-grid.grid-auto .video-shell {
  height: clamp(240px, 25vw, 430px);
}

.viewer-stream-card .stream-card-header {
  min-height: 82px;
}

.fullscreen-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 9px;
  background: rgba(3, 8, 13, 0.82);
  color: #e5edf5;
  font-size: 0.72rem;
  font-weight: 750;
  backdrop-filter: blur(10px);
}

.fullscreen-toggle:hover,
.fullscreen-toggle.active {
  border-color: rgba(94, 234, 212, 0.44);
  background: rgba(10, 85, 78, 0.88);
  color: #ffffff;
}

.video-shell:fullscreen .fullscreen-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
}

.active-user-row .status-dot {
  display: inline-block;
  margin-right: 7px;
  vertical-align: middle;
}

.activity-empty.large {
  min-height: 280px;
}

@media (max-width: 1180px) {
  .viewer-stream-grid.grid-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .viewer-monitoring {
    padding: 20px 14px 30px !important;
  }

  .viewer-stream-grid.grid-2,
  .viewer-stream-grid.grid-3,
  .viewer-stream-grid.grid-4,
  .viewer-stream-grid.grid-auto {
    grid-template-columns: 1fr;
  }

  .viewer-stream-card .video-shell,
  .viewer-stream-grid.grid-3 .video-shell,
  .viewer-stream-grid.grid-4 .video-shell,
  .viewer-stream-grid.grid-auto .video-shell {
    height: clamp(230px, 62vw, 420px);
  }
}

@media (max-width: 520px) {
  .viewer-heading {
    align-items: flex-start;
  }

  .viewer-heading h1 {
    font-size: 1.55rem;
  }

  .viewer-grid-toolbar,
  .viewer-grid-toolbar .grid-options {
    width: 100%;
  }

  .viewer-grid-toolbar .grid-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .viewer-grid-toolbar .grid-options button {
    min-width: 0;
    padding-inline: 5px;
  }

  .viewer-department-filter {
    padding: 13px;
  }

  .viewer-department-options {
    display: grid;
    grid-template-columns: 1fr;
  }

  .viewer-department-button {
    width: 100%;
    min-width: 0;
  }
}

/* Viewer full-width workspace correction */
.viewer-shell {
  display: block !important;
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

.viewer-shell > .viewer-monitoring {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 28px 30px 40px !important;
  box-sizing: border-box !important;
}

@media (max-width: 860px) {
  .viewer-shell > .viewer-monitoring {
    padding: 20px 14px 30px !important;
  }
}
/* Viewer compact logout placement */
.viewer-department-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.viewer-department-actions .viewer-logout {
  min-height: 36px;
  padding: 8px 14px;
}

@media (max-width: 520px) {
  .viewer-department-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
}
