/* ==========================================================================
   GITT Student Verification System — Frontend Styles
   Professional institute theme, glassmorphism cards, pure CSS, responsive.
   ========================================================================== */

.gitt-sv-frontend-wrap * {
	box-sizing: border-box;
}

.gitt-sv-frontend-wrap {
	--gitt-primary: #1E40AF;
	--gitt-secondary: #2563EB;
	--gitt-success: #16A34A;
	--gitt-danger: #DC2626;
	--gitt-bg: #F8FAFC;
	--gitt-text: #0F172A;
	--gitt-text-muted: #64748B;
	--gitt-border: #E2E8F0;

	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
	width: 100%;
	padding: 56px 16px;
	display: flex;
	justify-content: center;
	background: var(--gitt-bg);
	border-radius: 16px;
}

.gitt-sv-search-panel {
	width: 100%;
	max-width: 640px;
	padding: 44px 40px;
	border-radius: 24px;
	background: #ffffff;
	border: 1px solid var(--gitt-border);
	box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
	text-align: center;
}

.gitt-sv-title {
	margin: 0 0 10px;
	font-size: 32px;
	font-weight: 700;
	color: var(--gitt-text);
	letter-spacing: -0.5px;
}

.gitt-sv-subtitle {
	margin: 0 0 32px;
	font-size: 15.5px;
	font-weight: 400;
	color: var(--gitt-text-muted);
}

/* Search box */
.gitt-sv-search-box {
	margin-bottom: 8px;
}

.gitt-sv-input-group {
	display: flex;
	gap: 10px;
	background: var(--gitt-bg);
	border: 2px solid var(--gitt-border);
	border-radius: 16px;
	padding: 8px;
	transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.gitt-sv-input-group:focus-within {
	border-color: var(--gitt-secondary);
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

#gitt-sv-enrollment-input {
	flex: 1;
	border: none;
	background: transparent;
	outline: none;
	padding: 16px 18px;
	font-size: 16px;
	font-family: inherit;
	color: var(--gitt-text);
}

#gitt-sv-enrollment-input::placeholder {
	color: #94A3B8;
}

.gitt-sv-verify-btn {
	position: relative;
	border: none;
	cursor: pointer;
	padding: 0 30px;
	border-radius: 12px;
	font-family: inherit;
	font-weight: 600;
	font-size: 15px;
	letter-spacing: 0.2px;
	color: #ffffff;
	background: linear-gradient(135deg, var(--gitt-secondary), var(--gitt-primary));
	box-shadow: 0 6px 18px rgba(30, 64, 175, 0.3);
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 170px;
	white-space: nowrap;
}

.gitt-sv-verify-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(30, 64, 175, 0.4);
}

.gitt-sv-verify-btn:active {
	transform: translateY(0);
}

.gitt-sv-verify-btn:disabled {
	cursor: not-allowed;
	opacity: 0.85;
}

.gitt-sv-search-icon {
	flex-shrink: 0;
}

.gitt-sv-verify-btn.is-loading .gitt-sv-btn-text,
.gitt-sv-verify-btn.is-loading .gitt-sv-search-icon {
	visibility: hidden;
}

.gitt-sv-verify-btn.is-loading .gitt-sv-spinner {
	display: inline-block;
}

.gitt-sv-spinner {
	display: none;
	position: absolute;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: gitt-sv-spin 0.7s linear infinite;
}

@keyframes gitt-sv-spin {
	to {
		transform: rotate(360deg);
	}
}

.gitt-sv-error-msg {
	margin: 14px 2px 0;
	font-size: 13.5px;
	color: var(--gitt-danger);
	text-align: left;
	min-height: 16px;
	font-weight: 500;
}

/* Result area */
.gitt-sv-result {
	margin-top: 30px;
	text-align: left;
}

.gitt-sv-not-found {
	padding: 26px;
	text-align: center;
	border-radius: 16px;
	background: #FEF2F2;
	border: 1px solid #FECACA;
	color: var(--gitt-danger);
	font-weight: 500;
	animation: gitt-sv-fade-in 0.35s ease;
}

/* ==========================================================================
   Certificate — official verification document styling
   ========================================================================== */

.gitt-certificate-wrap {
	position: relative;
	animation: gitt-sv-fade-in 0.45s ease;
}

.gitt-profile-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 0 0 14px;
	flex-wrap: wrap;
}

.gitt-action-btn {
	border: 1px solid var(--gitt-border);
	background: #ffffff;
	color: var(--gitt-primary);
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.gitt-action-btn:hover {
	background: var(--gitt-primary);
	color: #ffffff;
	transform: translateY(-1px);
}

.gitt-action-btn.is-copied {
	background: var(--gitt-success);
	border-color: var(--gitt-success);
	color: #ffffff;
}

.gitt-certificate {
	position: relative;
	overflow: hidden;
	border-radius: 20px;
	background: #ffffff;
	border: 2px solid var(--gitt-primary);
	box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
	transition: box-shadow 0.25s ease;
}

.gitt-certificate:hover {
	box-shadow: 0 24px 55px rgba(15, 23, 42, 0.18);
}

/* Subtle blue corner accents for a premium document feel */
.gitt-certificate::before,
.gitt-certificate::after {
	content: '';
	position: absolute;
	width: 90px;
	height: 90px;
	border: 3px solid rgba(37, 99, 235, 0.18);
	z-index: 0;
	pointer-events: none;
}

.gitt-certificate::before {
	top: -3px;
	left: -3px;
	border-right: none;
	border-bottom: none;
	border-radius: 20px 0 0 0;
}

.gitt-certificate::after {
	bottom: -3px;
	right: -3px;
	border-left: none;
	border-top: none;
	border-radius: 0 0 20px 0;
}

.gitt-certificate-watermark {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 62%;
	max-width: 380px;
	aspect-ratio: 300 / 118;
	transform: translate(-50%, -50%);
	background-image: url('../images/gitt-logo.png');
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	opacity: 0.06;
	z-index: 0;
	pointer-events: none;
}

.gitt-certificate-inner {
	position: relative;
	z-index: 1;
	padding: 36px 34px 30px;
}

/* Header: logo + institute name + title */
.gitt-certificate-header {
	text-align: center;
	padding-bottom: 22px;
}

.gitt-certificate-logo {
	height: 56px;
	width: auto;
	max-width: 220px;
	object-fit: contain;
	margin: 0 auto 10px;
	display: block;
}

.gitt-institute-name {
	margin: 0 0 14px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 1.6px;
	color: var(--gitt-primary);
	text-transform: uppercase;
}

.gitt-header-divider {
	width: 90px;
	height: 3px;
	margin: 0 auto 16px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--gitt-secondary), var(--gitt-primary));
}

.gitt-certificate-title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: 0.6px;
	color: var(--gitt-text);
	text-transform: uppercase;
}

/* Student photo + name + badge */
.gitt-certificate-photo-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 6px 0 26px;
}

.gitt-certificate-photo {
	width: 108px;
	height: 108px;
	border-radius: 50%;
	object-fit: cover;
	border: 4px solid var(--gitt-bg);
	outline: 2px solid var(--gitt-primary);
	box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
	margin-bottom: 14px;
}

.gitt-certificate-name {
	margin: 0 0 10px;
	font-size: 21px;
	font-weight: 600;
	color: var(--gitt-text);
	text-align: center;
}

.gitt-badge {
	display: inline-block;
	padding: 5px 18px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.3px;
	text-transform: uppercase;
}

.gitt-badge-active {
	background: rgba(22, 163, 74, 0.12);
	color: var(--gitt-success);
	border: 1px solid rgba(22, 163, 74, 0.35);
}

.gitt-badge-inactive {
	background: rgba(220, 38, 38, 0.12);
	color: var(--gitt-danger);
	border: 1px solid rgba(220, 38, 38, 0.35);
}

/* Two-column detail grid */
.gitt-certificate-body {
	padding: 24px 22px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px 28px;
	background: var(--gitt-bg);
	border: 1px solid var(--gitt-border);
	border-radius: 14px;
}

.gitt-cert-row {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.gitt-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--gitt-text-muted);
	font-weight: 600;
}

.gitt-value {
	font-size: 15px;
	color: var(--gitt-text);
	font-weight: 600;
	word-break: break-word;
}

/* Certification statement */
.gitt-certificate-statement {
	margin: 26px 4px 4px;
	padding: 18px 20px;
	border-left: 4px solid var(--gitt-secondary);
	background: rgba(37, 99, 235, 0.05);
	border-radius: 0 10px 10px 0;
	font-size: 13.5px;
	line-height: 1.7;
	font-style: italic;
	color: var(--gitt-text-muted);
	text-align: left;
}

/* Footer */
.gitt-certificate-footer {
	margin-top: 28px;
}

.gitt-footer-divider {
	height: 1px;
	background: var(--gitt-border);
	margin-bottom: 18px;
}

.gitt-footer-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px;
	text-align: center;
}

.gitt-footer-item {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.gitt-footer-label {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 700;
	color: var(--gitt-text-muted);
}

.gitt-footer-value {
	font-size: 13px;
	font-weight: 600;
	color: var(--gitt-primary);
	text-decoration: none;
	word-break: break-word;
}

.gitt-footer-value:hover {
	text-decoration: underline;
}

@keyframes gitt-sv-fade-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Responsive (screen only — must never affect print, see @media print below) */
@media screen and (max-width: 640px) {
	.gitt-sv-frontend-wrap {
		padding: 32px 10px;
	}

	.gitt-sv-search-panel {
		padding: 30px 20px;
	}

	.gitt-sv-title {
		font-size: 25px;
	}

	.gitt-sv-input-group {
		flex-direction: column;
		background: transparent;
		border: none;
		padding: 0;
		gap: 10px;
	}

	#gitt-sv-enrollment-input {
		background: var(--gitt-bg);
		border: 2px solid var(--gitt-border);
		border-radius: 12px;
	}

	.gitt-sv-verify-btn {
		width: 100%;
		padding: 15px 0;
	}

	.gitt-profile-actions {
		justify-content: center;
	}

	.gitt-certificate-inner {
		padding: 26px 18px 22px;
	}

	.gitt-certificate-title {
		font-size: 18px;
	}

	.gitt-certificate-body {
		grid-template-columns: 1fr;
		padding: 18px 16px;
	}

	.gitt-footer-grid {
		grid-template-columns: 1fr;
		text-align: center;
	}
}

@media screen and (min-width: 641px) and (max-width: 900px) {
	.gitt-sv-search-panel {
		max-width: 92%;
	}
}

/* ==========================================================================
   Print / "Download as PDF" — dedicated print stylesheet.
   Goal: the certificate always fits a single A4 page on desktop, tablet,
   and mobile, with the desktop (two-column) layout forced regardless of
   the device's screen width, and nothing else on the page is printed.
   ========================================================================== */
@media print {
	@page {
		size: A4 portrait;
		margin: 10mm;
	}

	html, body {
		width: 100%;
		height: auto;
		margin: 0 !important;
		padding: 0 !important;
		background: #ffffff;
		overflow: visible;
		/* Establishing the containing block on body itself (rather than a
		   nested wrapper further down the DOM) means the certificate's
		   position:absolute below anchors to the true top-left of the
		   page, regardless of how much theme/page content (header, nav,
		   widgets, floating buttons, etc.) sits before it in the
		   document. Anchoring to a nested wrapper instead left a large
		   blank gap above the certificate equal to whatever invisible
		   content came before it in normal flow. */
		position: relative !important;
	}

	/* visibility:hidden (not display:none) — visibility is inherited but
	   can be overridden by a descendant, so nothing needs to be
	   "restored" element-by-element the way display requires. (A
	   previous version of this stylesheet used display:none here, which
	   is why the certificate stopped printing entirely: display:none on
	   an ANCESTOR suppresses its whole subtree and cannot be undone by a
	   descendant's own display value — and worse, display:contents
	   combined with a position:absolute descendant is unreliable across
	   Chrome versions. visibility avoids both problems entirely.) */
	body * {
		visibility: hidden;
	}

	#gitt-sv-printable-card,
	#gitt-sv-printable-card * {
		visibility: visible;
	}

	/* visibility:hidden keeps every hidden element's height reserved in
	   the page's normal flow — that reserved (invisible) height is what
	   was still spilling a blank second page even though the *visible*
	   certificate fit comfortably on page 1. This rule removes that
	   height entirely by giving display:none to anything that is NOT
	   part of the certificate's own ancestor chain and is NOT the
	   certificate itself — so page/theme content elsewhere (header,
	   nav, footer, widgets, etc.) contributes zero height, while the
	   handful of wrapper elements that are actual ancestors of the
	   certificate are deliberately left alone (display:none on an
	   ancestor would suppress the certificate nested inside it). */
	body *:not(:has(#gitt-sv-printable-card)):not(#gitt-sv-printable-card):not(#gitt-sv-printable-card *) {
		display: none !important;
	}

	/* Neutralize our own wrapper chain's box dimensions (still present
	   in the invisible flow, just with no visible size) so they cannot
	   contribute extra height/width that might push a second page or
	   narrow the certificate's available width. */
	.gitt-sv-frontend-wrap,
	.gitt-sv-search-panel,
	.gitt-sv-result {
		width: 100% !important;
		max-width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		padding: 0 !important;
		margin: 0 !important;
		border: none !important;
		box-shadow: none !important;
		background: transparent !important;
	}

	#gitt-sv-printable-card {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		margin: 0;
		page-break-after: avoid;
		break-after: avoid;
	}

	.gitt-sv-no-print {
		display: none !important;
	}

	/* Some themes/browsers inject a print stylesheet rule like
	   a[href]::after { content: " (" attr(href) ")"; } which appends the
	   raw URL after every link. Neutralize that specifically for the
	   certificate's footer links so only the visible label text prints —
	   no HTML changes needed. */
	#gitt-sv-printable-card a[href]::after,
	#gitt-sv-printable-card a[href]::before,
	#gitt-sv-printable-card .gitt-footer-value::after,
	#gitt-sv-printable-card .gitt-footer-value::before {
		content: '' !important;
		content: none !important;
	}

	/* Force the desktop two-column detail layout on every device — the
	   screen-only mobile breakpoint above never applies here. */
	.gitt-certificate {
		width: 100%;
		max-width: 100%;
		margin: 0 auto;
		box-shadow: none;
		border: 2px solid var(--gitt-primary);
		page-break-inside: avoid;
		break-inside: avoid;
		page-break-after: avoid;
		break-after: avoid;
	}

	.gitt-certificate::before,
	.gitt-certificate::after {
		display: none;
	}

	.gitt-certificate-watermark {
		opacity: 0.05;
	}

	.gitt-certificate-inner {
		padding: 14px 20px 12px;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.gitt-certificate-header {
		padding-bottom: 8px;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.gitt-certificate-logo {
		height: 34px;
		margin-bottom: 5px;
	}

	.gitt-institute-name {
		font-size: 10.5px;
		margin-bottom: 6px;
	}

	.gitt-header-divider {
		margin-bottom: 8px;
	}

	.gitt-certificate-title {
		font-size: 16px;
	}

	.gitt-certificate-photo-block {
		padding: 2px 0 12px;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.gitt-certificate-photo {
		width: 64px;
		height: 64px;
		margin-bottom: 6px;
	}

	.gitt-certificate-name {
		font-size: 15px;
		margin-bottom: 5px;
	}

	.gitt-badge {
		padding: 3px 12px;
		font-size: 9.5px;
	}

	/* Always two columns on print, regardless of device width. */
	.gitt-certificate-body {
		grid-template-columns: 1fr 1fr;
		gap: 8px 20px;
		padding: 12px 14px;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.gitt-label {
		font-size: 8.5px;
	}

	.gitt-value {
		font-size: 12px;
	}

	.gitt-certificate-statement {
		margin: 12px 2px 2px;
		padding: 8px 12px;
		font-size: 10.5px;
		line-height: 1.45;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.gitt-certificate-footer {
		margin-top: 12px;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.gitt-footer-divider {
		margin-bottom: 8px;
	}

	/* Always three columns on print, regardless of device width. */
	.gitt-footer-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 6px;
	}

	.gitt-footer-label {
		font-size: 8.5px;
	}

	.gitt-footer-value {
		font-size: 10.5px;
	}
}
