/* Certificate Verification System — public styles
   All selectors are scoped under .cv- to avoid leaking into the theme. */

.cv-wrapper {
	--cv-primary: #026B3A;
	--cv-primary-dark: #014d29;
	--cv-primary-light: #e6f3ec;
	--cv-primary-lighter: #f4faf7;
	--cv-text: #17251f;
	--cv-muted: #5b6b64;
	--cv-border: #e1e8e4;
	--cv-danger: #c0392b;
	--cv-danger-bg: #fdecea;
	--cv-radius: 16px;
	--cv-shadow: 0 10px 30px rgba(2, 107, 58, 0.12), 0 2px 8px rgba(2,107,58,0.06);
	color-scheme: light;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	max-width: 560px;
	margin: 32px auto;
	padding: 0 16px;
	box-sizing: border-box;
}
.cv-wrapper *, .cv-wrapper *::before, .cv-wrapper *::after { box-sizing: border-box; }

.cv-card {
	background: #fff;
	border-radius: var(--cv-radius);
	box-shadow: var(--cv-shadow);
	padding: 40px 32px;
	border: 1px solid var(--cv-border);
	position: relative;
	overflow: hidden;
}
.cv-card::before {
	content: "";
	position: absolute;
	top: 0; left: 0; right: 0;
	height: 6px;
	background: linear-gradient(90deg, var(--cv-primary), var(--cv-primary-dark));
}

.cv-fade-in { animation: cvFadeIn .5s ease both; }
@keyframes cvFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.cv-logo { text-align: center; margin-bottom: 16px; }
.cv-logo img { max-height: 56px; width: auto; }

.cv-title {
	text-align: center;
	font-size: 26px;
	font-weight: 700;
	color: var(--cv-text);
	margin: 0 0 6px;
	letter-spacing: -0.02em;
}
.cv-subtitle {
	text-align: center;
	color: var(--cv-muted);
	font-size: 15px;
	margin: 0 0 28px;
}

.cv-prefill-note {
	background: var(--cv-primary-lighter);
	border: 1px solid var(--cv-primary-light);
	color: var(--cv-primary-dark);
	font-size: 13.5px;
	padding: 10px 14px;
	border-radius: 10px;
	margin-bottom: 20px;
}

.cv-form { display: flex; flex-direction: column; gap: 18px; }

.cv-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--cv-text);
	margin-bottom: 6px;
}

.cv-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
	border: 1.5px solid var(--cv-border) !important;
	border-radius: 12px;
	background: #fafcfb !important;
	transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.cv-input-wrap:focus-within {
	border-color: var(--cv-primary) !important;
	box-shadow: 0 0 0 4px var(--cv-primary-light);
	background: #fff !important;
}
.cv-icon {
	padding: 0 12px;
	font-size: 16px;
	opacity: .65;
}
/* !important below is intentional: many themes (e.g. Astra) apply global
   dark backgrounds / colors to bare <input> elements which otherwise
   override this widget's fields and make the typed text unreadable. */
.cv-wrapper .cv-input-wrap input,
.cv-wrapper input.cv-input,
#cv-verify-form input[type="text"],
#cv-verify-form input[type="tel"] {
	flex: 1;
	border: none !important;
	background: transparent !important;
	outline: none !important;
	box-shadow: none !important;
	padding: 13px 14px 13px 0;
	font-size: 15px;
	color: var(--cv-text) !important;
	-webkit-text-fill-color: var(--cv-text);
	width: 100%;
	min-width: 0;
	height: auto !important;
	line-height: normal;
}
.cv-wrapper .cv-input-wrap input::placeholder {
	color: var(--cv-muted) !important;
	opacity: 1;
}

.cv-submit-btn {
	position: relative;
	background: linear-gradient(135deg, var(--cv-primary), var(--cv-primary-dark));
	color: #fff;
	border: none;
	border-radius: 12px;
	padding: 15px 20px;
	font-size: 15.5px;
	font-weight: 700;
	letter-spacing: .01em;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
	box-shadow: 0 6px 16px rgba(2,107,58,0.28);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}
.cv-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(2,107,58,0.34); }
.cv-submit-btn:active { transform: translateY(0); }
.cv-submit-btn:disabled { opacity: .75; cursor: not-allowed; transform: none; }

.cv-spinner {
	display: none;
	width: 16px; height: 16px;
	border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: cvSpin .7s linear infinite;
}
.cv-submit-btn.cv-loading .cv-spinner { display: inline-block; }
.cv-submit-btn.cv-loading .cv-btn-text { opacity: .85; }
@keyframes cvSpin { to { transform: rotate(360deg); } }

.cv-form-error {
	display: none;
	color: var(--cv-danger);
	background: var(--cv-danger-bg);
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 13.5px;
	margin: 0;
}
.cv-form-error.cv-visible { display: block; animation: cvShake .4s ease; }
@keyframes cvShake {
	10%, 90% { transform: translateX(-1px); }
	20%, 80% { transform: translateX(2px); }
	30%, 50%, 70% { transform: translateX(-4px); }
	40%, 60% { transform: translateX(4px); }
}

.cv-form.cv-shake { animation: cvShake .4s ease; }

/* ---------------- Verifying animation ---------------- */
.cv-verifying {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 36px 20px;
	animation: cvFadeIn .35s ease both;
}
.cv-verifying-icon {
	position: relative;
	width: 64px; height: 64px;
	border-radius: 18px;
	background: var(--cv-primary-lighter);
	border: 1.5px solid var(--cv-primary-light);
	display: flex; align-items: center; justify-content: center;
	overflow: hidden;
	margin-bottom: 16px;
	animation: cvVerifyPulse 1.4s ease-in-out infinite;
}
.cv-verifying-doc { font-size: 28px; line-height: 1; }
.cv-verifying-scanline {
	position: absolute;
	left: 6px; right: 6px;
	height: 2px;
	border-radius: 2px;
	background: linear-gradient(90deg, transparent, var(--cv-primary), transparent);
	box-shadow: 0 0 8px 1px var(--cv-primary);
	animation: cvScan 1.4s ease-in-out infinite;
}
@keyframes cvScan {
	0%   { top: 8px; opacity: 0; }
	15%  { opacity: 1; }
	85%  { opacity: 1; }
	100% { top: 56px; opacity: 0; }
}
@keyframes cvVerifyPulse {
	0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--cv-primary-light); }
	50%      { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(2,107,58,0); }
}
.cv-verifying-text {
	margin: 0;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--cv-primary-dark);
	letter-spacing: .01em;
}

/* ---------------- Certificate preview (inline) ---------------- */
.cv-cert-preview-wrap {
	margin: 4px 0 18px;
	border-radius: 12px;
	overflow: hidden;
	border: 1.5px solid var(--cv-primary-light);
	box-shadow: 0 8px 22px rgba(2,107,58,0.14);
	animation: cvSlideIn .5s ease .1s both;
}
.cv-cert-preview {
	display: block;
	width: 100%;
	height: auto;
	max-height: 360px;
	object-fit: contain;
	background: #fff;
	cursor: zoom-in;
	transition: transform .2s ease;
}
.cv-cert-preview:hover { transform: scale(1.015); }

.cv-verified-pop { animation: cvSlideIn .45s ease both; }

/* ---------------- Result card ---------------- */
.cv-result { margin-top: 24px; }
.cv-result[hidden] { display: none; }

.cv-result-success, .cv-result-error {
	border-radius: 14px;
	padding: 24px;
	animation: cvSlideIn .45s ease both;
}
@keyframes cvSlideIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.cv-result-success {
	background: var(--cv-primary-lighter);
	border: 1px solid var(--cv-primary-light);
}
.cv-result-error {
	background: var(--cv-danger-bg);
	border: 1px solid #f3c8c3;
	text-align: center;
}

.cv-badge {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	font-size: 17px;
	color: var(--cv-primary-dark);
	margin-bottom: 18px;
}
.cv-badge .cv-check {
	width: 30px; height: 30px;
	border-radius: 50%;
	background: var(--cv-primary);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-size: 16px;
	flex-shrink: 0;
	animation: cvPop .4s ease .1s both;
}
@keyframes cvPop { 0% { transform: scale(0); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.cv-error-icon {
	width: 46px; height: 46px;
	margin: 0 auto 12px;
	border-radius: 50%;
	background: #f3c8c3;
	color: var(--cv-danger);
	display: flex; align-items: center; justify-content: center;
	font-size: 22px;
}
.cv-result-error h3 { margin: 0 0 8px; color: #7d221a; font-size: 17px; }
.cv-result-error p { margin: 0; color: #8a3a32; font-size: 14px; line-height: 1.5; }

.cv-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.cv-detail-item { background: #fff; border: 1px solid var(--cv-primary-light); border-radius: 10px; padding: 10px 14px; }
.cv-detail-item .cv-detail-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--cv-muted); margin-bottom: 3px; }
.cv-detail-item .cv-detail-value { display: block; font-size: 14.5px; font-weight: 600; color: var(--cv-text); word-break: break-word; }
.cv-detail-item.cv-full { grid-column: 1 / -1; }

.cv-status-tag {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	text-transform: capitalize;
}
.cv-status-verified { background: #d7f3e3; color: #0b5c31; }
.cv-status-pending { background: #fff3cd; color: #8a6300; }
.cv-status-expired { background: #ffe2cc; color: #9c4a06; }
.cv-status-revoked { background: #f8d7da; color: #842029; }

.cv-result-message { margin: 16px 0 0; font-size: 13.5px; color: var(--cv-muted); line-height: 1.5; }

.cv-result-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.cv-btn-outline {
	flex: 1;
	min-width: 140px;
	text-align: center;
	border: 1.5px solid var(--cv-primary);
	color: var(--cv-primary-dark);
	background: #fff;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 13.5px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: background-color .15s ease, transform .15s ease;
}
.cv-btn-outline:hover { background: var(--cv-primary-light); transform: translateY(-1px); }

/* ---------------- Modal ---------------- */
.cv-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; }
.cv-modal[hidden] { display: none; }
.cv-modal-backdrop { position: absolute; inset: 0; background: rgba(10,20,15,.6); animation: cvFadeIn .2s ease; }
.cv-modal-content {
	position: relative;
	background: #fff;
	border-radius: 14px;
	max-width: 92vw;
	max-height: 88vh;
	width: 720px;
	overflow: hidden;
	box-shadow: 0 20px 50px rgba(0,0,0,.35);
	animation: cvSlideIn .25s ease;
}
.cv-modal-body { max-height: 88vh; overflow: auto; display: flex; }
.cv-modal-body img, .cv-modal-body iframe { width: 100%; height: 80vh; border: none; display: block; }
/* !important guards below: theme button resets (padding, min-width,
   line-height, border-radius) otherwise squish this into an oval instead
   of a clean circular close button. */
.cv-modal-close {
	position: absolute !important;
	top: 10px !important;
	right: 10px !important;
	left: auto !important;
	bottom: auto !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-sizing: border-box !important;
	width: 34px !important;
	height: 34px !important;
	min-width: 34px !important;
	max-width: 34px !important;
	padding: 0 !important;
	margin: 0 !important;
	border-radius: 50% !important;
	border: none !important;
	background: rgba(0,0,0,.6) !important;
	color: #fff !important;
	font-size: 20px !important;
	line-height: 1 !important;
	cursor: pointer;
	z-index: 5;
}
.cv-modal-close:hover { background: rgba(0,0,0,.8) !important; }

/* ---------------- Responsive ---------------- */
@media (max-width: 480px) {
	.cv-card { padding: 28px 20px; }
	.cv-title { font-size: 21px; }
	.cv-detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	.cv-wrapper *, .cv-wrapper *::before, .cv-wrapper *::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
	}
}
