/* ═══════════════════════════════════════════════════════════
   PJ CIRCULAR — WORKSHEET CSS
   Physical workshop printout — filled in by hand
   All sections visible, fields shown as blank boxes,
   larger comment areas for handwriting
   ═══════════════════════════════════════════════════════════ */

body.worksheet-mode * {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ─── HIDE UI CHROME ──────────────────────────────────────── */
body.worksheet-mode header.topbar,
body.worksheet-mode .topbar-actions,
body.worksheet-mode .form-actions,
body.worksheet-mode .btn,
body.worksheet-mode .optional-toggles,
body.worksheet-mode .form-side,
body.worksheet-mode .form-page-header,
body.worksheet-mode .no-print,
body.worksheet-mode #toleranceNotice,
body.worksheet-mode #PartsNotice,
body.worksheet-mode .notice,
body.worksheet-mode .entry-card,
body.worksheet-mode #entryView,
body.worksheet-mode .section-badge,
body.worksheet-mode .view:not(.active) { display: none !important; }

/* ─── SHOW ALL OPTIONAL SECTIONS ─────────────────────────── */
body.worksheet-mode .optional-section { display: block !important; }
body.worksheet-mode .optional-toggles  { display: none !important; }

/* ─── PAGE SETUP ──────────────────────────────────────────── */
@media print {
  body.worksheet-mode {
    background: #fff;
    font-family: Arial, sans-serif;
    font-size: 12px;
    color: #000;
  }

  body.worksheet-mode main {
    padding: 0;
    max-width: 100%;
  }

  body.worksheet-mode @page {
    margin: 12mm 15mm 18mm 15mm;
  }
}

/* ─── WORKSHEET HEADER ────────────────────────────────────── */
body.worksheet-mode .print-header {
  display: flex !important;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid #000;
}
body.worksheet-mode .print-header-left  { display: flex; align-items: center; gap: 12px; }
body.worksheet-mode .print-header-logo  { height: 24px; width: auto; }
body.worksheet-mode .print-header-brand .brand-name { font-weight: 700; font-size: 14px; display: block; }
body.worksheet-mode .print-header-brand .brand-tag  { font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: #666; }
body.worksheet-mode .print-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
body.worksheet-mode .print-header-right .ph-label { font-size: 8px; letter-spacing: .12em; text-transform: uppercase; color: #888; font-weight: 600; }
body.worksheet-mode .print-header-right .ph-value  { font-size: 11px; font-weight: 600; }

/* ─── WORKSHEET LABEL ─────────────────────────────────────── */
body.worksheet-mode .print-title {
  display: block !important;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -.01em;
}
body.worksheet-mode .print-title::after {
  content: ' — WORKSHEET';
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .15em;
  color: #888;
  vertical-align: middle;
  margin-left: 8px;
}

/* ─── SECTIONS ────────────────────────────────────────────── */
body.worksheet-mode .form-section {
  break-inside: avoid;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid #ccc;
  border-radius: 0;
  margin-bottom: 12px;
  padding: 10px 0;
}
body.worksheet-mode .section-head {
  margin-bottom: 8px;
}
body.worksheet-mode .section-num {
  background: #000;
  color: #fff;
}
body.worksheet-mode .section-title {
  color: #000;
}

/* ─── FIELDS — show as blank lines ───────────────────────── */
body.worksheet-mode .field label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #555;
  display: block;
  margin-bottom: 2px;
}

body.worksheet-mode input[type=text],
body.worksheet-mode input[type=date],
body.worksheet-mode input[type=number],
body.worksheet-mode select {
  display: block !important;
  width: 100%;
  border: none;
  border-bottom: 1px solid #000;
  border-radius: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 12px;
  color: #000;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

/* ─── TEXTAREAS — larger for handwriting ─────────────────── */
body.worksheet-mode textarea {
  display: block !important;
  width: 100%;
  border: 1px solid #999;
  border-radius: 3px;
  background: transparent;
  padding: 6px;
  font-size: 12px;
  color: #000;
  min-height: 60px;
  resize: none;
}

/* Remarks / notes fields get extra height */
body.worksheet-mode #f_worknotes,
body.worksheet-mode #f_conclusion,
body.worksheet-mode textarea[placeholder*="remark"],
body.worksheet-mode textarea[placeholder*="Remark"],
body.worksheet-mode textarea[placeholder*="note"],
body.worksheet-mode textarea[placeholder*="Note"] {
  min-height: 80px;
}

/* ─── SHOW ALL CHECKBOXES ─────────────────────────────────── */
body.worksheet-mode .check-item {
  display: flex !important;
}
body.worksheet-mode .check-item input[type=checkbox] {
  width: 14px;
  height: 14px;
  border: 1.5px solid #000;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  flex-shrink: 0;
  margin-right: 6px;
}

/* ─── CONDITION ROWS — show all as checkboxes ────────────── */
body.worksheet-mode .cond-row { display: flex !important; align-items: flex-start; gap: 8px; }

/* Choice group — wrap buttons horizontally */
body.worksheet-mode .choice-group {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

/* Each ch-btn becomes a checkbox + label */
body.worksheet-mode .ch-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  border: none !important;
  background: transparent !important;
  color: #000 !important;
  font-size: 12px !important;
  padding: 0 !important;
  cursor: default;
  font-weight: 400 !important;
  border-radius: 0 !important;
}

/* Fake checkbox before each button label */
body.worksheet-mode .ch-btn::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.5px solid #000;
  border-radius: 2px;
  background: #fff;
  flex-shrink: 0;
}

/* If already active — show as ticked */
body.worksheet-mode .ch-btn.active::before {
  content: '✓';
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  font-weight: 700;
  color: #000;
}

/* ─── TABLES — measurement fields ────────────────────────── */
body.worksheet-mode .final-meas-table td input,
body.worksheet-mode table input {
  border: none;
  border-bottom: 1px solid #000;
  border-radius: 0;
  background: transparent;
  min-width: 60px;
}

/* ─── DRAWING / DIAGRAM ───────────────────────────────────── */
body.worksheet-mode .cl-diagram img,
body.worksheet-mode img[alt*="drawing"],
body.worksheet-mode img[alt*="Measurement"] {
  max-height: 220px;
  width: auto;
  display: block;
  margin: 8px auto;
}

/* ─── HIDE PICTURES SECTION ──────────────────────────────── */
body.worksheet-mode #sectionPictures { display: none !important; }

/* ─── PARTS — show content, hide loading notice ──────────── */
body.worksheet-mode #partsContent .notice { display: none !important; }
body.worksheet-mode #toleranceContent .notice { display: none !important; }

/* ─── STATUS DOTS — hide colours ─────────────────────────── */
body.worksheet-mode .status-dot { background: #fff !important; border: 1.5px solid #000; }

/* ─── SIDE PANEL ─────────────────────────────────────────── */
body.worksheet-mode .form-wrap { display: block !important; }

/* Fjerne alt placeholder text og gør det usynligt */
body.worksheet-mode input::placeholder,
body.worksheet-mode textarea::placeholder {
  color: transparent;
}

/* ═══ KOMPAKT LAYOUT (2026-07-29, Rasmus) ═══════════════════
   Skrivefelterne fyldte enormt meget ift. tekststørrelsen, så lange
   måleark (fx KBB ST-shaft D1–D5/L1–L4) løb over flere sider. Alt
   strammes: mindre felthøjder, mindre afstande, kompakte tabelceller.
   !important er nødvendigt fordi skabelonerne bruger inline-styles
   (padding:5px 8px osv.) direkte på cellerne. */
body.worksheet-mode { line-height: 1.25; }

body.worksheet-mode .form-section {
  margin-bottom: 6px;
  padding: 6px 0;
}
body.worksheet-mode .section-head { margin-bottom: 4px; }
body.worksheet-mode .field        { margin-bottom: 3px; }

body.worksheet-mode input[type=text],
body.worksheet-mode input[type=date],
body.worksheet-mode input[type=number],
body.worksheet-mode select {
  padding: 1px 0;
  font-size: 11px;
}

body.worksheet-mode textarea            { min-height: 34px; padding: 3px 5px; font-size: 11px; }
body.worksheet-mode #f_worknotes,
body.worksheet-mode #f_conclusion,
body.worksheet-mode textarea[placeholder*="remark"],
body.worksheet-mode textarea[placeholder*="Remark"],
body.worksheet-mode textarea[placeholder*="note"],
body.worksheet-mode textarea[placeholder*="Note"] { min-height: 48px; }

/* Tabeller (måle-rækker, parts, tolerance): stram alle celler — vinder
   over skabelonernes inline padding via !important. */
body.worksheet-mode table td,
body.worksheet-mode table th {
  padding: 2px 6px !important;
  font-size: 11px !important;
  line-height: 1.25 !important;
}
body.worksheet-mode table input {
  padding: 0 !important;
  min-width: 52px;
  font-size: 11px !important;
}
/* Måletabellernes remark-celler: én skrivelinje, ikke en boks */
body.worksheet-mode table textarea {
  min-height: 16px !important;
  border: none !important;
  border-bottom: 1px solid #000 !important;
  border-radius: 0 !important;
  padding: 1px 0 !important;
}

/* Sektions-divider-rækker (farvede colspan-celler) må gerne være helt lave */
body.worksheet-mode table td[colspan] { padding: 2px 6px !important; }
