.erp-result-wrap {
	max-width: 700px;
	margin: 0 auto;
	font-family: sans-serif;
}

.urdu-font {
	font-family: "ERPUrduFont", "Jameel Noori Nastaleeq", sans-serif;
	line-height: 2.1;
}

.erp-search-box {
	background: #f7f7f9;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 20px;
	text-align: center;
	margin-bottom: 20px;
}

.erp-search-box label {
	display: block;
	font-size: 18px;
	margin-bottom: 10px;
	font-family: "ERPUrduFont", "Jameel Noori Nastaleeq", sans-serif;
}

.erp-search-row {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
}

.erp-search-row input[type="text"] {
	padding: 10px 14px;
	font-size: 16px;
	border: 1px solid #ccc;
	border-radius: 6px;
	min-width: 220px;
	text-align: center;
}

.erp-btn {
	background: #1e6f46;
	color: #fff;
	border: none;
	padding: 10px 20px;
	font-size: 15px;
	border-radius: 6px;
	cursor: pointer;
	font-family: "ERPUrduFont", "Jameel Noori Nastaleeq", sans-serif;
}

.erp-btn:hover {
	background: #16532f;
}

.erp-message {
	margin-top: 10px;
	color: #1e6f46;
	font-family: "ERPUrduFont", "Jameel Noori Nastaleeq", sans-serif;
	display: none;
}

.erp-message.erp-error {
	color: #c0392b;
	display: block;
}

.erp-hidden {
	display: none;
}

.erp-pick-list {
	list-style: none;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
}

/* ---- Result card ---- */

.erp-card {
	border: 2px solid #1e6f46;
	border-radius: 10px;
	padding: 25px;
	background: #fff;
}

.erp-card-header {
	text-align: center;
	border-bottom: 2px solid #1e6f46;
	padding-bottom: 15px;
	margin-bottom: 15px;
}

.erp-header-img {
	width: 100%;
	max-width: 100%;
	height: auto;
	max-height: 220px;
	object-fit: contain;
	display: block;
	margin: 0 auto 10px;
}

.erp-school-name {
	margin: 5px 0;
	font-size: 26px;
}

.erp-exam-title {
	margin: 5px 0;
	font-size: 18px;
	color: #444;
}

.erp-student-info,
.erp-marks-table,
.erp-summary-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 15px;
}

.erp-student-info td {
	border: 1px solid #ddd;
	padding: 8px 10px;
	font-size: 15px;
}

.erp-label {
	background: #f2f2f2;
	font-weight: bold;
	width: 22%;
}

.erp-marks-table th,
.erp-marks-table td {
	border: 1px solid #ddd;
	padding: 8px 10px;
	text-align: center;
	font-size: 15px;
}

.erp-marks-table thead {
	background: #1e6f46;
	color: #fff;
}

.erp-marks-table tfoot td {
	font-weight: bold;
	background: #f7f7f7;
}

.erp-summary-table td {
	border: 1px solid #ddd;
	padding: 8px 10px;
	text-align: center;
	font-size: 15px;
}

.erp-status-pass {
	color: #1e6f46;
	font-weight: bold;
}

.erp-status-fail {
	color: #c0392b;
	font-weight: bold;
}

.erp-card-footer {
	margin-top: 40px;
	display: flex;
	justify-content: flex-end;
}

.erp-signature-box {
	border-top: 1px solid #333;
	padding-top: 5px;
	width: 200px;
	text-align: center;
}

.erp-print-actions {
	text-align: center;
	margin-top: 25px;
}

/* ---- Print styles: only the result card prints, Urdu fonts stay embedded ---- */
@media print {
	/* Some themes give ancestor wrappers "position: relative/fixed" for sticky headers or
	   mobile menus. That turns them into the containing block for our absolutely-positioned
	   card below, so "top: 0" ends up relative to THAT wrapper instead of the true page top —
	   and since hidden elements before it still reserve their layout space, the card gets
	   pushed down far enough to spill onto a second page. Forcing everything to static
	   positioning removes that interference. */
	* {
		position: static !important;
	}

	html, body {
		margin: 0 !important;
		padding: 0 !important;
		height: auto !important;
		background: #fff !important;
	}

	body * {
		visibility: hidden;
	}
	#erp-printable-card,
	#erp-printable-card * {
		visibility: visible;
	}
	#erp-printable-card {
		position: absolute !important;
		top: 0 !important;
		left: 0 !important;
		width: 100%;
		margin: 0 !important;
		border: 2px solid #1e6f46 !important;
		box-sizing: border-box;
	}
	.erp-no-print {
		display: none !important;
	}

	/* Compact everything specifically for print — screen view is untouched.
	   Needed because madrasa result cards can have 8-12+ subjects plus a tall
	   letterhead image, which easily overflows a page at normal screen spacing. */
	@page {
		size: A4;
		margin: 8mm;
	}

	.erp-card {
		padding: 10px !important;
	}

	.erp-card-header {
		padding-bottom: 6px !important;
		margin-bottom: 8px !important;
	}

	.erp-header-img {
		max-height: 100px !important;
		margin-bottom: 4px !important;
	}

	.erp-school-name {
		font-size: 18px !important;
		margin: 2px 0 !important;
	}

	.erp-exam-title {
		font-size: 13px !important;
		margin: 2px 0 !important;
	}

	.urdu-font {
		line-height: 2.1 !important;
	}

	.erp-student-info td {
		padding: 6px 10px !important;
		font-size: 12px !important;
	}

	.erp-student-info {
		margin-top: 8px !important;
	}

	.erp-student-info tr:first-child td {
		padding-top: 12px !important;
	}

	.erp-marks-table th,
	.erp-marks-table td,
	.erp-summary-table td {
		padding: 3px 10px !important;
		font-size: 12px !important;
	}

	.erp-marks-table thead th {
		padding-top: 10px !important;
	}

	.erp-student-info,
	.erp-marks-table,
	.erp-summary-table {
		margin-bottom: 6px !important;
	}

	.erp-card-footer {
		margin-top: 16px !important;
	}

	.erp-signature-box {
		width: 140px !important;
		font-size: 12px !important;
	}

	/* Safety net: some themes use sticky/fixed headers or their own print rules
	   that can fight the visibility trick above. Force-hide common theme
	   header/footer/nav/sidebar wrappers directly as a backup — this also
	   reclaims their vertical space instead of just hiding their content. */
	header, footer, nav,
	#masthead, #colophon, #site-header, #site-footer,
	.site-header, .site-footer, .site-navigation,
	.navbar, .main-navigation, .widget-area, .sidebar,
	#wpadminbar, .skip-link, .breadcrumbs {
		display: none !important;
		visibility: hidden !important;
	}
}
