/**
 * Styly pro export protokolu do PDF (HTML → html2pdf)
 * A4, okraje, zlomy stránek, typografie
 */

.protocol-pdf {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 10pt;
  line-height: 1.4;
  color: #1a1a1a;
  max-width: 210mm;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

.protocol-pdf * {
  box-sizing: border-box;
}

/* Na titulní stránce: název projektu na další řádek pod h1 */
.protocol-pdf .title-page__project {
  font-weight: normal;
  font-size: 14pt;
  margin: 6px 0 14px 0;
}

/* Stránka A4 – obsahová šířka s menšími vnějšími okraji */
.protocol-pdf .page-content {
  padding: 0 8mm 0 8mm;
  min-height: 0;
}

/* Titulní stránka */
.protocol-pdf .title-page {
  min-height: 240mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 10mm;
  page-break-after: always;
}

.protocol-pdf .title-page h1 {
  font-size: 18pt;
  font-weight: bold;
  margin: 0 0 14px 0;
  line-height: 1.3;
}

.protocol-pdf .title-page .subtitle {
  font-size: 12pt;
  margin: 0 0 10px 0;
}

.protocol-pdf .title-page .date {
  font-size: 11pt;
  margin: 0;
}

/* Hlavička stránky (opakovaná na každé stránce – viz .page) */
.protocol-pdf .page-header {
  padding: 0 10mm;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #333;
  font-size: 9pt;
}

.protocol-pdf .page-header .title {
  font-weight: bold;
}

.protocol-pdf .page-header .subtitle {
  font-weight: normal;
  color: #444;
}

/* Patička */
.protocol-pdf .page-footer {
  padding: 0 10mm;
  margin-top: 8px;
  font-size: 9pt;
  color: #555;
  text-align: center;
}

/* Obsah */
.protocol-pdf .toc {
  page-break-after: always;
}

.protocol-pdf .toc h2 {
  font-size: 12pt;
  font-weight: bold;
  margin: 0 0 8px 0;
}

.protocol-pdf .toc ul {
  list-style: none;
  padding-left: 4px;
  margin: 0 0 12px 0;
}

.protocol-pdf .toc-list--rooms {
  margin: 2px 0 6px 0;
  padding-left: 3em;
  font-size: 9pt;
}

.protocol-pdf .toc-item--room {
  margin: 1px 0;
}

.protocol-pdf .toc li {
  margin: 3px 0;
  font-size: 10pt;
}

.protocol-pdf .toc a {
  text-decoration: none;
  color: #1a1a1a;
  display: flex;
  align-items: baseline;
}

/* Tečky mezi názvem a číslem stránky v obsahu */
.protocol-pdf .toc a .toc-dots {
  flex: 1;
  border-bottom: 1px dotted #999;
  margin: 0 8px;
  min-width: 20px;
  height: 0.9em;
}

.protocol-pdf .toc a .page-number {
  flex-shrink: 0;
}

/* Sekce */
.protocol-pdf .section {
  margin-bottom: 14px;
  page-break-inside: avoid;
}

.protocol-pdf .section-title {
  font-size: 11pt;
  font-weight: bold;
  margin: 0 0 6px 0;
}
/* Nadpis 10 nesmí zůstat sám na stránce – držet s první místností */
.protocol-pdf #sec-10 .section-title {
  page-break-after: avoid;
}

.protocol-pdf .subsection {
  margin-bottom: 10px;
  page-break-inside: avoid;
}

.protocol-pdf .subsection-title {
  font-size: 9pt;
  font-weight: bold;
  margin: 0 0 4px 0;
  padding-left: 4px;
}

.protocol-pdf .subsection-content {
  padding-left: 8px;
  font-size: 9pt;
  margin: 0 0 2px 0;
}

.protocol-pdf .subsection-content p {
  margin: 0 0 4px 0;
}

/* Tabulka souhrnu (9.1) – vycentrovaná */
.protocol-pdf .summary-table-wrap {
  text-align: center;
  margin: 8px 0;
}
.protocol-pdf .summary-table {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: 8pt;
  page-break-inside: avoid;
}
.protocol-pdf .summary-table th,
.protocol-pdf .summary-table td {
  border: 1px solid #333;
  padding: 4px 6px;
  text-align: center;
}
.protocol-pdf .summary-table th {
  font-weight: bold;
  background: #f0f0f0;
}
.protocol-pdf .summary-table__group-row th.summary-table__group-namerene,
.protocol-pdf .summary-table__group-row th.summary-table__group-pozadovane {
  background: #e0e0e0;
  font-weight: bold;
}
.protocol-pdf .summary-table__vyhodnoceni--vyhovuje {
  color: #0a6b0a;
  font-weight: bold;
}
.protocol-pdf .summary-table__vyhodnoceni--nevyhovuje {
  color: #c00;
  font-weight: bold;
}

/* Tabulka požadavků normy (9.1) */
.protocol-pdf .requirements-table {
  border-collapse: collapse;
  font-size: 8pt;
  page-break-inside: avoid;
  margin: 8px 0;
}
.protocol-pdf .requirements-table th,
.protocol-pdf .requirements-table td {
  border: 1px solid #333;
  padding: 4px 6px;
  text-align: left;
}
.protocol-pdf .requirements-table th {
  font-weight: bold;
  background: #f0f0f0;
}

/* Podpis */
.protocol-pdf .signature {
  margin-top: 12px;
  padding-left: 8px;
  font-size: 9pt;
}

.protocol-pdf .signature .date { margin: 0 0 4px 0; }
.protocol-pdf .signature .name { margin: 0; font-weight: bold; }

/* Přílohy – nová stránka před každou */
.protocol-pdf .appendix {
  page-break-before: always;
}

.protocol-pdf .appendix-title {
  font-size: 12pt;
  font-weight: bold;
  margin: 0 0 10px 0;
}

/* Místnost v příloze 1 – každá na novou stránku */
.protocol-pdf .room-block {
  margin-bottom: 16px;
  page-break-before: always;
  page-break-inside: avoid;
}
.protocol-pdf .room-block:first-of-type {
  page-break-before: auto;
}
.protocol-pdf .room-block .room-tables {
  margin-bottom: 4px;
}
/* Fotografie místnosti v protokolu */
.protocol-pdf .room-block .room-photos-protocol {
  margin-top: 10px;
  margin-bottom: 4px;
}
.protocol-pdf .room-block .room-photos-protocol .room-photos-protocol-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}
.protocol-pdf .room-block .room-photo-protocol-img {
  max-width: 100%;
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #ddd;
}
.protocol-pdf .room-block .room-previews {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
}
.protocol-pdf .room-block .room-previews .room-floor-plan:not(.room-floor-plan--crop) {
  flex: 1 1 100%;
}
.protocol-pdf .room-block .room-previews .room-floor-plan--crop {
  flex: 0 1 auto;
}
.protocol-pdf .room-block .room-floor-plan {
  margin-top: 10px;
  page-break-inside: avoid;
}
/* Půdorysy a výřezy tak, jak jsou na plátně – bez ořezu výšky */
.protocol-pdf .room-block .room-floor-plan .floor-plan-img {
  max-width: 100%;
  height: auto;
  max-height: 230mm;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
/* Výřez tasku: --img-width, --img-height v pt; obrázek + popisek na jednu stránku, text v obrázku ~10pt */
.protocol-pdf .room-block .room-floor-plan--crop .floor-plan-img--crop-sized {
  width: calc(var(--img-width) * 1pt);
  height: calc(var(--img-height) * 1pt);
  max-width: 100%;
  max-height: 230mm;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.protocol-pdf .room-block .room-floor-plan--crop .floor-plan-img:not(.floor-plan-img--crop-sized) {
  max-width: 100%;
  height: auto;
  display: block;
}
.protocol-pdf .room-block .room-floor-plan--crop {
  margin-top: 8px;
  page-break-inside: avoid;
  display: inline-block;
  max-width: 100%;
}
/* Obal má přesně rozměr obrázku – žádné bílé pásy po stranách / nahoře-dole */
.protocol-pdf .room-block .room-floor-plan--crop .room-floor-plan__crop-wrap {
  display: block;
  width: calc(var(--img-width) * 1pt);
  height: calc(var(--img-height) * 1pt);
}
.protocol-pdf .room-block .protocol-preview-rotate-label {
  display: block;
  margin-top: 4px;
  font-size: 0.9em;
}
@media print {
  .protocol-pdf .protocol-preview-rotate-label {
    display: none;
  }
}
.protocol-pdf .room-block .room-previews .floor-plan-caption--preview {
  text-align: center;
  font-style: italic;
}

.protocol-pdf .room-block .room-name {
  font-size: 11pt;
  font-weight: bold;
  margin: 0 0 6px 0;
}

.protocol-pdf .room-block .char-list {
  font-size: 9pt;
  margin: 0 0 6px 0;
  padding-left: 4px;
}

.protocol-pdf .room-block .char-list p {
  margin: 0 0 2px 0;
}

/* Tabulka parametrů místnosti (všechny položky z levého menu) */
.protocol-pdf .room-params-wrap {
  margin: 8px 0 12px 0;
  overflow-x: auto;
  page-break-inside: avoid;
}
.protocol-pdf .room-params-table {
  width: 100%;
  max-width: 520px;
  border-collapse: collapse;
  font-size: 9pt;
}
.protocol-pdf .room-params-table th,
.protocol-pdf .room-params-table td {
  border: 1px solid #333;
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
}
.protocol-pdf .room-params-table th {
  font-weight: bold;
  background: #f0f0f0;
}
.protocol-pdf .room-params-table__label {
  width: 38%;
  color: #444;
}
.protocol-pdf .room-params-table__value {
  font-weight: 500;
}

/* Grid tabulka měření */
.protocol-pdf .grid-table-wrap {
  margin: 6px 0;
  overflow-x: auto;
  page-break-inside: avoid;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.protocol-pdf .grid-caption {
  font-size: 9pt;
  font-weight: normal;
  font-style: italic;
  margin: 4px 0 0 0;
}

.protocol-pdf .grid-table {
  border-collapse: collapse;
  font-size: 7pt;
  min-width: 120px;
}

.protocol-pdf .grid-table th,
.protocol-pdf .grid-table td {
  border: 1px solid #333;
  padding: 2px 4px;
  text-align: center;
  min-width: 14px;
}

.protocol-pdf .grid-table th {
  font-weight: bold;
  background: #f5f5f5;
}

/* Sloučené buňky – roh, X (m), Y (m) – bez ohraničení, bílé pozadí */
.protocol-pdf .grid-table__corner,
.protocol-pdf .grid-table__axis-label {
  border: none !important;
  background: #fff !important;
  font-size: 6pt;
  font-weight: bold;
  vertical-align: middle;
  text-align: center;
}

/* Buňky s hodnotami vzdálenosti (X, Y) – bez ohraničení, bílé pozadí */
.protocol-pdf .grid-table thead tr:nth-child(2) th,
.protocol-pdf .grid-table tbody tr th {
  border: none !important;
  background: #fff !important;
}

.protocol-pdf .grid-table .axis-label {
  font-size: 6pt;
  color: #555;
  padding-top: 4px;
}

/* Půdorys – obrázek v příloze 2 */
.protocol-pdf .floor-plan-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0;
  page-break-inside: avoid;
}

.protocol-pdf .floor-plan-caption {
  font-size: 9pt;
  margin: 2px 0 12px 0;
}

/* Měření zrakového úkolu – tabulka zón (task / surrounding / background) */
.protocol-pdf .task-mode-results {
  margin: 10px 0;
  page-break-inside: avoid;
}
.protocol-pdf .task-zone-table-title {
  font-weight: bold;
  margin: 12px 0 4px 0;
  font-size: 10pt;
}
.protocol-pdf .task-zone-table-title:first-of-type {
  margin-top: 6px;
}
.protocol-pdf .task-mode-intro {
  font-size: 9pt;
  color: #444;
  margin: 0 0 6px 0;
}
.protocol-pdf .task-zone-table {
  border-collapse: collapse;
  font-size: 9pt;
  width: 100%;
  max-width: 420px;
}
.protocol-pdf .task-zone-table th,
.protocol-pdf .task-zone-table td {
  border: 1px solid #ccc;
  padding: 4px 8px;
  text-align: left;
}
.protocol-pdf .task-zone-table th {
  font-weight: bold;
  background: #f0f0f0;
}
.protocol-pdf .task-zone-table td:nth-child(n+2):nth-child(-n+5) {
  text-align: right;
}

/* Náhled: skrýt tabulky měření podle checkboxu */
.protocol-pdf.hide-tables .grid-table-wrap {
  display: none !important;
}

/* Přílohy – ověřovací list, certifikát (embed PDF) */
.protocol-pdf .appendix-watermark-note {
  font-size: 9pt;
  color: #555;
  margin-bottom: 8px;
}
.protocol-pdf .appendix-pdf-pages {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.protocol-pdf .appendix-pdf-page-img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  border: 1px solid #ddd;
  border-radius: 4px;
  page-break-inside: avoid;
}
.protocol-pdf .appendix-pdf-no-pages {
  color: #666;
  font-size: 9pt;
  margin: 8px 0 0 0;
}
