/* Live camera cards + Live page grid */
/* ── Live camera cards (Android Netvue/Ring) ── */
.live-cam-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
.live-cam-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}
.live-cam-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
}
.live-cam-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.15);
  color: #0ea5e9;
  flex-shrink: 0;
}
.live-cam-ico.is-ring {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}
.live-cam-titles {
  flex: 1;
  min-width: 0;
}
.live-cam-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.2;
}
.live-cam-status {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 1px;
}
.live-cam-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(148, 163, 184, 0.1);
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.live-cam-btn:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.2);
  color: #0f172a;
}
.live-cam-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.live-cam-quality-wrap {
  position: relative;
  flex-shrink: 0;
}
.live-cam-quality-btn {
  height: 34px;
  min-width: 52px;
  padding: 0 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.live-cam-quality-btn:hover {
  background: rgba(14, 165, 233, 0.2);
}
.live-cam-quality-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 160px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  padding: 0.25rem;
}
.live-cam-quality-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}
.live-cam-quality-item:hover {
  background: rgba(14, 165, 233, 0.1);
}
.live-cam-quality-item.is-active {
  color: #0284c7;
  background: rgba(14, 165, 233, 0.12);
}
.live-cam-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #0f172a;
  overflow: hidden;
}
.live-cam-stage .agora-video-player,
.live-cam-stage video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
.live-cam-stage-img {
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-cam-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.live-cam-video {
  background: #0f172a;
}
.live-cam-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 1rem;
  text-align: center;
}
.live-cam-placeholder.is-error {
  color: #fca5a5;
}

/* Full-screen live cam overlay (expand button / double-click stage / Esc) */
.live-cam-card.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10050;
  border-radius: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: #0b1220;
  box-shadow: none;
  border: none;
}
.live-cam-card.is-fullscreen .live-cam-head {
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.92);
  padding: 0.75rem 1rem;
}
.live-cam-card.is-fullscreen .live-cam-title {
  color: #f8fafc;
}
.live-cam-card.is-fullscreen .live-cam-status {
  color: #94a3b8;
}
.live-cam-card.is-fullscreen .live-cam-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}
.live-cam-card.is-fullscreen .live-cam-stage {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.live-cam-card.is-fullscreen .ring-mfa-panel {
  flex-shrink: 0;
  max-height: 40vh;
  overflow: auto;
}
body.live-cam-fs-open {
  overflow: hidden !important;
}

/* Ring MFA handshake (SMS code → store refresh token in SSM) */
.ring-mfa-panel {
  padding: 0.85rem 1rem 1rem;
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.06), transparent 60%);
  border-top: 1px solid rgba(249, 115, 22, 0.18);
}
.ring-mfa-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #c2410c;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ring-mfa-prompt {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.4;
}
.ring-mfa-meta {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  color: #64748b;
}
.ring-mfa-actions {
  margin: 0.5rem 0 0.65rem;
}
.ring-mfa-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ring-mfa-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}
.ring-mfa-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #0f172a;
  background: #fff;
}
.ring-mfa-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}
.ring-mfa-btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.ring-mfa-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ring-mfa-btn-primary {
  background: #f97316;
  color: #fff;
  width: 100%;
}
.ring-mfa-btn-primary:hover:not(:disabled) {
  background: #ea580c;
}
.ring-mfa-btn-submit {
  background: #0f172a;
  color: #fff;
  flex-shrink: 0;
}
.ring-mfa-btn-submit:hover:not(:disabled) {
  background: #1e293b;
}
.ring-mfa-error {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: #dc2626;
  font-weight: 600;
}
.ring-mfa-ok {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: #16a34a;
  font-weight: 600;
}
.ring-mfa-link {
  margin-top: 0.65rem;
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.ring-mfa-link:hover:not(:disabled) {
  color: #0f172a;
}

html[data-color-mode="dark"] .live-cam-card {
  background: #1a2332;
  border-color: rgba(255, 255, 255, 0.1);
}
html[data-color-mode="dark"] .live-cam-title { color: #e8eef4; }
html[data-color-mode="dark"] .live-cam-status { color: #9aa8b5; }
html[data-color-mode="dark"] .live-cam-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #9aa8b5;
}
html[data-color-mode="dark"] .live-cam-quality-btn {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}
html[data-color-mode="dark"] .live-cam-quality-menu {
  background: #1a2332;
  border-color: rgba(255, 255, 255, 0.12);
}
html[data-color-mode="dark"] .live-cam-quality-item {
  color: #e8eef4;
}
html[data-color-mode="dark"] .live-cam-quality-item:hover {
  background: rgba(56, 189, 248, 0.12);
}
html[data-color-mode="dark"] .live-cam-quality-item.is-active {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.15);
}
html[data-color-mode="dark"] .ring-mfa-panel {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.12), transparent 60%);
  border-top-color: rgba(249, 115, 22, 0.28);
}
html[data-color-mode="dark"] .ring-mfa-title { color: #fdba74; }
html[data-color-mode="dark"] .ring-mfa-prompt { color: #c5d0da; }
html[data-color-mode="dark"] .ring-mfa-meta { color: #9aa8b5; }
html[data-color-mode="dark"] .ring-mfa-label { color: #9aa8b5; }
html[data-color-mode="dark"] .ring-mfa-input {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.14);
  color: #e8eef4;
}
html[data-color-mode="dark"] .ring-mfa-btn-submit {
  background: #e8eef4;
  color: #0f172a;
}
html[data-color-mode="dark"] .ring-mfa-link { color: #9aa8b5; }
html[data-color-mode="dark"] .ring-mfa-link:hover:not(:disabled) { color: #e8eef4; }


/* Dedicated Live cameras page — 3 columns × 2 rows */
.cameras-page {
  padding: 0.5rem 0.75rem 1.25rem;
  max-width: none;
}
.cameras-page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.75rem;
  flex-wrap: wrap;
}
.cameras-page-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.cameras-page-header p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: #64748b;
}
.live-cam-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(220px, 1fr));
  gap: 0.85rem;
  width: 100%;
  min-height: calc(100vh - 150px);
  align-content: stretch;
}
.live-cam-grid > * {
  min-width: 0;
  min-height: 0;
  display: block;
  height: 100%;
}
.live-cam-grid .live-cam-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.live-cam-grid .live-cam-stage {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 160px;
}
.live-cam-grid .live-cam-head {
  flex-shrink: 0;
}
html[data-color-mode="dark"] .cameras-page-header h1 { color: #e8eef4; }
html[data-color-mode="dark"] .cameras-page-header p { color: #9aa8b5; }

/* Keep desktop grid 3×2; only stack on narrow phones */
@media (max-width: 700px) {
  .live-cam-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }
}
