/*
 * Certificate verification page.
 *
 * Plain CSS for the same reason as the chat widget and the nav drawer: the
 * theme ships without node_modules, so a rule that needs `npm run build:css`
 * before it renders is a rule that renders broken. The compiled main.css only
 * carries the utilities the templates already used, and this page needs status
 * banners, a spinner and a disabled button state that were never in it — so the
 * component lives here instead, keyed to the tia-cert__* classes in
 * student-certificate-page.php.
 *
 * Colours are the brief's palette, same values tailwind.config.js extends with.
 */

.tia-cert {
	--tia-cert-primary: #4f46e5;
	--tia-cert-primary-dark: #4338ca;
	--tia-cert-ink: #0f172a;
	--tia-cert-muted: #64748b;
	--tia-cert-line: #e9edf3;
	--tia-cert-surface: #fff;
	--tia-cert-sunken: #f8fafc;
	--tia-cert-ok: #15803d;
	--tia-cert-ok-bg: #f0fdf4;
	--tia-cert-ok-line: #bbf7d0;
	--tia-cert-bad: #b91c1c;
	--tia-cert-bad-bg: #fef2f2;
	--tia-cert-bad-line: #fecaca;
	font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.dark .tia-cert {
	--tia-cert-ink: #f1f5f9;
	--tia-cert-muted: #94a3b8;
	--tia-cert-line: #334155;
	--tia-cert-surface: #1e293b;
	--tia-cert-sunken: #0f172a;
	--tia-cert-ok-bg: rgba(21, 128, 61, 0.12);
	--tia-cert-ok-line: rgba(21, 128, 61, 0.35);
	--tia-cert-bad-bg: rgba(185, 28, 28, 0.12);
	--tia-cert-bad-line: rgba(185, 28, 28, 0.35);
}

/* ---------------------------------------------------------------------------
 * Search card
 * ------------------------------------------------------------------------ */

.tia-cert__card {
	padding: 24px;
	border: 1px solid var(--tia-cert-line);
	border-radius: 16px;
	background-color: var(--tia-cert-surface);
	box-shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.4);
}

@media (min-width: 768px) {
	.tia-cert__card {
		padding: 40px;
	}
}

.tia-cert__title {
	margin: 0 0 8px;
	color: var(--tia-cert-ink);
	font-size: 20px;
	font-weight: 800;
	line-height: 1.3;
}

.tia-cert__lede {
	margin: 0 0 24px;
	max-width: 46ch;
	color: var(--tia-cert-muted);
	font-size: 14px;
	line-height: 1.6;
}

.tia-cert__fields {
	display: grid;
	gap: 16px;
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.tia-cert__fields {
		grid-template-columns: 1fr 1fr;
	}
}

.tia-cert__label {
	display: block;
	margin-bottom: 8px;
	color: var(--tia-cert-ink);
	font-size: 13px;
	font-weight: 700;
}

.tia-cert__input {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 0 14px;
	border: 1px solid var(--tia-cert-line);
	border-radius: 10px;
	background-color: var(--tia-cert-sunken);
	color: var(--tia-cert-ink);
	font-family: inherit;
	font-size: 14px;
	/* Codes read wrong in a proportional face; the tracking keeps them scannable. */
	letter-spacing: 0.04em;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.tia-cert__input::placeholder {
	color: var(--tia-cert-muted);
	letter-spacing: normal;
	opacity: 0.7;
}

.tia-cert__input:focus {
	border-color: var(--tia-cert-primary);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
	outline: none;
}

.tia-cert__actions {
	margin-top: 20px;
}

.tia-cert__submit {
	display: inline-flex;
	width: 100%;
	min-height: 48px;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 28px;
	border: 0;
	border-radius: 10px;
	background-color: var(--tia-cert-primary);
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 12px 24px -12px rgba(79, 70, 229, 0.7);
	transition: background-color 0.18s ease;
}

@media (min-width: 640px) {
	.tia-cert__submit {
		width: auto;
	}
}

.tia-cert__submit:hover {
	background-color: var(--tia-cert-primary-dark);
}

.tia-cert__submit:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

/* ---------------------------------------------------------------------------
 * Status banners
 * ------------------------------------------------------------------------ */

.tia-cert__status {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 24px;
	padding: 14px 16px;
	border: 1px solid var(--tia-cert-line);
	border-radius: 12px;
	background-color: var(--tia-cert-sunken);
	color: var(--tia-cert-ink);
	font-size: 14px;
	line-height: 1.5;
}

.tia-cert__status--error {
	border-color: var(--tia-cert-bad-line);
	background-color: var(--tia-cert-bad-bg);
	color: var(--tia-cert-bad);
}

.tia-cert__status-icon {
	flex-shrink: 0;
	font-size: 20px;
	line-height: 1.4;
}

.tia-cert__spinner {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	margin-top: 1px;
	border: 2px solid var(--tia-cert-line);
	border-top-color: var(--tia-cert-primary);
	border-radius: 50%;
	animation: tia-cert-spin 0.7s linear infinite;
}

@keyframes tia-cert-spin {
	to {
		transform: rotate(360deg);
	}
}

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

.tia-cert__result {
	margin-top: 24px;
	overflow: hidden;
	border: 1px solid var(--tia-cert-line);
	border-radius: 16px;
	background-color: var(--tia-cert-surface);
	box-shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.4);
}

.tia-cert__verified {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--tia-cert-ok-line);
	background-color: var(--tia-cert-ok-bg);
	color: var(--tia-cert-ok);
}

.tia-cert__verified-title {
	margin: 0;
	font-size: 14px;
	font-weight: 800;
}

.tia-cert__verified-note {
	margin: 2px 0 0;
	color: var(--tia-cert-muted);
	font-size: 12px;
}

.tia-cert__body {
	padding: 20px;
}

@media (min-width: 768px) {
	.tia-cert__body {
		padding: 28px;
	}
}

.tia-cert__meta {
	display: grid;
	gap: 16px;
	margin: 0;
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.tia-cert__meta {
		grid-template-columns: 1.4fr 1fr 1fr;
	}
}

.tia-cert__meta-label {
	margin: 0 0 4px;
	color: var(--tia-cert-muted);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.tia-cert__meta-value {
	margin: 0;
	color: var(--tia-cert-ink);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	overflow-wrap: anywhere;
}

.tia-cert__scan {
	display: block;
	margin-top: 24px;
	overflow: hidden;
	border: 1px solid var(--tia-cert-line);
	border-radius: 12px;
	background-color: var(--tia-cert-sunken);
}

.tia-cert__scan img {
	display: block;
	width: 100%;
	height: auto;
}

.tia-cert__scan-hint {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 10px;
	color: var(--tia-cert-muted);
	font-size: 12px;
}

.tia-cert__scan-hint .material-symbols-outlined {
	font-size: 16px;
}

/* ---------------------------------------------------------------------------
 * Neighbours
 * ------------------------------------------------------------------------ */

/*
 * main.css declares .hidden before this file, so a component rule here wins on
 * source order and would leave the empty status banner and result card on
 * screen. Two classes outrank one, which settles it without !important.
 */
.tia-cert .hidden {
	display: none;
}

/*
 * The floating review card is decorative and, at desktop widths, lands on top
 * of this form's first field — the page is centred at max-w-4xl while the card
 * is pinned bottom-left. A verification form outranks a testimonial, and this
 * stylesheet only loads on this template, so the card sits this page out.
 */
#floating-review-left {
	display: none;
}

@media (prefers-reduced-motion: reduce) {

	.tia-cert__spinner {
		animation-duration: 4s;
	}

	.tia-cert__input,
	.tia-cert__submit {
		transition: none;
	}
}
