/**
 * Lab Maintenance Sheets - Print Stylesheet
 */

@media print {
	/* 👑 CRITICAL: Force-zero page margins to HIDE browser default header/footer.
	   Chrome/Edge/Firefox print the URL (right) & page title (left) + date/time
	   + page number inside the top/bottom page margins. By setting @page margin:0
	   there is NO room for those strips → they disappear from the PDF entirely. */
	@page {
		size: A4;
		margin: 0;
	}

	/* 🌈 FORCE BACKGROUND / COLOR PRINTING:
	   Οι Chromium browsers / Firefox από προεπιλογή κάνουν "economy" mode:
	   αφαιρούν χρώματα και backgrounds για να εξοικονομήσουν μελάνι εκτυπωτή.
	   Με το print-color-adjust: exact το WordPress/PDF διατηρεί ΑΚΡΙΒΩΣ τα χρώματα
	   όπως είναι στο CSS (μπλε κεφαλίδες, μπλε stripes στις σειρές πινάκων κλπ). */
	html, body, .lab-printable-sheet, .lab-doc-table, .table-section-head {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
		color-adjust: exact;
	}

	/* Add our own, 100% controllable running footer at the BOTTOM-CENTER of every page.
	   The browser does NOT auto-center "Page 1 of N" natively via CSS (that's controlled
	   by the "Headers and footers" browser checkbox we just disabled). To reproduce a
	   CENTERED page counter we have two options:
	     A) Use CSS running-footers (good, works in Chrome 120+ / Edge 120+ / Firefox 110+)
	        with a named string we place at the bottom of the document itself.
	     B) Fall back to a static "Σελίδα N" element that the page-break algorithm
	        will repeat visually if needed.
	   We implement BOTH approaches below so older browsers still show something clean. */

	/* --- CSS Running Footer (Center page number, clean, no date/URL) --- */
	/* The running container is positioned OUTSIDE the page flow using running().
	   Inside @bottom-center we use browser-native page counters so "Σελίδα 1 από 3"
	   is printed automatically (no JS, no pre-calculation needed). */
	.lab-page-footer {
		display: block;
		position: running(footerCenter);
		text-align: center;
		font-size: 9pt;
		color: #444;
		padding: 0;
		margin: 0;
	}

	/* Inject the running footer at the BOTTOM-CENTER of every printed page
	   using the browser's native print counters: counter(page) / counter(pages) */
	@page {
		@bottom-center {
			content: "Σελίδα " counter(page) " από " counter(pages);
			font-size: 9pt;
			color: #444;
			font-family: Arial, sans-serif;
		}
	}

	/* A4-safe printable area — restore inner padding on the document itself
	   so content doesn't sit at the absolute edge, and reserve space at the
	   very bottom (bottom margin) for the page-number footer. */
	@page :first { margin-top: 0; }

	/* Hide WordPress UI elements */
	#adminmenumain,
	#wpadminbar,
	#adminmenuback,
	#adminmenuwrap,
	#wpfooter,
	.lab-no-print,
	.button,
	.notice {
		display: none !important;
	}

	html, body {
		background: #fff !important;
		color: #000 !important;
		margin: 0 !important;
		padding: 0 !important;
		font-size: 12pt;
		font-family: Arial, sans-serif;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	/* Ensure the entire admin wrap has no spacing (no extra white-space at top) */
	#wpwrap, #wpcontent, #wpbody, #wpbody-content {
		margin: 0 !important;
		padding: 0 !important;
		width: 100% !important;
		float: none !important;
	}

	.lab-wrap {
		max-width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	/* Document-level padding replaces browser margins (A4 safe area).
	   Top: 1.6cm, Sides: 1.6cm, Bottom: 1.4cm (extra room for our centered page number) */
	.lab-printable-sheet {
		padding: 1.6cm 1.6cm 1.4cm 1.6cm;
		background: #fff;
		box-shadow: none !important;
		border: none !important;
		border-radius: 0 !important;
		max-width: 100% !important;
		page-break-after: avoid;
		counter-reset: page; /* reset our manual counter in case running() is not supported */
	}

	.lab-sheet-doc-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 2px solid #000;
		padding-bottom: 10px;
		margin-bottom: 15px;
	}

	.lab-doc-branding h2 {
		font-size: 14pt;
		margin: 0;
		text-transform: uppercase;
	}

	.lab-doc-branding h3 {
		font-size: 16pt;
		margin: 5px 0 0 0;
		color: #000;
	}

	.lab-doc-meta-right {
		text-align: right;
	}

	.lab-doc-id {
		font-weight: bold;
		font-size: 12pt;
		display: block;
	}

	.lab-doc-status {
		display: inline-block;
		padding: 3px 8px;
		font-size: 10pt;
		font-weight: bold;
		border: 1px solid #000;
		margin-top: 5px;
	}

	.lab-doc-table {
		width: 100%;
		border-collapse: collapse;
		margin-bottom: 15px;
		page-break-inside: avoid;
	}

	.lab-doc-table th, .lab-doc-table td {
		border: 1px solid #333;
		padding: 8px 10px;
		font-size: 10pt;
		vertical-align: top;
	}

	.table-section-head {
		/* ✅ Ίδιο μπλε όπως στο screen view — αντί για το γκρι #f0f0f0 που "ξέπλυνε" το χρώμα */
		background: linear-gradient(135deg, #1e3a8a, #1d4ed8) !important;
		color: #ffffff !important;
		font-weight: 700 !important;
		text-transform: uppercase;
		text-align: left;
		font-size: 12pt;
		padding: 10pt 12pt !important;
		margin: 0;
	}

	.lbl {
		width: 25%;
		font-weight: bold;
		background: #fafafa;
	}

	.val-bold {
		font-weight: bold;
		font-size: 11pt;
	}

	.lab-doc-checklist {
		list-style: none;
		padding: 0;
		margin: 0;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 5px;
	}

	.lab-doc-checklist li {
		font-size: 10pt;
	}

	.lab-doc-photos-block {
		margin-top: 20px;
	}

	.lab-doc-photo-group {
		page-break-inside: avoid;
	}

	.lab-doc-photo-group h5 {
		margin: 5px 0;
		font-size: 11pt;
		border-bottom: 1px solid #ccc;
	}

	.lab-doc-gallery-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 10px;
		margin-top: 8px;
	}

	.lab-doc-gallery-thumb {
		border: 1px solid #999;
		height: 140px;
		overflow: hidden;
	}

	.lab-doc-gallery-thumb img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.lab-doc-signatures-block {
		display: flex;
		justify-content: space-between;
		margin-top: 40px;
		page-break-inside: avoid;
	}

	.lab-sig-col {
		width: 45%;
		text-align: center;
	}

	.sig-name {
		margin: 30px 0 10px 0;
		font-weight: bold;
	}

	.sig-line {
	border-top: 1px dashed #000;
	width: 80%;
	margin: 0 auto;
	padding-top: 6px;
}

.sig-line::after {
	content: "Υπογραφή";
	font-size: 9pt;
	color: #555;
	font-style: italic;
}
}
