/**
 * Check-In Print Handler Styles
 *
 * Styles for 4x2 inch check-in badge printing.
 * Uses CSS media queries to ensure only badge content is printed.
 *
 * @package Kingdom_Connect
 */

/* Hide print container by default */
#kc-print-container {
	display: none;
}

/* When printing, hide everything except the badge */
@media print {
	/* Hide all page elements */
	body.kc-printing * {
		visibility: hidden;
	}

	/* Show only the print container */
	body.kc-printing #kc-print-container,
	body.kc-printing #kc-print-container * {
		visibility: visible;
	}

	/* Position print container at top-left */
	body.kc-printing #kc-print-container {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		display: block !important;
	}

	/* Hide all other elements */
	body.kc-printing header,
	body.kc-printing footer,
	body.kc-printing nav,
	body.kc-printing .site-header,
	body.kc-printing .site-footer,
	body.kc-printing #wpadminbar,
	body.kc-printing #kc-checkin-kiosk,
	body.kc-printing .kc-kiosk-container,
	body.kc-printing .kc-kiosk-step {
		display: none !important;
		visibility: hidden !important;
	}
}

/* Badge styling - 4x2 inches (288x144 points at 72 DPI) */
.kc-checkin-badge {
	width: 4in;
	height: 2in;
	padding: 0.15in;
	box-sizing: border-box;
	border: 2px solid #000;
	background: #fff;
	font-family: Arial, Helvetica, sans-serif;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	page-break-inside: avoid;
	page-break-after: always;
}

/* Badge header (name and class) */
.kc-badge-header {
	text-align: center;
	border-bottom: 1px solid #000;
	padding-bottom: 0.1in;
	margin-bottom: 0.1in;
}

.kc-badge-name {
	font-size: 28pt;
	font-weight: bold;
	line-height: 1.2;
	margin-bottom: 0.05in;
	color: #000;
}

.kc-badge-class {
	font-size: 14pt;
	color: #333;
	font-weight: normal;
}

/* Allergies section */
.kc-badge-allergies {
	background: #ff0000;
	color: #fff;
	padding: 0.08in 0.1in;
	margin: 0.05in 0;
	text-align: center;
	font-size: 12pt;
	font-weight: bold;
	border: 1px solid #000;
}

.kc-allergy-label {
	font-size: 10pt;
	text-transform: uppercase;
	letter-spacing: 0.5pt;
}

.kc-allergy-text {
	font-size: 14pt;
	margin-left: 0.05in;
}

/* Badge footer (code and date) */
.kc-badge-footer {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	margin-top: auto;
}

/* Parent code section */
.kc-badge-code {
	flex: 1;
	text-align: center;
	border: 2px solid #000;
	padding: 0.1in;
	margin-right: 0.1in;
	background: #fff;
}

.kc-code-label {
	font-size: 8pt;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.5pt;
	margin-bottom: 0.05in;
	color: #000;
}

.kc-code-value {
	font-size: 36pt;
	font-weight: bold;
	color: #000;
	line-height: 1;
	font-family: 'Courier New', monospace;
	letter-spacing: 2pt;
}

/* Date/time section */
.kc-badge-date {
	flex: 0 0 auto;
	text-align: right;
	padding: 0.05in;
}

.kc-date-text {
	font-size: 10pt;
	font-weight: bold;
	color: #000;
	margin-bottom: 0.03in;
}

.kc-time-text {
	font-size: 9pt;
	color: #333;
}

/* Print-specific adjustments */
@media print {
	/* Set page size to 4x2 inches */
	@page {
		size: 4in 2in;
		margin: 0;
		padding: 0;
	}

	/* Ensure badge fits on page */
	.kc-checkin-badge {
		width: 4in;
		height: 2in;
		margin: 0;
		padding: 0.15in;
		box-sizing: border-box;
	}

	/* Remove any page margins */
	body {
		margin: 0;
		padding: 0;
	}

	/* Hide all non-essential elements */
	.kc-checkin-badge::before,
	.kc-checkin-badge::after {
		display: none;
	}
}

/* Screen-only styles (for preview) */
@media screen {
	.kc-checkin-badge {
		margin: 20px auto;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	}
}

/* High DPI print adjustments */
@media print and (min-resolution: 300dpi) {
	.kc-badge-name {
		font-size: 26pt;
	}

	.kc-code-value {
		font-size: 34pt;
	}
}

/* Landscape orientation support */
@media print and (orientation: landscape) {
	.kc-checkin-badge {
		width: 4in;
		height: 2in;
	}
}

/* Ensure badge maintains 4x2 size regardless of orientation */
@media print {
	.kc-checkin-badge {
		/* Force 4x2 inch size */
		width: 4in !important;
		height: 2in !important;
		max-width: 4in !important;
		max-height: 2in !important;
	}
}
