@page {
  /* size: A4;
    /* width: 210mm;
    height: 297mm;  */
  margin: 15mm 15mm 15mm 15mm;
  size: A4;
  @bottom-right-corner {
    content: counter(page) '/' counter(pages);
    margin-right: 2mm;
  }
}

/*Need to replace this with .front-page-section .pagedjs_page_content*/
.pagedjs_frontPageLayout_page .pagedjs_page_content .report-page-container {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.front-page-section {
  page: frontPageLayout;
}
@page frontPageLayout {
  @top-left {
    content: string(customFrontPageText);
    color: red;
    font-weight: 500;
  }
}

.index-page-section,
.external-link-page {
  page: indexPageLayout;
}

@page indexPageLayout {
  @top-center {
    content: string(inspectionName);
  }
  @top-left {
    content: string(companyName);
  }
  @top-right {
    content: string(reportDate);
  }
}

.turbine-index-page-section {
  page: turbineIndexPageLayout;
}

@page turbineIndexPageLayout {
  @top-left {
    content: 'Turbine index';
  }
  @top-right {
    content: element(turbineName);
  }
}

#disclaimer-section {
  page: disclaimerLayout;
}

@page disclaimerLayout {
  @top-center {
    content: 'Disclaimer';
  }
  @top-left {
    content: string(companyName);
  }
  @top-right {
    content: string(reportDate);
  }
}

#summary-section {
  page: summaryLayout;
}

@page summaryLayout {
  @top-center {
    content: string(inspectionName);
  }
  @top-left {
    content: string(companyName);
  }
  @top-right {
    content: string(reportDate);
  }
}

.standard-image-section {
  page: standardImageLayout;
}

@page standardImageLayout {
  @top-center {
    content: string(inspectionName);
  }
  @top-left {
    content: string(companyName);
  }
  @top-right {
    content: string(reportDate);
  }
}

.blade-ps {
  position: running(bladePsRunning);
}
.blade-le {
  position: running(bladeLeRunning);
}
.blade-ss {
  position: running(bladeSsRunning);
}
.blade-te {
  position: running(bladeTeRunning);
}

/* .wind-turbine-page {
  page: windTurbineLayout;
} */

/* Blade A layouts */
.sc-bladea-ps {
  page: scBladeAPsLayout;
}
.sc-bladea-ss {
  page: scBladeASsLayout;
}
.sc-bladea-te {
  page: scBladeATeLayout;
}
.sc-bladea-le {
  page: scBladeALeLayout;
}
/* Blade B layouts */
.sc-bladeb-ps {
  page: scBladeBPsLayout;
}
.sc-bladeb-ss {
  page: scBladeBSsLayout;
}
.sc-bladeb-te {
  page: scBladeBTeLayout;
}
.sc-bladeb-le {
  page: scBladeBLeLayout;
}
/* Blade C layouts*/
.sc-bladec-ps {
  page: scBladeCPsLayout;
}
.sc-bladec-ss {
  page: scBladeCSsLayout;
}
.sc-bladec-te {
  page: scBladeCTeLayout;
}
.sc-bladec-le {
  page: scBladeCLeLayout;
}

/* Blade A Pages */
@page scBladeAPsLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladeapsTag);
  }
  @left-middle {
    content: element(bladePsRunning);
    margin-left: 5mm;
  }
}
@page scBladeASsLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladeassTag);
  }
  @left-middle {
    content: element(bladeSsRunning);
    margin-left: 5mm;
  }
}
@page scBladeATeLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladeateTag);
  }
  @left-middle {
    content: element(bladeTeRunning);
    margin-left: 5mm;
  }
}
@page scBladeALeLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladealeTag);
  }
  @left-middle {
    content: element(bladeLeRunning);
    margin-left: 5mm;
  }
}
/* Blade B Pages*/
@page scBladeBPsLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladebpsTag);
  }
  @left-middle {
    content: element(bladePsRunning);
    margin-left: 5mm;
  }
}
@page scBladeBSsLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladebssTag);
  }
  @left-middle {
    content: element(bladeSsRunning);
    margin-left: 5mm;
  }
}
@page scBladeBTeLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladebteTag);
  }
  @left-middle {
    content: element(bladeTeRunning);
    margin-left: 5mm;
  }
}
@page scBladeBLeLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladebleTag);
  }
  @left-middle {
    content: element(bladeLeRunning);
    margin-left: 5mm;
  }
}
/* Blade C Pages */
@page scBladeCPsLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladecpsTag);
  }
  @left-middle {
    content: element(bladePsRunning);
    margin-left: 5mm;
  }
}
@page scBladeCSsLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladecssTag);
  }
  @left-middle {
    content: element(bladeSsRunning);
    margin-left: 5mm;
  }
}
@page scBladeCTeLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladecleTag);
  }
  @left-middle {
    content: element(bladeTeRunning);
    margin-left: 5mm;
  }
}
@page scBladeCLeLayout {
  margin: 15mm 15mm 15mm 15mm;
  @top-left {
    content: string(inspectionName);
  }
  @top-right {
    content: element(bladecleTag);
  }
  @left-middle {
    content: element(bladeLeRunning);
    margin-left: 5mm;
  }
}

.blade-ps {
  display: none;
}

.blade-le {
  display: none;
}

.blade-ss {
  display: none;
}

.blade-te {
  display: none;
}

.sc-turbine-name-tag span {
  padding: 3px 5px;
  border: 1px solid lightgray;
  border-radius: 30px;
  margin-right: 2mm;
  white-space: nowrap;
  word-wrap: break-word;
}

.wind-tag-container span {
  padding: 3px 5px;
  border: 1px solid lightgray;
  border-radius: 30px;
  margin-right: 2mm;
  white-space: nowrap;
  word-wrap: break-word;
}

@page scBladePsLayout {
  margin: 15mm 15mm 15mm 50mm;
  @top-left-corner {
    text-align: left;
    padding-left: 5mm;
    content: string(companyName);
  }
  @left-middle {
    content: element(bladePsRunning);
    margin-left: 5mm;
  }
}

@page scBladeLeLayout {
  margin: 15mm 15mm 15mm 50mm;
  @left-middle {
    content: element(bladeLeRunning);
  }
}

@page scBladeSsLayout {
  margin: 15mm 15mm 15mm 50mm;
  @left-middle {
    content: element(bladeSsRunning);
    margin-left: 5mm;
  }
}

@page scBladeTeLayout {
  margin: 15mm 15mm 15mm 50mm;
  @left-middle {
    content: element(bladeTeRunning);
  }
}

@media screen {
  #report-vm {
    background-color: lightgrey;
  }

  #report-vm .pagedjs_page {
    background: white;
    box-shadow: 0 0.5mm 2mm rgba(0, 0, 0, 0.3);
    margin: 5mm auto;
  }

  #list-toc-generated {
    width: 100%;
    border-collapse: collapse;
  }
  #list-toc-generated tr {
    border-collapse: collapse !important;
  }
  #list-toc-generated .comments-td {
    white-space: pre-line;
  }
  #list-toc-generated .severity-td {
    text-align: center;
  }
  #list-toc-generated .page-td {
    text-align: center;
  }
  #list-toc-generated td {
    border: 1px solid #e0e0e0;
    padding: 5px;
  }
  #list-toc-generated th {
    border: 1px solid #e0e0e0;
    padding: 5px;
  }
}
.pagedjs_page_content sc-ol-map {
  display: none !important;
}
.pagedjs_page_content .report-include-image {
  display: block !important;
}
.paper_view_content_root .pagedjs_page {
  background: white;
  box-shadow: 0 0.5mm 2mm rgba(0, 0, 0, 0.3);
  margin: 5mm auto;
}

@media print {
  /* Image view settings small key-value table (ensures Tailwind utility styles survive print / paged.js processing) */
  .image-view-settings-table {
    border: 1px solid #d9d9d9 !important;
    border-collapse: collapse !important;
    width: auto !important;
    font-size: 12px !important;
  }
  .image-view-settings-table tr {
    break-inside: avoid;
  }
  .image-view-settings-table th,
  .image-view-settings-table td {
    border: 1px solid #d9d9d9 !important;
    padding: 4px 6px !important;
    vertical-align: top;
  }
  .image-view-settings-table th {
    font-weight: 600;
    text-align: left;
    color: #475569;
    white-space: nowrap;
  }
  .image-view-settings-table td {
    color: #111827;
    max-width: 60mm;
    word-break: break-word;
  }
  /* Remove rounded corners for print consistency */
  .image-view-settings-table,
  .image-view-settings-table tr:first-child th:first-child,
  .image-view-settings-table tr:first-child td:first-child {
    border-radius: 0 !important;
  }
  .report-ref-inspection-name {
    string-set: inspectionName content();
    display: none;
  }

  .report-ref-company-name {
    string-set: companyName content();
    display: none;
  }

  .report-ref-custom-front-page-text {
    string-set: customFrontPageText content();
    display: none;
  }

  .report-ref-report-date {
    string-set: reportDate content();
    display: none;
  }

  .sc-tag-bladea-ps {
    position: running(bladeapsTag);
  }
  .sc-tag-bladea-ss {
    position: running(bladeassTag);
  }
  .sc-tag-bladea-te {
    position: running(bladeateTag);
  }
  .sc-tag-bladea-le {
    position: running(bladealeTag);
  }
  .sc-tag-bladeb-ps {
    position: running(bladebpsTag);
  }
  .sc-tag-bladeb-ss {
    position: running(bladebssTag);
  }
  .sc-tag-bladeb-le {
    position: running(bladebleTag);
  }
  .sc-tag-bladeb-te {
    position: running(bladebteTag);
  }
  .sc-tag-bladec-ss {
    position: running(bladecssTag);
  }
  .sc-tag-bladec-ps {
    position: running(bladecpsTag);
  }
  .sc-tag-bladec-le {
    position: running(bladecleTag);
  }
  .sc-tag-bladec-te {
    position: running(bladecteTag);
  }

  .sc-turbine-name-tag {
    position: running(turbineName);
  }

  .report-image-container-break {
    break-before: page;
  }

  .report-blade-container-break {
    break-before: page;
  }

  .report-annotation {
    break-inside: avoid;
  }

  .report-issue {
    break-inside: avoid;
  }

  .li-item {
    break-inside: avoid;
  }

  .annotation {
    break-inside: avoid;
  }

  .blade-side {
    break-before: page;
  }

  .sc-bladea-le,
  .sc-bladea-te,
  .sc-bladea-ss,
  .sc-bladea-ps,
  .sc-bladeb-le,
  .sc-bladeb-te,
  .sc-bladeb-ss,
  .sc-bladeb-ps,
  .sc-bladec-te,
  .sc-bladec-ps,
  .sc-bladec-ss,
  .sc-bladec-le {
    break-before: page;
  }

  #list-toc-generated {
    list-style: none;
    width: 100%;
    border-collapse: collapse;
  }

  #list-toc-generated tr {
    border-collapse: collapse !important;
  }
  #list-toc-generated td {
    border: 1px solid #e0e0e0;
    padding: 5px;
    break-inside: avoid; /* Fixes issue with empty rows */
  }
  #list-toc-generated th {
    border: 1px solid #e0e0e0;
    min-width: 30px;
    padding: 5px;
  }

  #list-toc-generated .issues-th {
    min-width: 100px;
  }

  #list-toc-generated tr {
    border-collapse: collapse !important;
  }

  .page-number-link::after {
    content: target-counter(attr(page-number), page);
    float: right;
  }

  .severity-td {
    text-align: center;
  }

  .sc-blade-ps {
    display: block;
  }

  .sc-blade-le {
    display: block;
  }

  .sc-blade-ss {
    display: block;
  }

  .sc-blade-te {
    display: block;
  }

  .blade-side .annotations-container {
    padding-left: 40mm;
  }
}
@media (min-width: 651px) {
  .codex-editor--narrow .codex-editor__redactor {
    margin-right: 0px;
  }
}
