/* ============================================= */
/* PRINT.CSS - COMPLETE & FIXED FOR LOGO + WORD  */
/* ============================================= */

/* ── Document Containers ── */
.doc-landscape,
.doc-outline {
	background: white;
	font-family: "Times New Roman", Times, serif;
	width: 100%;
	max-width: 1080px;
	min-height: 720px;
	margin: 0 auto 28px;
	padding: 0.55in 0.65in 0.55in 0.65in;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 8px 30px rgba(0,0,0,0.08);
	border: 1px solid #d1d5db;
	border-radius: 3px;
	page-break-after: always;
	position: relative;
	overflow-x: auto;
	box-sizing: border-box;
}

.doc-portrait {
	background: white;
	font-family: "Times New Roman", Times, serif;
	width: 100%;
	max-width: 760px;
	min-height: 1050px;
	margin: 0 auto 28px;
	padding: 0.65in 0.7in 0.65in 0.7in;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 8px 30px rgba(0,0,0,0.08);
	border: 1px solid #d1d5db;
	border-radius: 3px;
	page-break-after: always;
	position: relative;
	box-sizing: border-box;
}

/* ── Professional Header - Logo on Right ── */
.doc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 22px;
	padding-bottom: 16px;
	border-bottom: 3px double #0f172a;
}

.doc-header-left {
	flex: 1;
	text-align: center;
}

.doc-header-right {
	flex-shrink: 0;
	width: 100px;
	height: 78px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.doc-header-right img {
	max-width: 100px;
	max-height: 78px;
	object-fit: contain;
}

.doc-institution {
	font-size: 17px;
	font-weight: 900;
	color: #0f172a;
	text-transform: uppercase;
	letter-spacing: 1.1px;
	line-height: 1.25;
	margin-bottom: 7px;
}

.doc-title {
	display: inline-block;
	font-size: 12.8px;
	font-weight: 700;
	padding: 7px 26px;
	border: 2.5px solid #0f172a;
	border-radius: 30px;
	color: #0f172a;
	letter-spacing: 1.4px;
	text-transform: uppercase;
	background: white;
	white-space: nowrap;
}

/* ── Tables - Strong borders for all documents ──
   ⚠️  SCOPED ON PURPOSE. These rules describe a *generated document* table
   (A4, Times, 10pt, heavy black grid, fixed column widths). They used to be
   written as bare `table` / `th` / `td` selectors, which meant they applied
   to EVERY table on every page that loads this sheet — and this sheet is
   loaded by both partials/_head.html and admin.php.

   What that cost, before scoping:
     • `table-layout: fixed` overrode the browser's content-based sizing on
       the admin tables. #usersTable's ten columns were each handed an equal
       1/10th of the width, so the 46px `#` column got 134px and the
       Institution column got 134px for a `.inst-badge` that is 190px wide —
       the badge spilled out of its cell and printed on top of the Reg. Date
       column. (admin-v2.css's `td[data-label="#"] { width: 46px }` had no
       effect either: under fixed layout only the FIRST row's cells — the
       <th>s — set column widths.)
     • `border: 1px solid #0f172a` on td drew black vertical rules through
       admin tables that are designed with horizontal separators only.
     • `tbody tr:nth-child(even) td` added zebra striping the admin design
       does not use, and `td:first-child` forced every first column in the
       app to bold navy centred text with !important.

   The document preview does not lose anything: partials/app.html's
   #icmsDocStyles block already defines the same table styling scoped to
   these containers, and that block — not this file — is what gets embedded
   into the Word/PDF downloads by wrapDoc(). Keep .doc-portrait in the list;
   #icmsDocStyles only covers landscape/outline cell borders. */
.doc-landscape table,
.doc-outline table,
.doc-portrait table {
	width: 100%;
	border-collapse: collapse;
	margin: 12px 0;
	font-size: 10pt;
	table-layout: fixed;
	word-wrap: break-word;
	overflow: hidden;
	border: 2px solid #0f172a;
}

.doc-landscape th,
.doc-outline th,
.doc-portrait th {
	background-color: #e2e8f0;
	color: #1e293b;
	border: 1px solid #0f172a;
	padding: 8px 6px;
	font-weight: 700;
	text-align: center;
	font-size: 9.5pt;
	letter-spacing: 0.3px;
	vertical-align: middle;
}

.doc-landscape td,
.doc-outline td,
.doc-portrait td {
	border: 1px solid #0f172a;
	padding: 7px 6px;
	vertical-align: top;
	line-height: 1.45;
	font-size: 10pt;
	word-break: break-word;
	overflow-wrap: break-word;
}

/* Alternating row shading */
.doc-landscape tbody tr:nth-child(even) td,
.doc-outline tbody tr:nth-child(even) td,
.doc-portrait tbody tr:nth-child(even) td {
	background-color: #f8fafc;
}
.doc-landscape tbody tr:hover td,
.doc-outline tbody tr:hover td,
.doc-portrait tbody tr:hover td {
	background-color: #fffbeb;
}

/* Section / group-header rows */
/* The bare `tr.section-header td, tr.row-header td` fallbacks that used to
   close this list were dropped: they carried !important and leaked out of
   the documents. The .doc-* variants below already cover every generator. */
.doc-landscape tr.section-header td,
.doc-outline tr.section-header td,
.doc-portrait tr.section-header td,
.doc-landscape tr.row-header td,
.doc-outline tr.row-header td,
.doc-portrait tr.row-header td {
	background-color: #cbd5e1 !important;
	color: #0f172a !important;
	font-weight: 700 !important;
	font-size: 9.5pt !important;
	letter-spacing: 0.2px !important;
	border-color: #0f172a !important;
}

/* First-column accent — the bare `td:first-child` that used to close this
   list was the worst offender in the file: three !important declarations
   applied to the first cell of every table in the app, including the admin
   tables' row-number column. */
.doc-landscape td:first-child,
.doc-outline td:first-child {
	font-weight: 700 !important;
	color: #1e3a8a !important;
	text-align: center !important;
	background-color: inherit;
}

/* Second-column accent */
.doc-landscape td:nth-child(2),
.doc-outline td:nth-child(2) {
	font-weight: 700 !important;
	color: #1e3a8a !important;
	text-align: center !important;
}

/* Minimum row height */
.doc-landscape tbody tr,
.doc-outline tbody tr {
	min-height: 28px;
}

/* Meta info table */
.doc-meta {
	width: 100%;
	margin: 10px 0 16px;
	border: 2px solid #0f172a;
}

.doc-meta td {
	padding: 6px 10px;
	border: 1px solid #0f172a !important;
	font-size: 9.8pt;
	line-height: 1.4;
}

.doc-meta .label {
	background: #f1f5f9 !important;
	font-weight: 700;
	width: 140px;
	color: #374151;
}

/* Footer & Signature */
.document-footer {
	margin-top: 28px;
	padding-top: 12px;
	border-top: 2px solid #0f172a;
}

.signature-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-top: 14px;
}

.signature-item {
	text-align: center;
	padding: 8px 6px 10px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
}

.signature-line {
	border-top: 1px solid #374151;
	margin-top: 26px;
	padding-top: 6px;
	font-size: 9.5pt;
	font-weight: 600;
	color: #1e293b;
}

.signature-label {
	font-size: 8.5pt;
	font-weight: 700;
	margin-top: 2px;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.6px;
}

/* Mobile table scroll wrapper */
.table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 15px 0;
}
.table-scroll table {
	margin: 0;
	min-width: 600px;
}

/* ── Named @page rules ── */
@page landscape-page {
	size: A4 landscape;
	margin: 0.45in 0.5in;
}
@page portrait-page {
	size: A4 portrait;
	margin: 0.5in 0.55in;
}
@page {
	size: A4 portrait;
	margin: 0.5in;
}

.doc-landscape,
.doc-outline {
	page: landscape-page;
}
.doc-portrait {
	page: portrait-page;
}

/* ── Print & Word Export Optimizations ── */
@media print {
	body {
		background: none !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
		color-adjust: exact;
	}

	.doc-landscape,
	.doc-outline,
	.doc-portrait {
		box-shadow: none !important;
		border: none !important;
		border-radius: 0 !important;
		max-width: 100% !important;
		width: 100% !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 0.45in 0.5in !important;
	}

	.doc-header {
		margin-bottom: 18px;
	}
	.doc-title {
		border: 2.5px solid #0f172a !important;
		font-size: 11pt;
		padding: 6px 22px;
	}
	.doc-institution {
		font-size: 15pt;
	}

	/* Strong borders for Word */
	table {
		border: 2px solid #0f172a !important;
	}
	th, td {
		border: 1px solid #0f172a !important;
	}

	/* Preserve alternating rows */
	tbody tr:nth-child(even) td {
		background-color: #f8fafc !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.doc-meta .label {
		background: #f1f5f9 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	/* Page break control */
	.doc-landscape + .doc-landscape,
	.doc-outline + .doc-outline,
	.doc-portrait + .doc-portrait {
		page-break-before: always;
	}

	table {
		page-break-inside: auto;
		font-size: 9pt;
	}
	tr {
		page-break-inside: avoid;
	}
	td, th {
		font-size: 9pt;
		padding: 5px 5px;
	}
	.table-scroll {
		overflow: visible !important;
	}
	.document-footer {
		page-break-inside: avoid;
	}
	.signature-item {
		background: #f9fafb !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}