/* Print Designer rev 1.0.2.6.0 - help expansion, grid/measure overlays, compact title/key blocks, and UI polish */

/* Quick color bar: fill two clean rows instead of one full row plus a dangling color. */
.color-dots {
  display: grid !important;
  grid-template-columns: repeat(8, 22px) !important;
  grid-auto-rows: 22px !important;
  gap: 6px !important;
  align-items: center !important;
  justify-content: start !important;
}
.color-dot {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  border-radius: 999px !important;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.28), 0 1px 2px rgba(0,0,0,.18) !important;
}
.color-dot[data-color="#ffffff"],
.color-dot[data-color="#f8fafc"] {
  box-shadow: inset 0 0 0 2px #94a3b8, 0 1px 2px rgba(0,0,0,.18) !important;
}
.color-dot.selected {
  outline: 2px solid #38bdf8 !important;
  outline-offset: 2px !important;
}

/* Full hide toggle for the lower middle canvas toolbar. Collapse still exists separately. */
body.pd-hide-bottom-canvas-toolbar .canvas-nav-tools {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.command-button.pd-bottom-toolbar-off {
  opacity: .72;
  border-color: #64748b !important;
}
.command-button.pd-grid-active,
.command-button.pd-measure-active {
  outline: 2px solid #38bdf8 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 1px rgba(56,189,248,.35) inset !important;
}

/* Make collapsed lower controls a true small icon, not an invisible wide panel. */
.canvas-nav-tools.canvas-nav-tools-collapsed {
  box-sizing: border-box !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 6px !important;
  overflow: hidden !important;
}
.canvas-nav-tools.canvas-nav-tools-collapsed > *:not(.canvas-nav-collapse-button) {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.canvas-nav-tools.canvas-nav-tools-collapsed .canvas-nav-collapse-button {
  display: grid !important;
  place-items: center !important;
  margin: 0 !important;
  flex: 0 0 32px !important;
}

/* Locked PDF/image underlays should not steal scroll-wheel zoom or drag behavior. */
.pdf-underlay-group,
.pdf-underlay-foreign,
.pdf-underlay-foreign *,
.revision-image-underlay {
  pointer-events: none !important;
}

/* Layout grid overlay. It is editor-only and excluded from SVG/PDF/print output. */
.pd-layout-grid-overlay,
.pd-measure-overlay {
  pointer-events: none;
}
.pd-layout-grid-line-minor {
  stroke: #cbd5e1;
  stroke-width: .7;
  opacity: .38;
}
.pd-layout-grid-line-major {
  stroke: #38bdf8;
  stroke-width: 1.15;
  opacity: .62;
}
.pd-layout-grid-axis-label {
  fill: #075985;
  font-size: 13px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.pd-layout-grid-cell-label {
  fill: #64748b;
  font-size: 9px;
  font-weight: 700;
  opacity: .55;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 2px;
  stroke-linejoin: round;
}
.pd-layout-grid-border {
  fill: none;
  stroke: #0284c7;
  stroke-width: 1.5;
  opacity: .7;
}
.pd-layout-grid-badge {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 35;
  border: 1px solid rgba(14,165,233,.55);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(15,23,42,.88);
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(2,6,23,.32);
  pointer-events: none;
}
body:not(.pd-layout-grid-on) .pd-layout-grid-badge { display: none; }

.pd-measure-line {
  stroke: #e11d48;
  stroke-width: 3;
  stroke-dasharray: 10 6;
  fill: none;
}
.pd-measure-endpoint {
  fill: #ffffff;
  stroke: #e11d48;
  stroke-width: 2;
}
.pd-measure-label-bg {
  fill: rgba(255,255,255,.92);
  stroke: #e11d48;
  stroke-width: 1.2;
  rx: 6;
}
.pd-measure-label {
  fill: #881337;
  font-size: 14px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: middle;
}
body.pd-measure-mode .canvas-scroller { cursor: crosshair !important; }

/* Compact print tables: rebuilt by the polish script after core template rendering. */
.template-compact-title .template-company { font-size: 15px !important; }
.template-compact-title .template-print-title { font-size: 14px !important; }
.template-compact-title .template-label { font-size: 9px !important; }
.template-compact-title .template-value { font-size: 11px !important; }
.template-compact-key .template-key-title { font-size: 12px !important; }
.template-compact-key .template-key-small { font-size: 9px !important; }
.template-compact-title .template-click-hint,
.template-compact-key .template-click-hint { font-size: 8px !important; }

/* Keep the regression overlay visible while print/PDF paths are dry-run tested. */
body.pd-regression-test-running.printing-pdf .regression-harness-overlay {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
}
body.pd-regression-test-running .revision-import-panel,
body.pd-regression-test-running #appModal:not([hidden]) {
  visibility: hidden !important;
}
body.pd-regression-test-running .print-canvas {
  transition: none !important;
}

@media print {
  .pd-layout-grid-overlay,
  .pd-measure-overlay,
  .pd-layout-grid-badge,
  .pd-grid-command,
  .pd-measure-command,
  .pd-bottom-toolbar-command {
    display: none !important;
  }
}

/* Hard print/export guard: these layout aids are edit-only. */
body.printing-pdf #pdLayoutGridOverlay,
body.printing-pdf #pdMeasureOverlay,
.print-clean #pdLayoutGridOverlay,
.print-clean #pdMeasureOverlay {
  display: none !important;
}
