/*
 * Kanály › Sál (js/modules/sal.js): the floor plan with people (js/sal/plan.js) and the views Kamery and
 * Kalibrace taken over from Sál v1 (their styles below come from its css/app.css).
 */

/* ---------- Půdorys ---------- */
/* the state under the plan as the line of the synchronization in Kancelář (.log-foot, 14. 11. 2026): small grey text, no line, no dot */
.bp-status { display: block; width: fit-content; max-width: 100%; margin: 0; font-size: 12px; line-height: 18px; color: var(--text-muted); }
.bp-status:empty { display: none; }
.bp-card { padding: var(--space-4, 16px); }
.bp-main { display: grid; gap: 12px; align-content: start; }
.bp-stage { width: 100%; }
.bp-svg { display: block; width: 100%; height: auto; }
.bp-layout { display: grid; gap: var(--space-4, 16px); min-width: 0; }
.bp-layout > * { min-width: 0; }
.bp-side { display: contents; }                    /* on a phone: the numbers above the plan, the legend under it */
.bp-side > .kpis { order: -1; }
.bp-legend-card { padding: var(--space-4, 16px); }
@container win (min-width: 900px) {
  /* the plan takes the width of the page (Štěpán 12. 11.), the numbers stay right beside it */
  .bp-layout { grid-template-columns: minmax(0, 1fr) clamp(260px, 28%, 460px); align-items: start; }
  /* a wide window: the plan grows with it, but never taller than the window */
  .bp-svg { max-height: max(340px, calc(100vh - 340px)); }
  .bp-side { display: grid; gap: 12px; align-content: start; }
  .bp-side > .kpis { order: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .bp-legend-card .bp-legend { flex-direction: column; gap: 10px; }
}
.bp-room { fill: var(--surface-2); stroke: none; }
.bp-zone { stroke: none; }
.bp-zone--back { fill: color-mix(in srgb, var(--text-muted) 16%, var(--surface-2)); }
.bp-zone--bar { fill: color-mix(in srgb, var(--gold) 22%, var(--surface-2)); }
.bp-zone--door { fill: color-mix(in srgb, var(--ok) 16%, var(--surface-2)); }
.bp-zone--wall { fill: color-mix(in srgb, var(--text-muted) 55%, var(--surface-2)); }
.bp-zone--thing { fill: color-mix(in srgb, var(--text-muted) 30%, var(--surface-2)); }
.bp-wall { stroke-linecap: square; }
.bp-wall--solid { stroke: var(--text-strong); }
.bp-wall--glass { stroke: color-mix(in srgb, var(--info, #6aa7d8) 70%, var(--text-muted)); stroke-dasharray: 0.3 0.14; }
.bp-table { fill: var(--surface-1); stroke: var(--text-muted); stroke-width: 0.03; transition: fill .4s ease, stroke .4s ease; }
.bp-table.is-taken { fill: color-mix(in srgb, var(--gold) 45%, var(--surface-1)); stroke: var(--gold); }
.bp-table-label { font: 600 0.24px/1 var(--font-sans); fill: var(--text-muted); pointer-events: none; }
.bp-table-count { font: 700 0.28px/1 var(--font-sans); fill: var(--gold); pointer-events: none; }
.bp-cam { fill: var(--text-strong); }
.bp-cam-cone { fill: color-mix(in srgb, var(--text-strong) 7%, transparent); stroke: none; }
.bp-person-dot { stroke: var(--surface); stroke-width: 0.04; }
.bp-person-halo { opacity: .22; }
.bp-person--guest .bp-person-dot, .bp-person--guest .bp-person-halo { fill: var(--gold); }
.bp-person--staff .bp-person-dot { fill: var(--text-strong); stroke: var(--gold); }
.bp-person--staff .bp-person-halo { fill: var(--text-strong); }
.bp-person--unknown .bp-person-dot, .bp-person--unknown .bp-person-halo { fill: var(--info, #6aa7d8); }
.bp-person.is-seated .bp-person-halo { opacity: .1; }
.bp-person.is-faint { opacity: .45; }
.bp-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; font-size: 12px; color: var(--text-muted); }
.bp-legend span { display: inline-flex; align-items: center; gap: 7px; }
.bp-key { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.bp-key--guest { background: var(--gold); }
.bp-key--staff { background: var(--text-strong); box-shadow: 0 0 0 1.5px var(--gold); }
.bp-key--unknown { background: var(--info, #6aa7d8); }
.bp-key--table { border-radius: 2px; background: color-mix(in srgb, var(--gold) 45%, var(--surface-1)); box-shadow: 0 0 0 1px var(--gold); }
.bp-key--cam { background: var(--text-strong); }

/* ---------- Kamery and Kalibrace (from Sál v1) ---------- */
.quality { font-size: var(--fs-12); color: var(--text-muted); }
.cameras-view .toolbar, .calibration .toolbar { justify-content: flex-start; gap: var(--space-4); padding: 0 0 var(--space-3); }
.cameras-view .toolbar label, .calibration .toolbar label { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-13); color: var(--text); }
.calibration .btn--secondary { background: var(--surface-1); border: 1px solid var(--line); color: var(--text); }
.calibration .btn--secondary:hover { background: var(--surface-2); }
.calibration .btn.is-active { border-color: var(--gold); color: var(--text-strong); }
.calibration .form-control { background: var(--surface-1); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 6px 10px; font: inherit; }
/* ---------- cameras ---------- */

/* Container of the cameras view: toolbar + the grid the module builds. */
.cameras-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.cameras-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  overflow-y: auto;
  min-height: 0;
}

.camera-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.camera-card__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.camera-card__name {
  font-size: var(--fs-16);
  font-weight: var(--fw-600);
  color: var(--text-strong);
}

.camera-card__meta { font-size: var(--fs-12); color: var(--text-muted); }

.camera-card__stage {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface-2);
  line-height: 0;
}

.camera-card__stage canvas { display: block; width: 100%; height: auto; cursor: pointer; }

.camera-card__note {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  color: var(--text-muted);
}

  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 0 var(--space-3);
  flex-wrap: wrap;
}

  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-13);
  color: var(--text);
}

/* ---------- calibration ---------- */

.calibration {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--space-4);
  overflow-y: auto;
  min-height: 0;
  padding-bottom: var(--space-4);
}

.calibration__col { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }

.calibration__stage {
  position: relative;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  line-height: 0;
  cursor: crosshair;
}

.calibration__stage img { width: 100%; height: auto; display: block; }
.calibration__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.calibration__help {
  font-size: var(--fs-13);
  line-height: var(--lh-13);
  color: var(--text-muted);
}

.points-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-13);
  font-variant-numeric: var(--numeric);
}

.points-table th, .points-table td {
  border-bottom: 1px solid var(--line);
  padding: var(--space-1) var(--space-2);
  text-align: right;
}

.points-table th:first-child, .points-table td:first-child { text-align: left; }
.points-table th { color: var(--text-muted); font-weight: var(--fw-500); }
.points-table tr.is-active td { background: var(--surface-2); }
.points-table input {
  width: 4.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-1);
  padding: 2px var(--space-1);
  font: inherit;
  text-align: right;
  background: var(--surface);
  color: var(--text);
}

.calibration__result {
  font-size: var(--fs-13);
  line-height: var(--lh-13);
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-1);

@container win (max-width: 1400px) { .cameras-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* a narrow window; the phone (no container there) gets the same */
@container win (max-width: 900px) {
  .cameras-grid { grid-template-columns: minmax(0, 1fr); }
  .calibration { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .cameras-grid { grid-template-columns: minmax(0, 1fr); }
  .calibration { grid-template-columns: minmax(0, 1fr); }
}
