/* CCTV cameras: management pages, map popup player and big-screen viewer */
.layer-dot.cctv{background:#2f6fb0}

.cctv-shell .users-title-row{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}
.cctv-shell .users-title-row .button-link{display:inline-flex;align-items:center;gap:6px}
.cctv-flash{margin:0 0 12px;padding:10px 14px;border-radius:10px;font-size:14px}
.cctv-flash.notice{background:#e8f3ec;color:#2d6a45}
.cctv-flash.alert{background:#fbeaea;color:#9b2c2c}
.cctv-empty{display:grid;justify-items:center;gap:6px;padding:40px 16px;color:#5f6b63;text-align:center}
.cctv-empty .material-symbols-outlined{font-size:40px;color:#9aa59e}
.cctv-table td small{display:block;color:#6b756f;font-size:12px}
.cctv-type{display:block;font-size:12px;color:#5f6b63;margin-bottom:4px}
.cctv-watch{display:inline-flex;align-items:center;gap:4px;padding:5px 10px;border:1px solid #2f6fb0;border-radius:999px;background:#fff;color:#2f6fb0;font:inherit;font-size:13px;cursor:pointer}
.cctv-watch:hover:not(:disabled){background:#2f6fb0;color:#fff}
.cctv-watch:disabled{opacity:.45;cursor:not-allowed}
.cctv-watch .material-symbols-outlined{font-size:18px}
/* Keep the cell a table-cell (display:flex on a td breaks column alignment); lay buttons out inline. */
td.cctv-actions{white-space:nowrap}
.cctv-actions form{display:inline-block;width:auto;margin:0}
.cctv-actions>*+*{margin-left:6px}
.cctv-actions .button-link.danger{color:#b42318;border-color:#f1c7c2}

.cctv-status{display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:600;background:#e8f0f9;color:#2f6fb0}
.cctv-status.maintenance{background:#fbf1de;color:#8a5d0e}
.cctv-status.inactive{background:#eceef0;color:#5f656d}

.cctv-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.cctv-fieldset{display:grid;gap:12px;align-content:start;min-width:0;margin:0;padding:16px;border:1px solid #e3e7e2;border-radius:14px}
.cctv-fieldset legend{padding:0 6px;font-weight:600}
.cctv-fieldset label{display:grid;gap:4px}
.cctv-fieldset small{color:#6b756f;font-size:12px}
.cctv-location{grid-column:1/-1}
.cctv-location-map{height:320px;border-radius:12px;overflow:hidden;border:1px solid #e3e7e2}
.cctv-coordinates{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.cctv-preview{display:grid;gap:8px}
.cctv-preview .button-link{display:inline-flex;align-items:center;justify-content:center;gap:6px}
.cctv-preview-stage{aspect-ratio:16/9;border-radius:12px;background:#151a17;color:#c9d1cb;display:grid;place-content:center;justify-items:center;gap:4px}
.cctv-form-card .form-errors p{margin:2px 0}

/* Player stage shared by preview, popup and viewer */
.cctv-stage{position:relative;overflow:hidden;background:#0f1311;color:#e8ece9}
.cctv-stage>video,.cctv-stage>img,.cctv-stage>iframe{display:block;width:100%;height:100%;object-fit:contain;border:0;background:#0f1311}
.cctv-stage-status{position:absolute;inset:0;display:grid;place-content:center;justify-items:center;gap:8px;padding:12px;text-align:center;background:rgba(15,19,17,.72);font-size:13px}
.cctv-stage-status[hidden]{display:none}
.cctv-stage-status.error .material-symbols-outlined{font-size:32px;color:#f2a39b}
.cctv-stage-status button{padding:5px 12px;border:1px solid rgba(255,255,255,.5);border-radius:999px;background:transparent;color:#fff;font:inherit;font-size:12px;cursor:pointer}
.cctv-live-badge{position:absolute;top:8px;left:8px;padding:2px 8px;border-radius:4px;background:#d92d20;color:#fff;font-size:11px;font-weight:700;letter-spacing:.06em;pointer-events:none}
.cctv-live-badge[hidden]{display:none}
.cctv-spinner{width:26px;height:26px;border:3px solid rgba(255,255,255,.25);border-top-color:#fff;border-radius:50%;animation:cctv-spin .8s linear infinite}
@keyframes cctv-spin{to{transform:rotate(360deg)}}

/* Map popup */
.place-popup:has(.cctv-popup){width:min(340px,calc(100vw - 48px));max-width:none}
.cctv-popup{display:grid;gap:6px;width:100%;min-width:0}
.cctv-popup p{margin:0}
.cctv-popup-player{aspect-ratio:16/9;border-radius:8px}
.cctv-popup-expand{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:7px 10px;border:0;border-radius:8px;background:#2f6fb0;color:#fff;font:inherit;font-size:13px;cursor:pointer}
.cctv-popup-expand .material-symbols-outlined{font-size:18px}

/* Big-screen viewer */
.cctv-viewer{width:min(1280px,calc(100vw - 32px));max-height:calc(100vh - 32px);padding:0;border:0;border-radius:16px;background:#0f1311;color:#e8ece9;overflow:hidden}
.cctv-viewer::backdrop{background:rgba(8,10,9,.78)}
.cctv-viewer header{display:flex;align-items:center;justify-content:space-between;gap:12px;height:auto;padding:12px 16px;background:transparent;box-shadow:none}
.cctv-viewer header p{margin:0;font-size:12px;color:#9aa59e}
.cctv-viewer header h2{margin:2px 0 0;font-size:18px;color:#fff}
.cctv-viewer-tools{display:flex;align-items:center;gap:8px}
.cctv-viewer-tools button,.cctv-viewer-tools a{display:inline-flex;align-items:center;gap:4px;padding:6px 10px;border:1px solid rgba(255,255,255,.2);border-radius:8px;background:transparent;color:#fff;font:inherit;font-size:13px;text-decoration:none;cursor:pointer}
.cctv-viewer-tools a[hidden]{display:none}
.cctv-viewer-stage{aspect-ratio:16/9;max-height:calc(100vh - 160px);width:100%}
.cctv-viewer-stage:fullscreen{max-height:none;aspect-ratio:auto}
.cctv-viewer footer{padding:10px 16px;font-size:13px;color:#b9c2bc}
.cctv-viewer footer:empty{display:none}

@media (max-width:760px){
  .cctv-form-grid,.cctv-coordinates{grid-template-columns:1fr}
  .cctv-viewer{width:100vw;max-width:100vw;max-height:100vh;border-radius:0}
  .cctv-viewer-tools button{padding:6px}
  .cctv-viewer-tools [data-cctv-fullscreen]{font-size:0}
  .cctv-viewer-tools [data-cctv-fullscreen] .material-symbols-outlined{font-size:20px}
}

/* theme.css forces a light surface on every dialog and heading; keep the viewer dark. */
dialog.cctv-viewer{background:#0f1311 !important;color:#e8ece9 !important;box-shadow:0 24px 64px rgba(0,0,0,.45)}
dialog.cctv-viewer header h2{color:#fff !important}
dialog.cctv-viewer header p,dialog.cctv-viewer footer{color:#b9c2bc !important}

/* City map (situation assessment) detail panel */
.city-place-detail .cctv-detail{display:grid;gap:8px;margin:8px 0 0}
.city-place-detail .cctv-detail[hidden]{display:none}
.city-place-detail .cctv-popup-player{width:100%}
.city-place-detail:has(.cctv-detail:not([hidden])){width:min(420px,calc(100% - 24px));max-width:none}
