/* ABOUTME: Labeler shell styles — page list, form scaffold, status bar. */
/* ABOUTME: Field-level styling lives next to internal.css's lf-* primitives. */

/* ── Focus mode (full-screen, one page at a time) ──────────────────────
   The labeler default. Topbar with prev/next + status, optional right
   sidebar for schedules-style table editors, full-bleed OSD canvas. */
body.focus-body {
  margin: 0; padding: 0; height: 100vh; overflow: hidden;
  background: var(--ind-paper-alt);
}
.focus-page {
  display: flex; flex-direction: column;
  height: 100vh; max-width: none;
  margin: 0; padding: 0;
}
.focus-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  background: var(--ind-ink); color: #fff;
  font-size: 13px;
}
.focus-bar a, .focus-bar .focus-nav { color: #fff; text-decoration: none; }
/* Every interactive element in the top bar should stay on one line and
   size to its own content. Pico's base CSS makes <button> display:block +
   width:100% in form contexts, which would let Verify & Save grow to fill
   the entire bar and squeeze the nav buttons into two-line wraps. */
.focus-bar > a, .focus-bar > button, .focus-bar > form {
  flex: 0 0 auto;
  white-space: nowrap;
}
.focus-bar button { display: inline-flex; width: auto; }
.focus-exit {
  border: 2px solid rgba(255,255,255,0.4);
  padding: 4px 10px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.focus-exit:hover { background: rgba(255,255,255,0.15); border-color: #fff; }
.focus-facet {
  font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 12px;
}
.focus-project {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: rgba(255,255,255,0.85);
  border-bottom: 1px dotted rgba(255,255,255,0.4);
}
.focus-page-num { font-size: 12px; color: rgba(255,255,255,0.7); }
.focus-status.pstatus {
  border: 2px solid;
  padding: 2px 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.focus-status.pstatus.unlabeled { color: var(--ind-orange); border-color: var(--ind-orange); background: #fff8f0; }
.focus-status.pstatus.verified  { color: var(--ind-green);  border-color: var(--ind-green);  background: #e8f5e9; }
.focus-spacer { flex: 1; }
.focus-counter {
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.85); font-size: 13px;
}
.focus-nav {
  border: 2px solid rgba(255,255,255,0.4);
  padding: 4px 12px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.focus-nav:hover { background: rgba(255,255,255,0.15); border-color: #fff; }
.focus-nav.focus-next { background: var(--ind-orange); border-color: var(--ind-orange); }
.focus-nav.focus-next:hover { background: var(--ind-orange-hover); }
.focus-nav.muted { opacity: 0.35; cursor: not-allowed; }

/* Project picker inline in the top bar (replaces the old subtabs row). */
.focus-bar-project { margin: 0; }
.focus-bar-project select {
  padding: 4px 8px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 0;
  background: var(--ind-ink); color: #fff;
  font: inherit; font-size: 12px; font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 0;
  cursor: pointer;
}
.focus-bar-project select:hover { border-color: #fff; }

/* Verify button compacted to fit the top bar instead of the old bottom bar. */
.focus-verify {
  margin: 0 0 0 6px;
  padding: 4px 14px;
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--ind-orange); color: #fff;
  border: 2px solid var(--ind-orange);
  border-radius: 0;
  cursor: pointer;
  box-shadow: none;
}
.focus-verify:hover { background: var(--ind-orange-hover); border-color: var(--ind-orange-hover); }
.focus-verify.is-verified {
  background: var(--ind-green); border-color: var(--ind-green);
}
.focus-verify.is-verified:hover {
  background: #1e6e22; border-color: #1e6e22;
}
.focus-save-status {
  margin: 0 0 0 8px;
  padding: 2px 8px;
  border: 2px solid;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.focus-save-status.ok  { color: var(--ind-green); border-color: var(--ind-green); background: rgba(46, 125, 50, 0.15); }
.focus-save-status.err { color: var(--ind-red);   border-color: var(--ind-red);   background: rgba(192, 57, 43, 0.15); }

/* Stretch the content row to fill remaining height; the form + split are
   nested flex columns so the OSD canvas absorbs whatever's left. */
.focus-content { flex: 1; min-height: 0; display: flex; background: #fff; }
.focus-form { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* Horizontal split — canvas takes the top, form sidebar takes the bottom.
   Used to be a vertical (left/right) split; switching gave schedules with
   11–16 columns the full page width to lay out without horizontal scroll. */
.focus-split { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.focus-canvas-wrap { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; padding: 8px; }
.focus-canvas-wrap .v2-canvas { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-top: 0; }
.focus-canvas-wrap .v2-canvas-frame { flex: 1; height: auto; min-height: 0; }

/* Bottom pane — capped at 45vh so a long schedule doesn't push the canvas
   off-screen. Scrolls vertically inside when items exceed that height. */
.focus-side {
  flex: 0 0 auto;
  max-height: 45vh;
  overflow: auto;
  padding: 12px 16px;
  border-top: 2px solid var(--ind-ink);
  background: var(--ind-paper-alt);
}
.focus-side .v2-repeating-table { font-size: 11px; }
.focus-side .v2-repeating-table th { white-space: nowrap; }


.focus-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ind-ink-soft);
}

/* Cheat sheet overlay — toggled by `?`. */
.focus-cheatsheet {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
.focus-cheatsheet[hidden] { display: none; }
.focus-cheatsheet-card {
  background: #fff; border: 2px solid var(--ind-ink);
  box-shadow: 6px 6px 0 var(--ind-ink);
  padding: 20px 24px;
  min-width: 380px;
}
.focus-cheatsheet-head {
  font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 14px;
}
.focus-cheatsheet-head .muted { font-weight: 500; color: var(--ind-ink-soft); }
.focus-cheatsheet table { width: 100%; border-collapse: collapse; font-size: 13px; }
.focus-cheatsheet th {
  text-align: left; padding: 4px 12px 4px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800; color: var(--ind-orange);
  white-space: nowrap; vertical-align: top;
}
.focus-cheatsheet td { padding: 4px 0; color: var(--ind-ink); }


.labeler-shell {
  background: #fff;
  border: 2px solid var(--ind-ink);
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.labeler-pages {
  border-right: 2px solid var(--ind-ink);
  overflow-y: auto;
  padding: 8px;
}
.labeler-pages h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ind-ink-soft);
  padding: 6px 8px;
  margin: 0 0 6px;
}
.page-item {
  padding: 6px 10px;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.page-item:hover { background: var(--ind-paper-alt); }
.page-item.active {
  background: var(--ind-ink);
  color: var(--ind-paper);
  border-color: var(--ind-ink);
}
.page-item .verified { font-weight: 800; }
.labeler-form-wrap { padding: 16px; overflow-y: auto; }
.empty-state { color: var(--ind-ink-soft); }

/* Declarative field block — used by every facet widget via the
   _field_text / _field_textarea / _field_select / _field_json partials. */
.v2-field { margin-top: 12px; }
.v2-field:first-child { margin-top: 0; }
.v2-field label {
  display: block; margin: 0 0 4px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ind-ink-soft);
}
.v2-field label .muted {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--ind-ink-soft);
}
.v2-field input[type="text"],
.v2-field textarea,
.v2-field select {
  width: 100%; padding: 6px 10px; border: 2px solid var(--ind-ink);
  border-radius: 0; background: #fff; color: var(--ind-ink);
  font: inherit; margin: 0;
}
.v2-field textarea.json-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}
.v2-field .field-error {
  padding: 6px 8px; border: 2px solid var(--ind-red);
  background: rgba(192, 57, 43, 0.08); color: var(--ind-red);
  font-size: 12px; margin-top: 4px;
}
.v2-field .field-summary {
  margin-top: 6px; font-size: 12px; color: var(--ind-ink-soft);
}

/* Single Verify/Unverify & Save button per block. Replaces the old
   "Mark as verified" checkbox + separate Save button. */
.label-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px;
}
.v2-form button.verify-toggle {
  background: var(--ind-orange); color: #fff;
  border: 2px solid var(--ind-ink); border-radius: 0;
  padding: 8px 18px; font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
  cursor: pointer; box-shadow: 3px 3px 0 var(--ind-ink); margin: 0;
}
.v2-form button.verify-toggle:hover { background: var(--ind-orange-hover); }
.v2-form button.verify-toggle.is-verified {
  background: var(--ind-green); color: #fff;
}
.v2-form button.verify-toggle.is-verified:hover {
  background: #1e6e22;
}
.save-status {
  padding: 8px; border: 2px solid var(--ind-ink); margin-top: 12px;
  font-size: 12px;
}
.save-status.ok {
  background: rgba(46, 125, 50, 0.1);
  color: var(--ind-green); border-color: var(--ind-green);
}
.save-status.err {
  background: rgba(192, 57, 43, 0.1);
  color: var(--ind-red); border-color: var(--ind-red);
}

/* Collapsible JSON groups (Stitch sheets / FPs, SLD seg_masks) get
   `details` framing so the widget still feels tight by default but
   the user can pop them open for editing. */
.v2-field details > summary {
  cursor: pointer; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ind-ink-soft); padding: 4px 0;
}

/* Schema-driven repeating-row editor — used by schedules so panel /
   lighting / equipment / door / window share the same UI with subtype-
   specific columns. One row per item in payload[key]. */
.v2-repeating-table {
  width: 100%; border-collapse: collapse; margin-top: 6px;
  font-size: 12px; background: #fff;
}
.v2-repeating-table th,
.v2-repeating-table td {
  border: 1px solid var(--ind-ink); padding: 0;
  text-align: left; vertical-align: middle;
}
.v2-repeating-table thead th {
  background: var(--ind-paper-alt);
  padding: 6px 8px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ind-ink);
}
.v2-repeating-table tbody tr:hover { background: rgba(255, 106, 0, 0.04); }
.v2-repeating-table tbody td input {
  width: 100%; padding: 6px 8px; border: 0; border-radius: 0;
  background: transparent; color: var(--ind-ink); font: inherit;
  margin: 0;
}
.v2-repeating-table tbody td input:focus { outline: 2px solid var(--ind-orange); outline-offset: -2px; }
.v2-repeating-table td.v2-repeating-actions {
  width: 40px; text-align: center; background: var(--ind-paper-alt);
}
.v2-repeating-table button.v2-repeating-del {
  background: none; border: 0; color: var(--ind-ink-soft);
  cursor: pointer; font-size: 14px; font-weight: 700;
  padding: 4px 8px; margin: 0;
}
.v2-repeating-table button.v2-repeating-del:hover {
  color: var(--ind-red);
}
.v2-repeating-add {
  background: #fff; color: var(--ind-ink);
  border: 2px solid var(--ind-ink); border-radius: 0;
  padding: 6px 12px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  cursor: pointer; margin: 8px 0 0; box-shadow: 2px 2px 0 var(--ind-ink);
}
.v2-repeating-add:hover { background: var(--ind-ink); color: #fff; }

/* ── Canvas viewer (OpenSeadragon single-image mode) ─────────────────
   Scroll-wheel zoom, drag pan, navigator (mini-map). Overlays are placed
   via OSD's addOverlay() — OSD handles positioning + transform; our CSS
   just styles the inner element. */
.v2-canvas { margin-top: 12px; }
.v2-canvas-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--ind-ink-soft);
}
.v2-canvas-frame {
  position: relative; border: 2px solid var(--ind-ink);
  background: var(--ind-paper-alt);
  width: 100%;
  height: 75vh;
  overflow: hidden;
}
.v2-canvas-osd { width: 100%; height: 100%; }
.v2-canvas-hint {
  margin-top: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ind-ink-soft); text-align: right;
}
/* OSD navigator (mini-map) — restyle to match the rest of the labeler. */
.v2-canvas-frame .navigator {
  border: 2px solid var(--ind-ink) !important;
  background: rgba(255, 255, 255, 0.85) !important;
  box-shadow: 2px 2px 0 var(--ind-ink);
  margin: 8px !important;
}
.v2-canvas-frame .displayregion {
  border: 2px solid var(--ind-orange) !important;
  outline: none !important;
}
/* OSD toolbar is hidden via showNavigationControl: false in the OSD
   config — we used to also hide it via a CSS rule on the first child
   of .openseadragon-container, but that selector ALSO matched the OSD
   overlay wrapper (which holds all the bbox overlays), making every
   annotation invisible. The OSD config flag is the right knob. */

.bbox-overlay {
  border: 2px solid var(--ind-orange);
  background: rgba(255, 106, 0, 0.18);
  pointer-events: auto; cursor: help;
  box-sizing: border-box;
  width: 100%; height: 100%;
  opacity: var(--overlay-opacity, 1);
  transition: opacity 0.1s ease;
}
.v2-canvas.overlays-hidden .bbox-overlay,
.v2-canvas.overlays-hidden .poly-svg { display: none; }
.bbox-overlay:hover {
  background: rgba(255, 106, 0, 0.34);
  border-color: var(--ind-ink);
}
.bbox-overlay.is-clickable { cursor: pointer; }
.bbox-overlay.is-active {
  background: rgba(255, 106, 0, 0.32);
  border-color: var(--ind-ink); border-width: 2.5px;
}

/* Inspector mode — labelled-value chip inside each bbox. Floats at
   top-left, sized to the value text, doesn't intercept clicks. */
.bbox-inspector-label {
  position: absolute;
  top: -1px; left: -1px;
  padding: 1px 4px;
  font-size: 10px; font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ind-ink);
  border: 1px solid currentColor;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.1;
}

/* Color palette for inspector — each hash bucket gets a distinct hue.
   Border + label color shift; fill stays mostly transparent so the
   underlying drawing stays readable. */
.bbox-overlay.bbox-color-0 { border-color: #e6194b; }
.bbox-overlay.bbox-color-1 { border-color: #3cb44b; }
.bbox-overlay.bbox-color-2 { border-color: #4363d8; }
.bbox-overlay.bbox-color-3 { border-color: #f58231; }
.bbox-overlay.bbox-color-4 { border-color: #911eb4; }
.bbox-overlay.bbox-color-5 { border-color: #008080; }
.bbox-overlay.bbox-color-6 { border-color: #9a6324; }
.bbox-overlay.bbox-color-7 { border-color: #800000; }
.bbox-overlay.bbox-color-8 { border-color: #000075; }
.bbox-overlay.bbox-color-9 { border-color: #808000; }
.bbox-overlay.bbox-color-0 .bbox-inspector-label { color: #e6194b; }
.bbox-overlay.bbox-color-1 .bbox-inspector-label { color: #3cb44b; }
.bbox-overlay.bbox-color-2 .bbox-inspector-label { color: #4363d8; }
.bbox-overlay.bbox-color-3 .bbox-inspector-label { color: #f58231; }
.bbox-overlay.bbox-color-4 .bbox-inspector-label { color: #911eb4; }
.bbox-overlay.bbox-color-5 .bbox-inspector-label { color: #008080; }
.bbox-overlay.bbox-color-6 .bbox-inspector-label { color: #9a6324; }
.bbox-overlay.bbox-color-7 .bbox-inspector-label { color: #800000; }
.bbox-overlay.bbox-color-8 .bbox-inspector-label { color: #000075; }
.bbox-overlay.bbox-color-9 .bbox-inspector-label { color: #808000; }

/* Click-to-edit popover for bbox overlays. Lives inside .v2-canvas-frame so
   absolute positioning is relative to the image. JS picks left/right of the
   anchor box based on available room. */
.v2-canvas-popover {
  position: absolute;
  z-index: 5;
  min-width: 220px; max-width: 280px;
  background: #fff; border: 2px solid var(--ind-ink);
  box-shadow: 3px 3px 0 var(--ind-ink);
  padding: 10px;
  font-size: 12px; line-height: 1.4;
  pointer-events: auto;
}
.v2-canvas-popover-head {
  font-weight: 800; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ind-ink);
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 1px solid var(--ind-gray);
}
.v2-canvas-popover-row {
  display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px;
}
.v2-canvas-popover-row:last-child { margin-bottom: 0; }
.v2-canvas-popover-row span {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ind-ink-soft);
}
.v2-canvas-popover-row input[type="text"] {
  padding: 4px 8px; border: 2px solid var(--ind-ink); border-radius: 0;
  background: #fff; color: var(--ind-ink); font: inherit; margin: 0;
}

/* Polygon overlays (OD/sld seg_masks) — sit inside the same .v2-canvas-
   overlays container as bboxes; SVG fills the layer and we draw in
   normalized 0–1 space so it scales with the image. */
.poly-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.poly-overlay {
  fill: rgba(255, 106, 0, 0.08);
  stroke: var(--ind-orange); stroke-width: 0.0015;
  vector-effect: non-scaling-stroke;
  pointer-events: auto; cursor: help;
  opacity: var(--overlay-opacity, 1);
}
.poly-overlay:hover {
  fill: rgba(255, 106, 0, 0.22);
  stroke: var(--ind-ink);
}

.v2-canvas-status {
  /* Absolute so it doesn't add to the frame's height — overlay + image
     stay edge-for-edge regardless. */
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 12px; text-align: center;
  background: var(--ind-paper-alt);
  font-size: 12px; color: var(--ind-ink-soft);
  line-height: 1.4;
}
