/**
 * Frontend styles.
 *
 * Deliberately low-specificity and theme-neutral: colours come from CSS
 * variables so a theme (or the shop) can retheme the form in one place.
 */

.sdn-pc,
.sdn-pc-banks,
.sdn-pc-pay,
.sdn-pc-cta {
	--sdn-pc-accent: #2563eb;
	--sdn-pc-border: #e2e6ef;
	--sdn-pc-muted: #6b7280;
	--sdn-pc-bg: #ffffff;
	--sdn-pc-surface: #f7f8fb;
	--sdn-pc-text: #1f2430;
	--sdn-pc-danger: #b42318;
	--sdn-pc-success: #027a48;
	--sdn-pc-radius: 10px;

	color: var(--sdn-pc-text);
	max-width: 760px;
}

/* ---------- Payment panel: QR beside the accounts ---------- */

/*
 * The QR and the account list used to be two stacked cards with a heading
 * each, which read as two unrelated blocks. Here they share one heading and
 * sit on one row: scan on the left, or transfer to an account on the right.
 *
 * Both columns are optional — the panel is only used when the QR is actually
 * printed, and either column alone still fills the row on its own.
 */

.sdn-pc-pay {
	margin: 0 0 28px;
}

.sdn-pc-pay__title {
	font-size: 1.15em;
	margin: 0 0 12px;
}

.sdn-pc-pay__cols {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 16px;
}

.sdn-pc-pay__cols > .sdn-pc-qr {
	flex: 1 1 210px;
	max-width: 240px;
	margin: 0;
}

.sdn-pc-pay__cols > .sdn-pc-banks {
	flex: 3 1 260px;
	margin: 0;
}

.sdn-pc-qr__label,
.sdn-pc-banks__label {
	color: var(--sdn-pc-muted);
	font-size: 0.86em;
	margin: 0 0 8px;
}

/* ---------- Bank list ---------- */

.sdn-pc-banks {
	margin: 0 0 28px;
}

.sdn-pc-banks__title,
.sdn-pc-form__title {
	font-size: 1.15em;
	margin: 0 0 12px;
}

.sdn-pc-banks__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 12px;
}

.sdn-pc-banks__item {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	padding: 14px 16px;
	background: var(--sdn-pc-surface);
	border: 1px solid var(--sdn-pc-border);
	border-radius: var(--sdn-pc-radius);
}

.sdn-pc-banks__info {
	flex: 1;
	min-width: 0;
}

.sdn-pc-banks__number {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	font-size: 1.25em;
	font-weight: 700;
	letter-spacing: 0.02em;
	margin: 2px 0;
}

.sdn-pc-banks__name,
.sdn-pc-banks__branch {
	color: var(--sdn-pc-muted);
	font-size: 0.9em;
}

/*
 * Themes love to restyle every <button>, which can leave this one white on
 * white. Everything that matters is stated explicitly rather than inherited.
 */
.sdn-pc .sdn-pc-copy,
.sdn-pc-banks .sdn-pc-copy {
	background: var(--sdn-pc-bg);
	background-image: none;
	border: 1px solid var(--sdn-pc-border);
	border-radius: 6px;
	box-shadow: none;
	color: var(--sdn-pc-text);
	cursor: pointer;
	display: inline-block;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: normal;
	line-height: 1.4;
	margin: 0;
	min-height: 0;
	padding: 4px 12px;
	text-decoration: none;
	text-shadow: none;
	text-transform: none;
	width: auto;
}

.sdn-pc .sdn-pc-copy:hover,
.sdn-pc-banks .sdn-pc-copy:hover,
.sdn-pc .sdn-pc-copy:focus,
.sdn-pc-banks .sdn-pc-copy:focus {
	background: var(--sdn-pc-bg);
	border-color: var(--sdn-pc-accent);
	color: var(--sdn-pc-accent);
}

.sdn-pc .sdn-pc-copy.is-copied,
.sdn-pc-banks .sdn-pc-copy.is-copied {
	background: var(--sdn-pc-success);
	border-color: var(--sdn-pc-success);
	color: #fff;
}

/* ---------- Bank badge ---------- */

.sdn-pc-bank__logo {
	border-radius: 8px;
	flex: 0 0 auto;
	height: 40px;
	object-fit: contain;
	width: 40px;
}

.sdn-pc-bank__logo--chip {
	align-items: center;
	display: inline-flex;
	font-size: 13px;
	font-weight: 700;
	justify-content: center;
	line-height: 1;
}

/* ---------- PromptPay QR ---------- */

.sdn-pc-qr {
	margin: 0 0 24px;
}

.sdn-pc-qr__title {
	font-size: 1.15em;
	margin: 0 0 12px;
}

.sdn-pc-qr__box {
	align-items: center;
	background: var(--sdn-pc-surface);
	border: 1px solid var(--sdn-pc-border);
	border-radius: var(--sdn-pc-radius);
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	padding: 18px;
}

.sdn-pc-qr__code {
	background: #fff;
	border-radius: 8px;
	flex: 0 0 auto;
	line-height: 0;
	min-height: var(--sdn-pc-qr-size, 240px);
	min-width: var(--sdn-pc-qr-size, 240px);
	padding: 6px;
}

.sdn-pc-qr__code svg {
	display: block;
	height: auto;
	max-width: 100%;
}

.sdn-pc-qr__meta {
	flex: 1 1 180px;
	min-width: 0;
}

.sdn-pc-qr__name {
	font-weight: 600;
	margin-bottom: 4px;
}

.sdn-pc-qr__amount {
	font-size: 1.8em;
	font-weight: 700;
	line-height: 1.2;
}

.sdn-pc-qr__amount span {
	font-size: 0.55em;
	font-weight: 600;
}

.sdn-pc-qr__hint {
	color: var(--sdn-pc-muted);
	font-size: 0.86em;
	margin-top: 6px;
}

/*
 * Column variant: QR on top of its own figures, inside a narrow column.
 * The 240px floor that reserves space on a wide card would overflow here,
 * so the code box shrinks with the column and the SVG scales to fit; a
 * smaller floor still keeps the layout from jumping while the QR is drawn.
 */

.sdn-pc-qr--col .sdn-pc-qr__box {
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	text-align: center;
}

.sdn-pc-qr--col .sdn-pc-qr__code {
	min-height: 150px;
	min-width: 0;
	width: 100%;
}

.sdn-pc-qr--col .sdn-pc-qr__code svg {
	margin: 0 auto;
}

/* Amount first, then who it goes to, then the hint. */
.sdn-pc-qr--col .sdn-pc-qr__meta {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	width: 100%;
}

.sdn-pc-qr--col .sdn-pc-qr__amount {
	font-size: 1.35em;
	order: 1;
}

.sdn-pc-qr--col .sdn-pc-qr__name {
	color: var(--sdn-pc-muted);
	font-size: 0.9em;
	font-weight: 400;
	margin: 4px 0 0;
	order: 2;
}

.sdn-pc-qr--col .sdn-pc-qr__hint {
	margin-top: 4px;
	order: 3;
}

/*
 * Below this the two columns no longer both fit, so stop the QR column from
 * being pinned to a narrow strip on the left and let it run full width.
 */
@media (max-width: 600px) {
	.sdn-pc-pay__cols > .sdn-pc-qr {
		flex-basis: 100%;
		max-width: none;
	}

	.sdn-pc-qr--col .sdn-pc-qr__code svg {
		max-width: 220px;
	}
}

@media (max-width: 480px) {
	.sdn-pc-qr__box {
		justify-content: center;
		text-align: center;
	}
}

/* ---------- Form ---------- */

.sdn-pc-form {
	background: var(--sdn-pc-bg);
	border: 1px solid var(--sdn-pc-border);
	border-radius: var(--sdn-pc-radius);
	padding: 22px;
}

.sdn-pc-grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sdn-pc-field {
	margin: 0 0 16px;
}

.sdn-pc-grid .sdn-pc-field {
	margin: 0;
}

.sdn-pc-field--full {
	grid-column: 1 / -1;
}

.sdn-pc-field label,
.sdn-pc-label {
	display: block;
	font-size: 0.92em;
	font-weight: 600;
	margin-bottom: 6px;
}

.sdn-pc-field input[type="text"],
.sdn-pc-field input[type="tel"],
.sdn-pc-field input[type="email"],
.sdn-pc-field input[type="number"],
.sdn-pc-field input[type="date"],
.sdn-pc-field input[type="time"],
.sdn-pc-field input[type="file"],
.sdn-pc-field textarea {
	background: var(--sdn-pc-bg);
	border: 1px solid var(--sdn-pc-border);
	border-radius: 8px;
	box-sizing: border-box;
	font: inherit;
	padding: 10px 12px;
	width: 100%;
}

.sdn-pc-field input:focus,
.sdn-pc-field textarea:focus {
	border-color: var(--sdn-pc-accent);
	outline: 2px solid var(--sdn-pc-accent); /* fallback for browsers without color-mix */
	outline: 2px solid color-mix(in srgb, var(--sdn-pc-accent) 25%, transparent);
	outline-offset: 1px;
}

.sdn-pc-picker select {
	background: var(--sdn-pc-bg);
	border: 1px solid var(--sdn-pc-border);
	border-radius: 8px;
	box-sizing: border-box;
	font: inherit;
	max-width: 100%;
	padding: 10px 12px;
	width: 100%;
}

.sdn-pc-picker select:focus {
	border-color: var(--sdn-pc-accent);
}

.sdn-pc-field input[readonly] {
	background: var(--sdn-pc-surface);
	color: var(--sdn-pc-muted);
}

.sdn-pc-invalid {
	border-color: var(--sdn-pc-danger) !important;
}

.sdn-pc-req {
	color: var(--sdn-pc-danger);
}

.sdn-pc-hint {
	color: var(--sdn-pc-muted);
	display: block;
	font-size: 0.82em;
	margin-top: 5px;
}

.sdn-pc-preview {
	display: block;
	margin-top: 10px;
}

.sdn-pc-preview img {
	border: 1px solid var(--sdn-pc-border);
	border-radius: 8px;
	max-height: 220px;
	max-width: 100%;
}

/* ---------- Account picker ---------- */

.sdn-pc-accounts {
	display: grid;
	gap: 10px;
}

.sdn-pc-account {
	cursor: pointer;
	display: block;
	margin: 0;
}

.sdn-pc-account input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.sdn-pc-account__body {
	align-items: center;
	border: 2px solid var(--sdn-pc-border);
	border-radius: var(--sdn-pc-radius);
	display: flex;
	gap: 12px;
	padding: 12px 14px;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.sdn-pc-account input[type="radio"]:checked + .sdn-pc-account__body {
	background: var(--sdn-pc-surface); /* fallback for browsers without color-mix */
	background: color-mix(in srgb, var(--sdn-pc-accent) 6%, transparent);
	border-color: var(--sdn-pc-accent);
}

.sdn-pc-account input[type="radio"]:focus-visible + .sdn-pc-account__body {
	outline: 2px solid var(--sdn-pc-accent);
	outline-offset: 2px;
}

.sdn-pc-account__text {
	display: flex;
	flex-direction: column;
	line-height: 1.4;
	min-width: 0;
}

.sdn-pc-account__number {
	font-weight: 700;
}

.sdn-pc-account__name {
	color: var(--sdn-pc-muted);
	font-size: 0.88em;
}

/* ---------- Feedback ---------- */

.sdn-pc-alert,
.sdn-pc-success,
.sdn-pc-notice {
	border-radius: 8px;
	margin-bottom: 18px;
	padding: 12px 14px;
}

.sdn-pc-alert {
	background: #fef3f2;
	border: 1px solid #fecdca;
	color: var(--sdn-pc-danger);
}

.sdn-pc-success {
	background: #ecfdf3;
	border: 1px solid #abefc6;
	color: var(--sdn-pc-success);
	font-size: 1.02em;
}

.sdn-pc-notice--warning {
	background: #fffaeb;
	border: 1px solid #fedf89;
	color: #93370d;
}

/* ---------- Actions ---------- */

.sdn-pc-actions {
	margin: 20px 0 0;
}

.sdn-pc-submit {
	align-items: center;
	display: inline-flex;
	gap: 10px;
}

.sdn-pc-submit[disabled] {
	cursor: progress;
	opacity: 0.7;
}

.sdn-pc-spinner {
	animation: sdn-pc-spin 0.7s linear infinite;
	border: 2px solid currentColor;
	border-radius: 50%;
	border-right-color: transparent;
	display: inline-block;
	height: 14px;
	width: 14px;
}

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

.sdn-pc-cta {
	margin: 16px 0 28px;
}

/* Human-check widgets — reserve their height so the button does not jump. */
.sdn-pc-captcha {
	margin: 18px 0 0;
}

.sdn-pc-captcha--turnstile {
	min-height: 65px;
}

.sdn-pc-captcha--recaptcha_v2 {
	min-height: 78px;
}

/* reCAPTCHA v2 is a fixed 304px wide; scale it down on narrow phones. */
@media (max-width: 360px) {
	.sdn-pc-captcha--recaptcha_v2 .g-recaptcha {
		transform: scale(0.9);
		transform-origin: 0 0;
	}
}

/* Honeypot: hidden from people, present for bots. */
.sdn-pc-hp {
	height: 0;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	width: 0;
}

@media (max-width: 600px) {
	.sdn-pc-grid {
		grid-template-columns: 1fr;
	}

	.sdn-pc-form {
		padding: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sdn-pc-spinner {
		animation-duration: 2s;
	}

	.sdn-pc-account__body {
		transition: none;
	}
}
