/*
  Printable hand-written dental chart templates (blogs/chart_template.html).

  This page reuses chart_pdf.css (tables and abbreviations) so the template is the same chart the app prints. The app's color coding is deliberately left out: it only means something on screen.
  Only the things a hand-written form needs are added here: taller rows, fill-in lines, checkboxes, ruled note lines,
  and print rules for US letter landscape. Load chart_pdf.css first. Prefixed ct-.
  Each .pdf-page is exactly one sheet (816px tall at the 1056px width), same as the PDF.
*/

body.ct-body {
  margin: 0;
  background: #E9ECF1;
}

/* ---------- on-screen toolbar (hidden when printing) ---------- */
.ct-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  background: #FFFFFF;
  border-bottom: 1px solid #D9DDE3;
  font-family: "Noto Sans", sans-serif;
}
.ct-toolbar a {
  color: #2F81F8;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.ct-toolbar a:hover {
  text-decoration: underline;
}
.ct-tb-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1D1E1F;
}
.ct-tb-sub {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: #6B7280;
}
.ct-tb-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.ct-print {
  padding: 9px 18px;
  border: 1px solid #2F81F8;
  border-radius: 3px;
  background: #2F81F8;
  color: #FFFFFF;
  font-family: "Noto Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ct-print:hover {
  background: #FFFFFF;
  color: #2F81F8;
}
.ct-stage {
  display: flex;
  justify-content: center;
  padding: 24px;
  overflow-x: auto;
}

/* ---------- the sheets ---------- */
/* wider columns than the PDF (360px per table instead of 340) and taller rows, so there is room to write */
.ct-doc {
  --pdf-cols: 26px 30px 22px 40px 28px 28px 32px 22px 30px 34px 34px 34px;
}
.ct-doc .pdf-row {
  min-height: 25px;
}
/* cats have 15 tooth rows instead of 21, so each row can be taller */
.ct-doc-cat .pdf-row {
  min-height: 36px;
}
.ct-doc .pdf-th {
  font-size: 7.5px;
}
.ct-doc .pdf-cell:first-child {
  font-size: 10px;
}
.ct-sheet-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  color: #2F81F8;
}
.ct-sheet-sub {
  margin-top: 3px;
  font-size: 8.5px;
  color: #6B7280;
}

/* header with blank fields */
.ct-head {
  display: grid;
  grid-template-columns: 230px 1fr;
  align-items: end;
  gap: 24px;
  padding-bottom: 9px;
  border-bottom: 2px solid #2F81F8;
}
.ct-fields {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 8px 18px;
}
.ct-field {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.ct-label {
  flex: 0 0 auto;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B7280;
}
.ct-line {
  flex: 1 1 auto;
  height: 17px;
  border-bottom: 1px solid #1D1E1F;
}

/* main area: tables on the sides, the real chart artwork in the middle */
.ct-main {
  display: grid;
  grid-template-columns: 360px 1fr 360px;
  gap: 10px;
  margin-top: 10px;
}
.ct-main > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ct-diagram {
  position: relative;
  flex: 1 1 auto;
  border: 1px solid #D9D9D9;
  border-radius: 3px;
  /* the chart image has this same gray as its own background, so the edges blend in */
  background: #D9D9D9;
  overflow: hidden;
}
.ct-diagram img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
}

/* overview with tick boxes */
.ct-bottom {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
}
/* the five overview rows in two columns */
.ct-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 28px;
}
.ct-opt-row {
  display: flex;
  align-items: center;
  padding: 2.5px 0;
  font-size: 9px;
}
.ct-opt-name {
  flex: 0 0 96px;
  color: #6B7280;
}
.ct-opt {
  display: inline-flex;
  align-items: center;
  margin-right: 12px;
  white-space: nowrap;
}
.ct-box {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border: 1px solid #1D1E1F;
  border-radius: 1px;
}
.ct-inline-line {
  display: inline-block;
  width: 90px;
  height: 11px;
  margin-left: 2px;
  border-bottom: 1px solid #1D1E1F;
}

/* page 2: abbreviations at a readable size, then ruled note lines */
.ct-doc .pdf-g-item {
  font-size: 8.5px;
}
.ct-doc .pdf-g-name {
  font-size: 8px;
}
.ct-doc .pdf-g-code {
  font-size: 11px;
}
/* the app color-codes each group, but a paper chart has no use for that: plain dark rules instead */
.ct-doc .pdf-g {
  border-top: 2px solid #1D1E1F;
}
.ct-notes-heading {
  margin: 12px 0 2px 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2F81F8;
}
.ct-rule {
  height: 24px;
  border-bottom: 1px solid #9CA3AF;
}
.ct-tooth-rule {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 24px;
  border-bottom: 1px solid #9CA3AF;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B7280;
}
.ct-tooth-rule span {
  display: inline-block;
  width: 38px;
  height: 14px;
  border-bottom: 1px solid #1D1E1F;
}
.ct-tooth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

/* ---------- print: one sheet per .pdf-page, US letter landscape ---------- */
@page {
  size: 11in 8.5in;
  margin: 0;
}
@media print {
  html, body {
    background: #FFFFFF !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ct-toolbar {
    display: none !important;
  }
  .ct-stage {
    display: block;
    padding: 0;
    overflow: visible;
  }
  .ct-doc {
    width: 1056px;
    box-shadow: none;
  }
  .ct-doc .pdf-page {
    break-after: page;
    page-break-after: always;
  }
  .ct-doc .pdf-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
