/* Parent Manual form styles (PDF-like continuous scroll viewer)
   Keeps existing site layout (css/style.css + css/enrollment.css) intact.
*/

#parent-manual-root {
  background: #fff;
  padding: 20px;
  /* Keep the white document panel flush with the footer (no green gap) */
  margin: 0;
  border-radius: 4px;
}

#parent-manual-root h2 {
  margin-top: 0;
  font-size: x-large;
}

.pm-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid #ddd;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fafafa;
  margin: 14px 0;
}

.pm-toolbar .pm-toolbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pm-toolbar .pm-toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}


.pm-toolbar-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pm-toolbar-row1 {
  justify-content: space-between;
  flex-wrap: wrap;
}

.pm-toolbar-row2 {
  justify-content: flex-start;
}

.pm-toolbar-row2 .pm-status {
  width: 100%;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}



/* Toolbar layout: two rows (controls + status) */
.pm-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pm-toolbar-row1 {
  justify-content: space-between;
  flex-wrap: nowrap;
}

.pm-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.pm-toolbar .grasp-btn {
  font-size: 14px;
  padding: 10px 14px;
  white-space: nowrap;
}

.pm-zoom {
  display: flex;
  align-items: center;
  gap: 6px; /* tighter spacing */
  flex-wrap: nowrap;
}

.pm-zoom-btn {
  padding: 6px 10px;
  min-width: 34px;
  font-size: 14px;
}

.pm-zoom-value {
  min-width: 54px;
  text-align: center;
  font-size: 13px;
}

.pm-toolbar-row2 .pm-status {
  width: 100%;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.pm-status {
  font-size: 13px;
  color: #333;
}

.pm-status .pm-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  margin-right: 6px;
}

.pm-status .pm-pill.ok {
  border-color: #7bbf7b;
  background: #f0fff0;
}

.pm-status .pm-pill.warn {
  border-color: #e4c86a;
  background: #fff9e6;
}


.pm-status .pm-pill.pm-pill-flash {
  animation: pmPillFlash 900ms ease-in-out 1;
}

@keyframes pmPillFlash {
  0% { transform: scale(1); }
  35% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.pm-scroll {
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow-y: auto;
  overflow-x: auto;
  height: 70vh; /* scrollable region for the manual */
  background: #f6f6f6;
  padding: 12px;
}

.pm-page {
  position: relative;
  margin: 0 auto 14px auto;
  max-width: 900px;
  background: #fff;
  border: 1px solid #e2e2e2;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.pm-page img {
  display: block;
  width: 100%;
  height: auto;
}

.pm-overlay {
  position: absolute;
  inset: 0;
}

.pm-field {
  position: absolute;
  box-sizing: border-box;
  font-size: 14px;
  padding: 4px 6px;
  border: 2px solid rgba(0,0,0,0.35);
  border-radius: 3px;
  background: rgba(255,255,255,0.92);
}

.pm-field:focus {
  outline: none;
  border-color: rgba(0, 125, 255, 0.75);
  box-shadow: 0 0 0 2px rgba(0,125,255,0.15);
}

.pm-field.pm-field-initials {
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.5px;
}

/* Click-to-edit initials (show initials in the PDF box; reveal input only on click) */
.pm-initials-display {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #111;
  cursor: text;
  user-select: none;
  padding: 0;
}

.pm-initials-display.pm-initials-empty {
  opacity: 0.55;
  font-weight: 700;
}

.pm-field.pm-initials-input {
  /* Override base input chrome so it matches the PDF box underneath */
  background: transparent;
  border: 0;
  padding: 0;
}

.pm-field.pm-initials-input.pm-initials-hidden {
  opacity: 0;
  pointer-events: none;
  caret-color: transparent;
}

.pm-field.pm-initials-input:focus {
  opacity: 1;
  pointer-events: auto;
  caret-color: auto;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0, 125, 255, 0.75);
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(0,125,255,0.15);
}

.pm-field.pm-field-disabled {
  background: rgba(245,245,245,0.95);
  color: #666;
  border-style: dashed;
}

.pm-small-hint {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
}

/* Preview modal: make the manual area scroll nicely */
.pm-preview-scroll {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f6f6f6;
  padding: 10px;
}

.pm-preview-page {
  position: relative;
  margin: 0 auto 12px auto;
  max-width: 820px;
  background: #fff;
  border: 1px solid #e2e2e2;
}

.pm-preview-page img {
  width: 100%;
  height: auto;
  display: block;
}

.pm-preview-overlay {
  position: absolute;
  inset: 0;
}

.pm-print-value {
  position: absolute;
  box-sizing: border-box;
  font-size: 14px;
  padding: 2px 4px;
  background: transparent;
  color: #111;
  border: 0;
  white-space: pre;
}


.pm-print-value.pm-print-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0;
  line-height: 1;
  transform: translate(-15px,10px); /* fix initials position */
}
.pm-missing {
  background: #fff3f3;
  border: 1px solid #f1b1b1;
  color: #7a1111;
  padding: 10px 12px;
  border-radius: 6px;
  margin: 0 0 12px 0;
}

.pm-missing.pm-missing-ok {
  background: #f0fff0;
  border-color: #7bbf7b;
  color: #125112;
}

.pm-missing-list {
  margin: 8px 0 0 0;
  padding-left: 22px;
  max-height: 180px;
  overflow: auto;
}

.pm-missing-more {
  margin-top: 8px;
}

.pm-missing-more summary {
  cursor: pointer;
  font-weight: 600;
}

.pm-missing-more ul {
  margin: 8px 0 0 0;
  padding-left: 22px;
  max-height: 180px;
  overflow: auto;
}

.pm-missing-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.pm-missing-link:hover,
.pm-missing-link:focus {
  text-decoration-thickness: 2px;
}

/* Ensure the modal itself remains usable even when content is tall */
.grasp-modal-dialog {
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.grasp-modal-body {
  overflow: auto;
}

/* Flash highlight when jumping to a missing field */
.pm-field-flash {
  box-shadow: 0 0 0 4px rgba(255, 200, 0, 0.35);
  border-color: rgba(255, 165, 0, 0.85) !important;
}


/* Zoom controls */
.pm-zoom {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pm-zoom-btn {
  border: 1px solid #cfcfcf;
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.pm-zoom-btn:hover {
  background: #f1f1f1;
}

.pm-zoom-value {
  min-width: 54px;
  text-align: center;
  font-size: 13px;
  color: #333;
}

.pm-zoom-reset {
  padding: 6px 12px;
}

/* phase 3 - tune displayed initials */
/* === Phase 3A: initials view-mode tuning (size + nudge) === */
:root{
  /* Adjust these later without touching JS */
  --pm-initials-font-size: 14px;     /* smaller than before, still readable */
  --pm-initials-x-nudge: -18px;      /* move LEFT (~2–3 chars) */
  --pm-initials-y-nudge: 8px;        /* move DOWN (~5–10px) */
}

/* Try multiple selectors to match whatever Phase 2 created */
.pm-initials-value,
.pm-initials-display,
.pm-initials-overlay .value,
.pm-initials-overlay .pm-initials-value{
  font-size: var(--pm-initials-font-size) !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  display: inline-block !important;
  white-space: nowrap;
  transform: translate(var(--pm-initials-x-nudge), var(--pm-initials-y-nudge));
}

/* === Phase 3B: initials edit-mode box tuning (padding + height) === */
:root{
  --pm-initials-input-pad-x: 4px;     /* narrower left/right */
  --pm-initials-input-pad-y: 1px;     /* shorter/tighter */
  --pm-initials-label-reserve: 14px;  /* reserve space so PDF 'Initials' label isn't covered */
}

/* Container should not add extra padding */
.pm-initials-overlay,
.pm-initials,
.pm-field--initials{
  box-sizing: border-box;
  padding: 0 !important;
}

/* Input sizing */
.pm-initials-overlay input,
.pm-initials input,
.pm-field--initials input{
  box-sizing: border-box !important;
  width: 100% !important;

  /* Make input less tall so it doesn't cover the PDF label area */
  height: calc(100% - var(--pm-initials-label-reserve)) !important;

  padding: var(--pm-initials-input-pad-y) var(--pm-initials-input-pad-x) !important;
  font-weight: 800 !important;
  font-size: var(--pm-initials-font-size) !important;
  line-height: 1.1 !important;

  /* Keep it anchored near the top of the initials box */
  margin-top: 2px !important;
}

/* =========================================================
   Phase 3 (v2): tighter initials stamp/input fit (SAFE)
   - Do NOT override element width/height (inline styles size the box).
   - Adjust text position using padding (keeps hit-area aligned).
   - Use inset focus highlight so the box doesn't "grow".
   ========================================================= */
:root{
  /* Stamp (view mode) */
  --pm-initials-font-size: 13px;     /* smaller, closer to page text */
  --pm-initials-font-weight: 800;    /* bold */

  /* Nudge the STAMP text (your note: a bit lower + a touch right) */
  --pm-initials-stamp-pad-left: 6px; /* right ~2–3px */
  --pm-initials-stamp-pad-top: 32px;  /* down double the prev. value approx */
  --pm-initials-stamp-pad-bottom: 10px; /* preserves grey "Initials" label space */

  /* Input (edit mode) */
  --pm-initials-input-pad-x: 3px;    /* narrower left/right */
  --pm-initials-input-pad-y: 1px;    /* shorter vertical */
}

/* ---- View mode (STAMP) ---- */
.pm-initials-display{
  font-size: var(--pm-initials-font-size) !important;
  font-weight: var(--pm-initials-font-weight) !important;
  line-height: 1.1 !important;
  letter-spacing: 0.3px !important;

  /* Shift content without moving the click target box */
  padding-left: var(--pm-initials-stamp-pad-left) !important;
  padding-top: var(--pm-initials-stamp-pad-top) !important;
  padding-bottom: var(--pm-initials-stamp-pad-bottom) !important;
  padding-right: 0 !important;

  cursor: pointer;
}

/* ---- Edit mode (INPUT) ---- */
input.pm-initials-input{
  font-size: var(--pm-initials-font-size) !important;
  font-weight: var(--pm-initials-font-weight) !important;
  line-height: 1.1 !important;
  letter-spacing: 0.3px !important;

  /* Tighter feel, but DO NOT change width/height */
  padding: var(--pm-initials-input-pad-y) var(--pm-initials-input-pad-x) !important;

  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;

  text-align: center;
  text-transform: uppercase;
}

/* Override the earlier focus style that adds outer border/box-shadow */
.pm-field.pm-initials-input:focus{
  background: rgba(255,255,255,0.70) !important;
  border: 0 !important;

  /* Inset highlight stays within the box */
  box-shadow: inset 0 0 0 2px rgba(0,125,255,0.55) !important;
  outline: none !important;
}


/* Submit-in-progress UI (spinner + message in the preview modal) */
.pm-submit-progress {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #333;
}

.pm-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.18);
  border-top-color: rgba(0,0,0,0.70);
  animation: pmSpin 0.9s linear infinite;
}

@keyframes pmSpin {
  to { transform: rotate(360deg); }
}
