/* Mondo Camere — stilurile paginilor: panou, hartă, listă, fișa camerei, grilă (din <style>-urile view-urilor vechi din infrastructură:
   views/camere/panou.ejs, harta.ejs, grila.ejs). Clasele sunt aceleași; ce schimba antetul doar pe o pagină e legat de clasa paginii
   pe <body> (body.cam-pg-harta), fiindcă aici toate stilurile sunt încărcate deodată. */

/* ═══ Panoul ═══ */
.cam-kpis { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-bottom:16px; }
@media (max-width: 640px) { .cam-kpis { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
.cam-kpi { padding:14px 16px; }
.cam-kpi .cam-kpi-n { font-size:1.8rem; font-weight:700; line-height:1.1; font-variant-numeric:tabular-nums; }
.cam-kpi .cam-kpi-l { font-size:.8rem; color:var(--app-muted); }
.cam-kpi.is-bad .cam-kpi-n { color:#dc3545; } .cam-kpi.is-ok .cam-kpi-n { color:#16a34a; }
.cam-ev { display:flex; gap:10px; padding:8px 14px; border-top:1px solid var(--app-border); font-size:.875rem; }
.cam-ev:first-child { border-top:0; }
.cam-ev time { white-space:nowrap; color:var(--app-muted); font-size:.8rem; min-width:112px; }

/* ═══ Harta ═══ */
#camMapWrap { position:relative; height:calc(100vh - 230px); height:calc(100dvh - 230px); min-height:420px; border-radius:12px; overflow:hidden; border:1px solid var(--app-border); }
#camMap { position:absolute; inset:0; }
#camMap.is-placing { cursor:crosshair; }
.cam-marker-wrap, .cam-cluster-wrap { background:none !important; border:none !important; }
/* Markerul (v1.17.0): punctul plin = STAREA (verde / roșu / gri), inelul = GRUPUL; camerele căzute pulsează roșu.
   Conul de vedere (direcția camerei) se desenează sub marker, în culoarea grupului; numele apare la zoom mare. */
.cam-marker { width:26px; height:26px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-size:13px;
  background:var(--st, #94a3b8); border:3px solid var(--gr, #6b7280); box-shadow:0 1px 5px rgba(0,0,0,.4); box-sizing:border-box; }
.cam-marker.is-offline { animation:camPulse 1.6s ease-out infinite; }
@keyframes camPulse { 0% { box-shadow:0 0 0 0 rgba(220,38,38,.6); } 100% { box-shadow:0 0 0 14px rgba(220,38,38,0); } }
@media (prefers-reduced-motion: reduce) { .cam-marker.is-offline { animation:none; box-shadow:0 0 0 4px rgba(220,38,38,.4); } }
/* Grupare: inelul arată proporția online (verde) / offline (roșu) / neverificat (gri) */
.cam-cluster { width:100%; height:100%; border-radius:50%; display:flex; align-items:center; justify-content:center; box-shadow:0 2px 8px rgba(0,0,0,.35); }
.cam-cluster span { width:calc(100% - 12px); height:calc(100% - 12px); border-radius:50%; background:var(--app-surface, #fff); color:var(--app-text, #111);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:.82rem; }
.cam-label-wrap { background:none !important; border:none !important; }
.cam-label { position:absolute; left:16px; top:-10px; white-space:nowrap; background:var(--app-surface, #fff); color:var(--app-text, #111); border:1px solid var(--app-border, #ddd);
  border-radius:6px; padding:0 6px; font-size:.7rem; font-weight:600; line-height:18px; box-shadow:0 1px 4px rgba(0,0,0,.2); pointer-events:none; }
.cam-handle-wrap { background:none !important; border:none !important; }
.cam-handle { width:16px; height:16px; border-radius:50%; background:#fff; border:3px solid var(--gr, #267596); box-shadow:0 1px 4px rgba(0,0,0,.4); box-sizing:border-box; cursor:grab; }
.cam-handle.is-new { border-style:dashed; }
/* Lista unei grupări (click pe grupare) */
.cam-cl-list { min-width:230px; }
.cam-cl-title { font-weight:700; margin-bottom:6px; }
.cam-cl-row { display:flex; align-items:center; gap:8px; padding:3px 0; border-top:1px solid var(--app-border, #eee); }
.cam-cl-row i { width:10px; height:10px; border-radius:50%; flex:0 0 auto; }
.cam-cl-row span { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.82rem; }
.cam-cl-foot { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.cam-cl-foot a.btn-primary, .cam-cl-foot a.btn-primary:hover { color:#fff; }   /* Leaflet colorează linkurile din popup: butonul rămânea albastru pe albastru */
/* Legenda pe telefon: restrânsă la butonul „Legendă” */
.cam-legend-toggle { display:none; border:0; background:none; padding:0; font-weight:600; color:inherit; }
@media (max-width: 575.98px) {
  .cam-legend-toggle { display:inline-flex; align-items:center; gap:6px; }
  .cam-legend.is-collapsed .cam-legend-body { display:none; }
  .cam-legend:not(.is-collapsed) .cam-legend-toggle { margin-bottom:4px; }
}
.cam-cl-popup .leaflet-popup-content { max-height:320px; overflow:auto; margin:10px 12px; }
.cam-tip { padding:6px !important; width:340px; white-space:normal; }
.cam-tip .cam-tip-name { font-weight:700; font-size:.85rem; margin-bottom:4px; }
.cam-tip .cam-tip-sub { font-size:.72rem; color:#6b7280; margin-bottom:6px; }
.cam-map-bar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:10px; }
.cam-map-bar .form-control, .cam-map-bar .form-select { width:auto; min-width:220px; max-width:100%; }
.cam-map-tools { display:flex; gap:8px; min-width:0; }
.cam-map-tools .form-select { min-width:0; flex:1 1 auto; max-width:420px; text-overflow:ellipsis; }
/* Telefon: căutarea pe un rând, selectorul + butoanele (doar iconiță) pe al doilea — nimic mai lat decât ecranul */
@media (max-width: 575.98px) {
  .cam-map-bar { gap:6px; margin-bottom:8px; }
  #camSearch { flex:1 1 0; min-width:0; }
  .cam-map-tools { flex:1 1 100%; margin-left:0 !important; }
  .cam-map-tools .form-select { max-width:none; }
  .cam-map-tools .cam-btn-text { display:none; }
}
/* Telefon (v1.22.2): antetul paginii hărții mai scund — butoanele doar cu iconiță pe rândul titlului, fără descriere */
@media (max-width: 575.98px) {
  body.cam-pg-harta .app-head { margin-bottom:10px; }
  body.cam-pg-harta .app-head .app-sub { display:none; }
  body.cam-pg-harta .app-head .app-head-actions { grid-column:2; grid-row:2; justify-content:flex-end; margin-top:0; gap:6px; flex-wrap:nowrap; }
  body.cam-pg-harta .app-head-actions .cam-act-text { display:none; }
  body.cam-pg-harta .app-head-actions .btn { padding:6px 10px; }
}
.cam-place-note { display:none; }
.cam-place-note.is-on { display:flex; }
.cam-legend { position:absolute; left:10px; bottom:24px; z-index:500; background:var(--app-surface,#fff); color:var(--app-text); border:1px solid var(--app-border);
  border-radius:8px; padding:6px 10px; font-size:.75rem; box-shadow:0 2px 8px rgba(0,0,0,.15); max-width:260px; }
.cam-legend label { display:flex; align-items:center; gap:6px; margin:2px 0; cursor:pointer; }
.cam-legend .line-swatch { margin-top:0; }

/* ═══ Grila ═══ */
.cam-grid { display:grid; gap:10px; grid-template-columns:repeat(var(--cols), minmax(0, 1fr));
  /* toate rândurile încap în fereastră: lățimea unei imagini 16:9 = (înălțimea disponibilă / rânduri − antetul plăcii) × 16/9 */
  max-width:calc(((100vh - 285px) / var(--rows) - 48px) * 16 / 9 * var(--cols) + (var(--cols) - 1) * 10px + var(--cols) * 14px); margin:0 auto; }
@media (max-width: 767.98px) { .cam-grid { grid-template-columns:repeat(var(--cols-sm, 1), minmax(0, 1fr)); max-width:none; } }
.cam-tile { background:var(--app-surface); border:1px solid var(--app-border); border-radius:10px; padding:6px; min-width:0; }
.cam-tile-head { display:flex; align-items:center; gap:6px; font-size:.8rem; font-weight:600; margin:0 2px 4px; min-width:0; }
.cam-tile-head span.n { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1 1 auto; }
.cam-tile-head .d { width:9px; height:9px; border-radius:50%; flex:0 0 auto; }
.cam-tile .cam-live-frame { cursor:zoom-in; }
.cam-tile .cam-live-info { font-size:.72rem; margin-top:3px; }
