/* General Styles */
body {
  font-family: Arial, sans-serif;
  background-color: #f7f7f7;
  color: #333;
  margin: 0;
  padding: 20px;
}

header, main {
  max-width: 800px;
  margin: 0 auto;
}

/* Header and Subtitle Styling */
header h1 {
  text-align: center;
  color: #1a5632;
  margin-bottom: 0;
}

.subtitle {
  text-align: center;
  font-size: 1.2em;
  margin: 0;
}

/* Instruction above data entry */
#entry-instructions {
  text-align: center;
  font-weight: bold;
  margin-bottom: 20px;
}

/* Date of Birth section styling */
#dob-section {
  background: #fff;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
#dob-section h2 {
 margin-bottom: 10px;
}
#dob-section input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* DOB display under header */
#dob-display {
  text-align: center;
  font-style: italic;
  margin: 10px 0 20px;
}


/* Section Styling */
section {
  background: #fff;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Form Styling */
form div {
  margin-bottom: 10px;
}

form label {
  display: block;
  margin-bottom: 5px;
  color: #1a5632;
}

form input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Button Styling */
button {
  background-color: #fdB913;
  color: #fff;
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  opacity: 0.9;
}

/* Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

table, th, td {
  border: 1px solid #ccc;
}

th, td {
  padding: 8px;
  text-align: center;
}

th {
  background-color: #1a5632;
  color: #fff;
}

/* Footer Styling */
footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9em;
}

/* Print Date - hidden on screen, displayed in print */
#print-date {
  display: none;
}


/* Figure Styles */
figure#external-graph {
margin: 20px 0;
text-align: center;
}

figure#external-graph img {
max-width: 100%;
height: auto;
border: 1px solid #ccc;
border-radius: 4px;
}

figure#external-graph figcaption {
font-size: 0.85em;
color: #555;
margin-top: 8px;
}

/* Hide the external graph on screen */
figure#external-graph {
display: none;
}


figure#external-graph {
  background: #fff;
  padding: 20px;
  margin: 20px 0;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  text-align: center;
}

/* Date of Birth section styling */
#dob-section {
  background: #fff;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
#dob-section input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}


.hidden { display: none; }

/* Buttons */
.btn-secondary {
  background-color: #1a5632;
  color: white;
  border: none;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 4px;
}
.btn-primary {
  background-color: #fdB913;
  color: white;
  border: none;
  padding: 8px 12px;
  margin-top: 10px;
  border-radius: 4px;
}

/* DOB Section */
#dob-section {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

/* Age display */
.age-output {
  margin-top: 14px;
  font-size: 23px;
  font-weight: bold;
  font-style: italic;
}

.growth-output {
  margin-top: 18px;
}

.eye-growth-card {
  padding: 8px 0 4px;
  background: transparent;
  color: #333;
}

.eye-growth-card h3 {
  margin: 0 0 10px;
  color: #1a5632;
  font-size: 1.1em;
  line-height: 1.2;
}

.eye-growth-card p {
  margin: 0;
}

#expected-sentence {
  margin-bottom: 14px;
  color: #3d4047;
  font-size: 0.95em;
}

.expected-growth-rate {
  margin-top: 8px !important;
}

.eye-growth-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e3e8;
}

.eye-growth-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.eye-growth-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: #1a5632;
  font-size: 1.05em;
}

.measured-growth-rate {
  margin: 0 0 8px 40px !important;
  color: #3d4047;
  font-size: 0.9em;
}

.eye-icon {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 20px;
  border: 2px solid #1a5632;
  border-radius: 50%;
}

.eye-icon::before {
  content: "";
  position: absolute;
  inset: 5px 10px;
  border-radius: 50%;
  background: #1a5632;
}

.eye-icon::after {
  content: "";
  position: absolute;
  inset: 8px 13px;
  border-radius: 50%;
  background: #fff;
}

.growth-gauge {
  position: relative;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  margin-top: 28px;
  height: 32px;
  border: 2px solid #b9bdc4;
  border-radius: 999px;
  background: #f6f7f9;
  overflow: visible;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.growth-gauge-fill {
  position: absolute;
  inset: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ed1c24 0%, #f7941d 28%, #f7e64a 50%, #9acd32 70%, #16a34a 100%);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.growth-goal-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #2b2d31;
  z-index: 2;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.growth-marker {
  position: absolute;
  left: clamp(32px, calc(var(--growth-percent) * 1%), calc(100% - 32px));
  top: 50%;
  z-index: 3;
  width: 22px;
  height: 22px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #f7941d;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.growth-marker span {
  position: absolute;
  left: 50%;
  bottom: 29px;
  min-width: 52px;
  white-space: nowrap;
  border-radius: 8px;
  padding: 5px 8px;
  color: #fff;
  background: #f7941d;
  font-size: 0.9em;
  font-weight: bold;
  text-align: center;
  transform: translateX(-50%);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.growth-marker span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  border-top: 8px solid #f7941d;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  transform: translateX(-50%);
}

.growth-gauge.goal-met .growth-marker,
.growth-gauge.goal-met .growth-marker span {
  background: #2fa44f;
}

.growth-gauge.goal-met .growth-marker span::after {
  border-top-color: #2fa44f;
}

.growth-gauge.growth-faster .growth-marker,
.growth-gauge.growth-faster .growth-marker span {
  background: #d92d20;
}

.growth-gauge.growth-faster .growth-marker {
  left: 14px;
}

.growth-gauge.growth-faster .growth-marker span {
  left: 0;
  transform: none;
}

.growth-gauge.growth-faster .growth-marker span::after {
  left: 12px;
}

.growth-gauge.growth-faster .growth-marker span::after {
  border-top-color: #d92d20;
}

.growth-scale {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  margin-top: 10px;
  font-size: 0.82em;
}

.growth-scale span:nth-child(2) {
  text-align: center;
}

.growth-scale span:nth-child(3) {
  text-align: right;
}

.growth-scale strong {
  font-size: 1.15em;
}

.eye-growth-note {
  color: #555;
}

@media print {
  .eye-growth-card {
    break-inside: avoid;
    page-break-inside: avoid;
    padding-top: 0;
  }

  .eye-growth-card h3 {
    font-size: 20px;
  }

  #expected-sentence,
  .measured-growth-rate {
    font-size: 11px;
  }

  .eye-growth-row {
    margin-top: 14px;
    padding-top: 14px;
  }

  .eye-growth-heading {
    font-size: 14px;
  }

  .growth-gauge {
    height: 28px;
    margin-top: 24px;
  }

  .growth-gauge-fill {
    inset: 5px;
  }

  .growth-marker {
    width: 22px;
    height: 22px;
  }

  .growth-marker span {
    bottom: 28px;
    font-size: 10px;
  }

  .growth-scale {
    font-size: 10px;
  }
}

.dob-note {
  margin: 0 0 16px;
  color: #555;
  font-size: 0.95em;
  line-height: 1.4;
}

.hidden { display: none; }


.recall-code-box {
  margin-top: 14px;
  margin-bottom: 14px;
}

#recall-panel summary {
  margin-left: 55px;
  margin-bottom: 10px;
  color: #1a5632;
  font-weight: bold;
  cursor: pointer;
}

#recall-panel summary::marker {
  color: #fdB913;
}

.code-box {
  background: #fff;
  border: 1px solid #ccc;
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 4px;
}
.code-box label {
  display: block;
  margin-bottom: 8px;
  color: #1a5632;
}
.code-box textarea {
  width: 100%;
  height: 80px;
  padding: 8px;
  box-sizing: border-box;
  margin-bottom: 8px;
}
.code-box button {
  background: #fdB913;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* Step Headings */
#input-section h2,
#dob-section h2,
#print-section h2 {
  font-size: 1.1em;
  color: #1a5632;
  margin-bottom: 12px;
}

/* Style the Axial Length Data Table heading like the other steps */
#data-table-section h2 {
  font-size: 1.1em;
  color: #1a5632;
  margin-bottom: 12px;
}

/* Skinny but wrap‐friendly header */
#data-table th:nth-child(6) {
  max-width: 80px;       /* limit width so header can wrap */
  white-space: normal;   /* allow wrapping in header */
  word-break: break-word;
}

/* Skinny, no‐wrap data cells */
#data-table td:nth-child(6) {
  width: 80px;           /* fixed width for data */
  max-width: 80px;
  white-space: nowrap;   /* prevent wrapping for numeric data */
  overflow: hidden;      /* hide any overflow */
  text-overflow: ellipsis; /* optional: show “…” if it somehow overflows */
}


/* Print Button Styling (reuse btn-primary) */
#print-patient-handout {
  background-color: #fdB913;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}

@media print {
  /* Hide everything except the handout */
  header,
  #dob-section,
  #recall-panel,
  #input-section form,
  #print-section,
  #code-section,
  .btn-primary,
  .btn-secondary,
  #print-patient-handout,
  #race-selection,
  .screen-only {
    display: none !important;
  }

  @media print {
    .hidden-print { display: none !important; }
    header, footer { display: none !important; }
    /* page‐footer for page numbers… */
  }
 

  /* Show only these elements */
  #axialChart,
  #growth-comparison,
  #data-table-section,
  #external-graph {
    display: block !important;
  }

  /* Make sections flush and clean */
  body {
    margin: 0;
    padding: 0;
  }

  section {
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
  }

  /* Optional: print date in top right */
  #print-date {
    display: block;
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 12px;
  }
}

.print-only {
  display: none;
}

@media print {
  .print-only {
    display: block;
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
    color: #1a5632;
  }
}


.dob-field {
  max-width: 320px;
  margin-bottom: 18px;
}

.dob-field label {
  display: block;
  margin-bottom: 6px;
  color: #1a5632;
  font-weight: bold;
}

.quick-birthday-picker {
  margin: 0 0 18px;
}

.quick-picker-label {
  margin: 0 0 10px;
  color: #1a5632;
  font-weight: bold;
}

.quick-picker-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr 1fr;
  gap: 14px;
}

.quick-picker-title {
  margin-bottom: 6px;
  color: #555;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
}

.quick-grid {
  display: grid;
  gap: 5px;
}

.quick-year-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-month-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-day-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.quick-grid button,
.race-option {
  background-color: #eee;
  border: 1px solid #ccc;
  color: #333;
}

.quick-grid button {
  min-height: 36px;
  padding: 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.quick-grid button.selected {
  background-color: #fdB913;
  color: white;
  font-weight: bold;
}

#race-grid {
  display: grid;
  grid-template-columns: repeat(2, 100px);
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.race-option {
  background-color: #eee;
  border: 1px solid #ccc;
  text-align: center;
  line-height: 50px;
  height: 50px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.race-option.selected {
  background-color: #fdB913;
  color: white;
  font-weight: bold;
}

@media (max-width: 720px) {
  .quick-picker-grid {
    grid-template-columns: 1fr;
  }
}
/* Hide elements meant only for screen in print */
@media print {
  .screen-only { display: none !important; }
}

/* Print-only title */
.print-only { display: none; }
@media print {
  .print-only {
    display: block;
    text-align: center;
    font-size: 24px;
    color: #1a5632;
    margin-bottom: 4px;
  }
  /* Hide Step 1 heading too */
  #input-section h2.screen-only {
    display: none !important;
  }
}

/* Small date under title */
.small-print-date { display: none; }
@media print {
  .small-print-date {
    display: block;
    text-align: center;
    font-size: 0.9em;
    color: #555;
    margin-bottom: 20px;
  }
}

/* Hide everything except chart, table, external graph, title/date, and growth-comparison */
@media print {
  header,
  #dob-section,
  #recall-panel,
  #input-section form,
  #print-section,
  #code-section,
  .btn-primary,
  .btn-secondary,
  #race-grid,
  .race-option {
    display: none !important;
  }
  #axialChart,
  #print-handout-title,
  #print-report-date,
  #growth-comparison,
  #data-table-section,
  #external-graph {
    display: block !important;
  }
  body { margin:0; padding:0; }
  section { box-shadow:none; border:none; padding:0; margin:0; }
}

/* Step 3 heading style (matches other step headings) */
#print-options-section h2 {
  font-size: 1.1em;
  color: #1a5632;
  margin-bottom: 12px;
}

.patient-material-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  gap: 20px;
  align-items: stretch;
}

.material-column h3 {
  margin: 0 0 10px;
  color: #1a5632;
  font-size: 1em;
  text-align: center;
}

.material-column {
  box-sizing: border-box;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.material-column:nth-child(2) {
  text-align: left;
}

.qr-help {
  margin: 0 0 10px;
  color: #555;
  font-size: 0.92em;
  line-height: 1.35;
}

.qr-button {
  display: grid;
  place-items: center;
  margin: 0 auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px;
  background: #fff;
  cursor: pointer;
}

.qr-button:hover {
  border-color: #1a5632;
  opacity: 1;
}

.qr-status {
  margin-top: 8px;
  color: #555;
  font-size: 0.86em;
  text-align: center;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
}

.qr-modal.hidden {
  display: none;
}

.qr-modal-content {
  position: relative;
  width: min(420px, 100%);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.qr-modal-content h2 {
  margin: 0 0 16px;
  color: #1a5632;
  font-size: 1.1em;
}

.qr-modal-content p {
  margin: 14px 0 0;
  color: #555;
}

.qr-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  background: #1a5632;
  line-height: 1;
  font-size: 1.2em;
}

/* Each checkbox on its own line */
.print-option {
  margin-bottom: 8px;
}

@media print {
  /* ➊ Hide UI elements */
  header,
  #dob-section,
  #recall-panel,
  #input-section form,
  #print-options-section,
  #code-section,
  #qr-modal,
  .btn-primary,
  #race-grid,
  .race-option {
    display: none !important;
  }

  /* ➋ Show always these two */
  #print-handout-title,
  #print-report-date,
  #axialChart,
  #growth-comparison {
    display: block !important;
  }

  /* ➌ Show data‐table & graph by default */
  #data-table-section,
  #external-graph-section {
    display: block !important;
  }

  /* ➍ But if toggled off, hide them */
  #data-table-section.hidden-print,
  #external-graph-section.hidden-print {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .patient-material-grid {
    grid-template-columns: 1fr;
  }
}

/* Hide the copy button on printouts */
@media print {
  #copy-code {
    display: none !important;
  }
}

/* Narrow the Visit Date and AL input fields */
#visit-date,
#axial-length-od,
#axial-length-os {
  max-width: 720px;
  width: 100%;
}
