/**
 * FormaPay — front-end styles.
 *
 * Century Gothic, #0072b0 accent, white cards on an 8px radius with #e0e0e0
 * borders, 40px controls, uppercase field labels. Override the design tokens
 * below in the theme to restyle the page.
 */

/* Design tokens live at the document root, not on .formapay: the full-screen
   loading overlay is attached to <body> (outside the app container) and must
   still resolve these colours. */
:root {
	--formapay-ink: #333;
	--formapay-body: #444;
	--formapay-muted: #888;
	--formapay-label: #555;
	--formapay-faint: #999;
	--formapay-line: #e0e0e0;
	--formapay-hair: #eee;
	--formapay-field: #ccc;
	--formapay-well: #f8f9fa;
	--formapay-accent: #0072b0;
	--formapay-accent-dark: #005a8c;
	--formapay-ok: #16a34a;
	--formapay-err: #dc2626;
}

.formapay {
	max-width: 670px;
	margin: 0 auto;
	padding: 30px 15px 60px;
	color: var(--formapay-body);
	font-family: "CENTURY GOTHIC", "AppleGothic", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	box-sizing: border-box;
}

.formapay *,
.formapay *::before,
.formapay *::after { box-sizing: border-box; }

@media (max-width: 700px) {
	.formapay { max-width: 92%; }
}

/* ------------------------------------------------------------------
   Cards and headings
   ------------------------------------------------------------------ */

.formapay-card {
	background: #fff;
	border: 1px solid var(--formapay-line);
	border-radius: 8px;
	padding: 24px;
	margin-bottom: 24px;
}

/* The lookup step is the page's entry point; the live page gives that one
   a tinted well to separate it from the panels that appear after it. */
#formapay-step-lookup { background: var(--formapay-well); }

.formapay-step-title {
	display: block;
	font-size: 18px;
	font-weight: 600;
	color: var(--formapay-ink);
	margin: 0 0 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--formapay-hair);
	line-height: 1.3;
}

/* The live page numbers nothing — its sections are named, not counted. The
   badge stays in the markup (the template is fixed) but is taken out of the
   visual language. */
.formapay-step-num { display: none; }

.formapay-help {
	font-size: 12px;
	color: var(--formapay-faint);
	margin: 0 0 16px;
}

.formapay-center { text-align: center; }

/* ------------------------------------------------------------------
   Fields
   ------------------------------------------------------------------ */

.formapay-field { margin-bottom: 16px; }

.formapay-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--formapay-label);
	margin-bottom: 4px;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.formapay-field input,
.formapay-field select {
	width: 100%;
	border: 1px solid var(--formapay-field);
	border-radius: 6px;
	font-size: 14px;
	background: #fff;
	color: var(--formapay-ink);
	transition: border-color 0.2s;
	font-family: inherit;
}

.formapay-field input {
	height: 40px;
	padding: 0 12px;
	line-height: 40px;
}

.formapay-field select {
	height: auto;
	min-height: 40px;
	padding: 0 12px;
	line-height: normal;
	appearance: auto;
	-webkit-appearance: menulist;
}

.formapay-field input:focus,
.formapay-field select:focus {
	outline: none;
	border-color: var(--formapay-accent);
	box-shadow: 0 0 0 2px rgba(0, 114, 176, 0.15);
}

.formapay-field input[readonly] { background: #f5f5f5; color: #666; }

.formapay-field .formapay-help { font-size: 11px; margin: 3px 0 0; }

/* Validation state. */
.formapay-field input.formapay-invalid,
.formapay-field select.formapay-invalid {
	border-color: var(--formapay-err);
	box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.formapay-invalid-group {
	outline: 2px solid var(--formapay-err);
	outline-offset: 4px;
	border-radius: 6px;
}

/* Layout helpers. */
.formapay-row { display: flex; gap: 12px; align-items: flex-end; }
.formapay-row .formapay-grow { flex: 1; }
.formapay-row .formapay-btn { flex: 0 0 auto; margin-bottom: 16px; }

.formapay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.formapay-span2 { grid-column: 1 / -1; }

@media (max-width: 600px) {
	.formapay-row { flex-direction: column; align-items: stretch; }
	.formapay-row .formapay-btn { width: 100%; }
	.formapay-grid { grid-template-columns: 1fr; }
}

/* Checkbox row ("same as billing", additional e-mails). */
.formapay-check {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 16px 0 12px;
	font-size: 14px;
	color: var(--formapay-label);
	cursor: pointer;
}

.formapay-check input { width: auto; height: auto; margin: 0; }

/* Honeypot — never visible, never in the tab order. */
.formapay-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

/* ------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */

.formapay-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding: 0 24px;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.2s;
	background: var(--formapay-accent);
	color: #fff;
}

.formapay-btn:hover:not(:disabled) { background: var(--formapay-accent-dark); }
.formapay-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.formapay-btn:focus-visible {
	outline: 2px solid var(--formapay-accent);
	outline-offset: 2px;
}

.formapay-btn-pay {
	width: 100%;
	height: 48px;
	font-size: 16px;
	margin-top: 8px;
}

.formapay-btn.is-busy { cursor: wait; }

/* ------------------------------------------------------------------
   Order summary
   ------------------------------------------------------------------ */

.formapay-summary:not(.formapay-breakdown) {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px 24px;
	margin: 0 0 20px;
}

.formapay-summary:not(.formapay-breakdown) > div { display: block; min-width: 0; }

.formapay-summary:not(.formapay-breakdown) dt {
	display: block;
	font-size: 11px;
	font-weight: 600;
	color: var(--formapay-faint);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin: 0 0 2px;
}

.formapay-summary:not(.formapay-breakdown) dd {
	margin: 0;
	font-size: 15px;
	color: var(--formapay-ink);
	overflow-wrap: break-word;
}

/* Grand Total in the breakdown carries this figure; showing it twice was
   the source of the duplicate-total complaint. */
.formapay-summary .formapay-summary-total { display: none; }

@media (max-width: 600px) {
	.formapay-summary:not(.formapay-breakdown) { grid-template-columns: 1fr; }
}

/* Currency / weight strip, injected by renderMetaStrip(). */
.formapay-meta-strip {
	display: flex;
	gap: 32px;
	margin: 0 0 16px;
	padding: 12px 0;
	border-top: 1px solid var(--formapay-hair);
	border-bottom: 1px solid var(--formapay-hair);
	font-size: 13px;
}

.formapay-meta-pair {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
}

.formapay-meta-label { color: var(--formapay-faint); }

.formapay-meta-value {
	color: var(--formapay-label);
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
	.formapay-meta-strip { flex-direction: column; gap: 6px; }
}

/* ------------------------------------------------------------------
   Financial breakdown — the live page's .ps-totals treatment
   ------------------------------------------------------------------ */

.formapay-breakdown { margin-top: 16px; }

.formapay-bd-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	padding: 6px 0;
	font-size: 14px;
	color: var(--formapay-label);
}

.formapay-bd-row dt { margin: 0; }

.formapay-bd-row dd {
	margin: 0;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.formapay-bd-row.formapay-bd-muted dt,
.formapay-bd-row.formapay-bd-muted dd { color: var(--formapay-faint); }

.formapay-bd-row.formapay-bd-strong dt,
.formapay-bd-row.formapay-bd-strong dd { font-weight: 700; color: var(--formapay-ink); }

.formapay-bd-row.formapay-bd-subtotal {
	border-top: 1px solid var(--formapay-hair);
	margin-top: 6px;
	padding-top: 12px;
}

/* Grand total: the live page's 2px dark rule and 18px bold figure. */
.formapay-bd-row.formapay-bd-grand {
	border-top: 2px solid var(--formapay-ink);
	margin-top: 8px;
	padding-top: 12px;
	font-size: 18px;
	font-weight: 700;
	color: var(--formapay-ink);
}

.formapay-bd-row.formapay-bd-grand dt,
.formapay-bd-row.formapay-bd-grand dd { font-weight: 700; }

/* Separator drawn on the row: on dt/dd the flex gap cuts it in half. */
.formapay-bd-row.formapay-bd-rule {
	display: block;
	border-top: 1px solid var(--formapay-hair);
	margin: 8px 0 4px;
	padding: 0;
	height: 0;
	overflow: hidden;
}

.formapay-bd-row.formapay-bd-rule dt,
.formapay-bd-row.formapay-bd-rule dd { display: none; }

.formapay-bd-leader {
	flex: 1 1 auto;
	align-self: flex-end;
	min-width: 24px;
	margin: 0 4px 5px;
	border-bottom: 2px dotted #d8d8d8;
}

.formapay-fee-note {
	font-size: 11px;
	color: var(--formapay-faint);
	margin: 6px 0 0;
}

.formapay-doc-status { margin-top: 8px; }

/* Line items. */
.formapay-lines-toggle { margin-top: 16px; font-size: 13px; }

.formapay-lines-toggle summary {
	cursor: pointer;
	color: var(--formapay-accent);
	font-weight: 600;
}

.formapay-lines {
	width: 100%;
	border-collapse: collapse;
	margin-top: 12px;
	font-size: 13px;
}

.formapay-lines th {
	text-align: left;
	font-size: 11px;
	font-weight: 600;
	color: var(--formapay-faint);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 0 8px 6px 0;
	border-bottom: 1px solid var(--formapay-hair);
}

.formapay-lines td {
	padding: 8px 8px 8px 0;
	border-bottom: 1px solid #f4f4f4;
	vertical-align: top;
	color: var(--formapay-body);
}

.formapay-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------------
   Payment method tabs
   ------------------------------------------------------------------ */

.formapay-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.formapay-tab {
	flex: 1;
	min-width: 130px;
	padding: 12px;
	border: 1px solid var(--formapay-field);
	background: var(--formapay-well);
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	color: var(--formapay-label);
	cursor: pointer;
	transition: all 0.15s;
}

.formapay-tab:hover { border-color: var(--formapay-accent); }

.formapay-tab[aria-selected="true"],
.formapay-tab.is-active {
	background: var(--formapay-accent);
	color: #fff;
	border-color: var(--formapay-accent);
}

.formapay-pane {
	background: #fafafa;
	border: 1px solid var(--formapay-hair);
	border-radius: 6px;
	padding: 16px;
}

.formapay-secure-note {
	font-size: 12px;
	color: #777;
	margin: 0 0 12px;
}

.formapay-captcha { margin: 16px 0 0; }

/* ------------------------------------------------------------------
   PayTrace Protect.js hosted fields
   ------------------------------------------------------------------
   The library always sets the iframe to width:100%;height:100% and never
   sizes it to its content — the host page must. Colour and type only:
   over-styling the inner fields pushes content past the iframe and produces
   scrollbars inside the card box.
   ------------------------------------------------------------------ */

#pt_hpf_form { min-height: 185px; }

/* Dimmed while the hosted fields are still initialising. */
#pt_hpf_form.is-loading { opacity: 0.35; }

#pt_hpf_form iframe {
	width: 100%;
	height: 205px !important;
	border: 0;
	display: block;
}

@media (max-width: 480px) {
	#pt_hpf_form iframe { height: 285px !important; }
}

.formapay-card-name-field { margin-bottom: 16px; }

/* ------------------------------------------------------------------
   Alerts, failures, success
   ------------------------------------------------------------------ */

.formapay-alert {
	padding: 12px 16px;
	border-radius: 6px;
	font-size: 14px;
	margin-top: 12px;
}

.formapay-alert-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: var(--formapay-err);
}

.formapay-fail-reason { font-weight: 600; margin-bottom: 4px; }
.formapay-fail-action { margin-bottom: 6px; }

.formapay-fail-meta {
	font-size: 12px;
	opacity: 0.85;
	font-variant-numeric: tabular-nums;
}

.formapay-success {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: var(--formapay-ok);
	text-align: center;
	padding: 32px 24px;
}

.formapay-success h2 {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 700;
	color: var(--formapay-ok);
	border: none;
	padding: 0;
}

.formapay-success p { color: #15803d; margin: 0 0 6px; }

.formapay-success-icon {
	width: 52px;
	height: 52px;
	margin: 0 auto 12px;
	border-radius: 50%;
	background: var(--formapay-ok);
	color: #fff;
	font-size: 28px;
	line-height: 52px;
	text-align: center;
}

/* ------------------------------------------------------------------
   Progress: inline spinner, stage line, full-page loader
   ------------------------------------------------------------------ */

.formapay-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: formapay-spin 0.6s linear infinite;
	margin-right: 8px;
	vertical-align: middle;
}

.formapay-spinner-sm { width: 14px; height: 14px; border-width: 2px; }

.formapay-lookup-status {
	font-size: 12px;
	color: var(--formapay-faint);
	margin: 8px 0 0;
}

.formapay-stage {
	font-size: 13px;
	color: var(--formapay-label);
	text-align: center;
	margin: 12px 0 0;
}

.formapay-loading { opacity: 0.6; pointer-events: none; }
.formapay-busy { cursor: wait; }

/* Full-screen cover. Hidden until pageLoader() adds .is-visible; without the
   default display:none the overlay appears the moment it is created and never
   goes away, because pageLoaderOff() only removes the class. */
.formapay-page-loader {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(255, 255, 255, 0.82);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	z-index: 99999;
}

.formapay-page-loader.is-visible { display: block; }

/* The message sits on a panel rather than floating on the blur: a card with a
   moving spinner reads as "working on it", where centred text alone reads as a
   page that has stalled. */
.formapay-page-loader-inner {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	text-align: center;
	width: 320px;
	max-width: calc(100vw - 48px);
	padding: 32px 28px 28px;
	background: #fff;
	border: 1px solid var(--formapay-line);
	border-radius: 10px;
	box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12);
	animation: formapay-pop 0.18s ease-out;
}

/* Two counter-rotating arcs: unmistakably in motion even at a glance, and it
   still reads as one object rather than a novelty. */
.formapay-loader-ring {
	position: relative;
	width: 54px;
	height: 54px;
	margin: 0 auto 18px;
	border: 4px solid #e3e8ec;
	border-top-color: var(--formapay-accent);
	border-radius: 50%;
	animation: formapay-spin 0.75s linear infinite;
}

.formapay-loader-ring::after {
	content: "";
	position: absolute;
	inset: 6px;
	border: 3px solid transparent;
	border-bottom-color: rgba(0, 114, 176, 0.35);
	border-radius: 50%;
	animation: formapay-spin 1.1s linear infinite reverse;
}

.formapay-loader-text {
	font-size: 15px;
	font-weight: 600;
	color: var(--formapay-ink);
	line-height: 1.35;
}

.formapay-loader-sub {
	font-size: 12.5px;
	color: var(--formapay-muted);
	margin-top: 6px;
	line-height: 1.45;
}

/* Travelling bar under the message — progress the customer can watch even
   when the wait is longer than they expected. */
.formapay-loader-track {
	position: relative;
	height: 3px;
	margin-top: 18px;
	border-radius: 2px;
	background: #e9eef2;
	overflow: hidden;
}

.formapay-loader-track::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 40%;
	border-radius: 2px;
	background: var(--formapay-accent);
	animation: formapay-slide 1.15s ease-in-out infinite;
}

@keyframes formapay-slide {
	0%   { left: -40%; }
	100% { left: 100%; }
}

@keyframes formapay-pop {
	from { opacity: 0; transform: translate(-50%, -46%); }
	to   { opacity: 1; transform: translate(-50%, -50%); }
}

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

@media (prefers-reduced-motion: reduce) {
	.formapay-spinner,
	.formapay-loader-ring,
	.formapay-loader-ring::after { animation-duration: 2.4s; }
	.formapay-loader-track::after { animation-duration: 2.4s; }
	.formapay-page-loader-inner { animation: none; }
	.formapay-btn { transition: none; }
}

/* ------------------------------------------------------------------
   Receipt · auto-return countdown
   ------------------------------------------------------------------ */

.formapay-redirect {
	margin: 22px 0 0;
	padding-top: 18px;
	border-top: 1px solid #bbf7d0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 14px;
	font-size: 13px;
	color: #15803d;
}

.formapay-redirect-stop {
	background: #fff;
	border: 1px solid #bbf7d0;
	border-radius: 6px;
	padding: 6px 14px;
	font: 600 13px/1 inherit;
	font-family: inherit;
	color: var(--formapay-ok);
	cursor: pointer;
}

.formapay-redirect-stop:hover { border-color: var(--formapay-ok); }

.formapay-redirect-bar {
	flex: 0 0 100%;
	height: 3px;
	border-radius: 2px;
	background: #dcfce7;
	overflow: hidden;
}

.formapay-redirect-bar span {
	display: block;
	height: 100%;
	width: 100%;
	background: var(--formapay-ok);
	transition: width 1s linear;
}

/* While a payment is in flight the form recedes but the stage line stays
   fully legible — it is the only thing the customer should be reading. */
.formapay.formapay-busy #formapay-step-payment,
.formapay.formapay-busy .formapay-pane { opacity: 0.75; }
.formapay.formapay-busy .formapay-stage { opacity: 1; }

/* A second click during submission must not reach the button. */
.formapay.formapay-busy #formapay-pay-btn { pointer-events: none; }

/* Lookup button while its request is in flight. */
#formapay-lookup-btn.is-busy { opacity: 0.85; cursor: progress; }

#formapay-lookup-btn .formapay-spinner-sm {
	border-color: rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
}


/* ------------------------------------------------------------------
   Secure payment link + partial amount editor
   ------------------------------------------------------------------ */

.formapay-link-status { margin: 0; }

.formapay-amount-edit-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin-left: 8px;
	padding: 0;
	border: 1px solid var(--formapay-hair, #e1e1e1);
	border-radius: 6px;
	background: #fff;
	color: var(--formapay-accent);
	cursor: pointer;
	vertical-align: middle;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.formapay-amount-edit-btn:hover,
.formapay-amount-edit-btn:focus-visible {
	background: #eef6fb;
	border-color: var(--formapay-accent);
	outline: none;
}

.formapay-amount-edit-btn svg { display: block; }

.formapay-amount-editor {
	margin-top: 12px;
	padding: 14px 16px;
	border: 1px dashed var(--formapay-accent);
	border-radius: 8px;
	background: #f6fafd;
}

.formapay-amount-editor-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--formapay-ink, #222);
}

.formapay-amount-editor-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.formapay-amount-prefix {
	font-weight: 700;
	color: var(--formapay-ink, #222);
}

.formapay-amount-editor-row input {
	flex: 0 1 160px;
	min-width: 120px;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.formapay-btn.formapay-btn-sm {
	padding: 8px 14px;
	font-size: 14px;
}

.formapay-btn.formapay-btn-ghost {
	background: transparent;
	color: var(--formapay-accent);
	border: 1px solid var(--formapay-accent);
}

.formapay-btn.formapay-btn-ghost:hover:not(:disabled) {
	background: #eef6fb;
	color: var(--formapay-accent-dark);
}

.formapay-amount-editor-help { margin: 8px 0 0; }
.formapay-amount-editor-error { margin-top: 8px; }

.formapay-bd-row.formapay-bd-partial dt,
.formapay-bd-row.formapay-bd-partial dd { color: var(--formapay-accent-dark); }


/* Informational notice (prior payments still being posted). */
.formapay-alert-info {
	background: #eef6fb;
	border: 1px solid #bfdcee;
	color: #1f4e6b;
	border-radius: 6px;
	padding: 10px 14px;
	margin: 0 0 14px;
	font-size: 13px;
	line-height: 1.5;
}

/* The custom-URL page: keep the form centred inside any theme's content area. */
.formapay-main {
	width: 100%;
}
