/*
 * Styling for the application form: embedded without an extra outer frame,
 * numbered step headings, and a single column that
 * collapses to one field per row on a phone.
 *
 * Everything is scoped under .ym-b2e so the host theme is left alone, and the
 * tokens are declared on that scope rather than :root for the same reason.
 */

.ym-b2e {
	--ym-blue: #295bcf;
	--ym-blue-dark: #1e40af;
	--ym-blue-bg: #295bcf;
	--ym-blue-soft: #eaf5f9;
	--ym-border: #d9ebef;
	--ym-text: #304e6b;
	--ym-muted: #8ba6b0;
	--ym-error: #dc2626;
	--ym-radius: 22px;

	background: transparent;
	box-sizing: border-box;
	color: var(--ym-text);
	font-family: 'Noto Sans Thai', 'Leelawadee UI', Tahoma, sans-serif;
	font-size: 14px;
	line-height: 1.6;
	margin: 0 auto;
	max-width: 1200px;
	padding: 0;
}

.ym-b2e *,
.ym-b2e *::before,
.ym-b2e *::after {
	box-sizing: inherit;
}

.ym-b2e [hidden] {
	display: none !important;
}

.ym-b2e :is(input, select, textarea, h2, .ym-field, .ym-alert) {
	/* Allows room for the site's sticky header and WordPress admin bar. */
	scroll-margin-top: var(--ym-scroll-offset, 120px);
}

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

.ym-b2e .ym-card {
	background: #fff;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	margin: 0;
	padding: 24px 0;
}

.ym-card > .ym-step,
.ym-card > .ym-actions,
.ym-card > .ym-summary,
.ym-card > .ym-consents,
.ym-card > .ym-alert,
.ym-card > .ym-step__title {
	max-width: 720px;
	margin-left: auto;
	margin-right: auto;
}

.ym-title {
	color: var(--ym-blue);
	font-size: 34px;
	font-weight: 700;
	margin: 0 0 30px;
	text-align: center;
}

.ym-step + .ym-step {
	margin-top: 24px;
}

.ym-step__title {
	align-items: center;
	color: var(--ym-blue);
	display: flex;
	font-size: 25px;
	font-weight: 600;
	gap: 10px;
	margin: 0 0 16px;
}

.ym-step__num {
	align-items: center;
	background: var(--ym-blue);
	border-radius: 50%;
	color: #fff;
	display: inline-flex;
	flex: 0 0 23px;
	font-size: 14px;
	height: 23px;
	justify-content: center;
	width: 23px;
}

.ym-subtitle {
	color: var(--ym-blue);
	font-size: 17px;
	font-weight: 700;
	margin: 24px 0 12px;
}

/* -- fields ---------------------------------------------------------------- */

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

.ym-grid--address {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ym-field {
	display: block;
	margin-bottom: 12px;
	min-width: 0;
}

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

.ym-label abbr,
.ym-consent abbr,
.ym-upload__title abbr {
	color: inherit;
	text-decoration: none;
}

.ym-b2e input[type='text'],
.ym-b2e input[type='tel'],
.ym-b2e input[type='email'],
.ym-b2e select,
.ym-b2e textarea {
	background: #fff;
	border: 1.5px solid var(--ym-border);
	border-radius: var(--ym-radius);
	color: var(--ym-text);
	display: block;
	font: inherit;
	min-height: 42px;
	padding: 9px 16px;
	width: 100%;
}

.ym-b2e textarea {
	border-radius: 20px;
	min-height: 96px;
	resize: vertical;
}

.ym-b2e input:focus,
.ym-b2e select:focus,
.ym-b2e textarea:focus {
	border-color: var(--ym-blue);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
	outline: none;
}

.ym-b2e input[readonly] {
	background: #fff;
	color: var(--ym-muted);
}

.ym-b2e select:disabled {
	background: #fff;
	color: var(--ym-muted);
}

.ym-b2e ::placeholder {
	color: var(--ym-muted);
	opacity: 1;
}

.ym-packages {
	display: grid;
	gap: 14px;
}

.ym-package {
	align-items: center;
	border: 1.5px solid var(--ym-border);
	border-radius: 20px;
	cursor: pointer;
	display: flex;
	gap: 18px;
	min-height: 64px;
	padding: 9px 22px 9px 16px;
}

.ym-package:has(input:checked) {
	background: #e5f2f7;
	border-color: #6d9eff;
}

.ym-package__copy {
	flex: 1;
	min-width: 0;
}

.ym-package__name {
	display: block;
	font-size: 17px;
	font-weight: 600;
}

.ym-package__note {
	color: #a8813d;
	display: block;
	font-size: 11px;
}

.ym-package input {
	accent-color: var(--ym-blue);
	flex: 0 0 auto;
	margin: 0;
}

.ym-carrier {
	flex: 0 0 62px;
	font-family: Arial, sans-serif;
	font-size: 23px;
	font-weight: 800;
	text-align: center;
}

.ym-b2e .ym-carrier__logo {
	display: block;
	height: auto;
	max-width: 100%;
	width: 62px;
	object-fit: contain;
}

.ym-hint {
	color: var(--ym-muted);
	font-size: 13px;
	margin: 6px 0 0;
}

.ym-hint--blue {
	color: #5782dc;
}

.ym-hint--card {
	display: block;
	font-size: 10px;
	color: var(--ym-text);
}

.ym-error {
	color: var(--ym-error);
	display: none;
	font-size: 13px;
	margin-top: 4px;
}

.ym-error.is-visible {
	display: block;
}

.ym-b2e input[aria-invalid='true'],
.ym-b2e select[aria-invalid='true'],
.ym-b2e textarea[aria-invalid='true'],
.ym-b2e .is-invalid {
	border-color: var(--ym-error);
	box-shadow: 0 0 0 1px var(--ym-error);
}

.ym-b2e input[aria-invalid='true']:focus,
.ym-b2e select[aria-invalid='true']:focus {
	box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.ym-honeypot {
	left: -9999px;
	position: absolute;
}

/* -- radio cards ------------------------------------------------------------ */

.ym-choices {
	display: grid;
	gap: 16px;
	margin-bottom: 8px;
}

.ym-choices--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ym-choice {
	align-items: center;
	border: 1px solid var(--ym-border);
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	gap: 10px;
	font-size: 12px;
	min-height: 42px;
	padding: 10px 12px;
}

.ym-choice:has(input:checked) {
	background: var(--ym-blue-soft);
	border-color: var(--ym-blue);
}

.ym-choice input {
	accent-color: var(--ym-blue);
	flex: 0 0 auto;
	margin: 0;
}

/* -- uploads ---------------------------------------------------------------- */

.ym-uploads {
	display: grid;
	gap: 14px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin-top: 10px;
}

.ym-b2e--esim .ym-uploads {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ym-upload {
	background: var(--ym-blue-soft);
	border: 1px solid transparent;
	border-radius: var(--ym-radius);
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 16px 14px 8px;
	text-align: center;
}

.ym-upload.is-filled {
	border-color: var(--ym-blue);
}

.ym-upload__icon {
	color: var(--ym-blue);
	height: 32px;
	margin: 0 auto 12px;
	width: 32px;
}

.ym-upload__icon svg {
	display: block;
	height: 100%;
	width: 100%;
}

.ym-upload__title {
	color: var(--ym-blue);
	font-size: 13px;
	font-weight: 600;
	margin: 0 auto 6px;
	max-width: 150px;
}

.ym-upload__hint {
	color: var(--ym-muted);
	font-size: 10px;
	margin: auto 0 6px;
}

.ym-upload__button {
	background: #fff;
	border: 1px solid var(--ym-blue);
	border-radius: 999px;
	color: var(--ym-blue);
	cursor: pointer;
	display: block;
	font-size: 13px;
	font-weight: 600;
	overflow: hidden;
	padding: 3px 10px;
	position: relative;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ym-upload__button input {
	cursor: pointer;
	height: 100%;
	inset: 0;
	opacity: 0;
	position: absolute;
	width: 100%;
}

.ym-upload__button:focus-within {
	outline: 2px solid var(--ym-blue);
	outline-offset: 3px;
}

.ym-esim-delivery {
	background: var(--ym-blue-soft);
	border-radius: 10px;
	color: var(--ym-blue);
	padding: 14px 22px;
}

.ym-esim-delivery p {
	color: var(--ym-muted);
	font-size: 13px;
	margin: 4px 0 0;
}

[data-ym-other-address] {
	margin-top: 20px;
}

/* -- card number ------------------------------------------------------------ */

.ym-card-input {
	display: block;
	position: relative;
}

.ym-card-brand {
	color: var(--ym-blue);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
}

.ym-b2e [data-ym-card-number] {
	padding-right: 78px;
}

/* -- review ----------------------------------------------------------------- */

.ym-b2e .ym-summary {
	border: 1px solid var(--ym-border);
	border-radius: var(--ym-radius);
	margin: 0 auto 24px;
	padding: 20px 24px;
}

.ym-b2e .ym-summary__group {
	display: grid;
	grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
	gap: 20px;
	padding: 16px 0;
}

.ym-b2e .ym-summary__group + .ym-summary__group {
	border-top: 1px solid var(--ym-border);
}

.ym-b2e .ym-summary__heading {
	color: var(--ym-blue);
	display: block;
	font: inherit;
	font-weight: 600;
	margin: 0;
}

.ym-b2e .ym-summary__content {
	min-width: 0;
	overflow-wrap: anywhere;
}

.ym-b2e .ym-summary__content p {
	margin: 0;
}

.ym-b2e .ym-summary__package {
	display: flex;
	align-items: center;
	gap: 12px;
}

.ym-b2e .ym-summary__package .ym-package__name {
	font-size: 14px;
}

.ym-b2e .ym-summary__details {
	display: grid;
	grid-template-columns: minmax(110px, 160px) minmax(0, 1fr);
	gap: 4px 16px;
	margin: 0;
}

.ym-b2e .ym-summary dt {
	color: var(--ym-muted);
	display: block;
	font-size: 13px;
	font-weight: 400;
	margin: 0;
	padding: 0;
}

.ym-b2e .ym-summary dd {
	color: var(--ym-text);
	display: block;
	font-size: 13px;
	font-weight: 500;
	margin: 0;
	padding: 0;
	overflow-wrap: anywhere;
}

.ym-consents {
	display: grid;
	gap: 10px;
	margin-bottom: 20px;
}

.ym-consent {
	align-items: flex-start;
	cursor: pointer;
	display: flex;
	gap: 10px;
}

.ym-consent input {
	accent-color: var(--ym-blue);
	margin-top: 5px;
}

.ym-consent a {
	color: var(--ym-blue);
	text-decoration: underline;
}

.ym-alert {
	border-radius: var(--ym-radius);
	font-size: 15px;
	margin-bottom: 20px;
	padding: 14px 16px;
}

.ym-alert--error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.ym-notice {
	background: var(--ym-blue-soft);
	border-radius: var(--ym-radius);
	padding: 20px;
	text-align: center;
}

.ym-notice--admin {
	background: #fffbeb;
	margin-top: 12px;
	text-align: left;
}

/* -- buttons ----------------------------------------------------------------- */

.ym-actions {
	display: flex;
	justify-content: center;
	margin-top: 32px;
}

.ym-actions--split {
	gap: 12px;
	justify-content: space-between;
}

.ym-button {
	align-items: center;
	border: 1px solid transparent;
	border-radius: 999px;
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: 600;
	gap: 8px;
	justify-content: center;
	min-height: 48px;
	padding: 12px 32px;
}

.ym-button--primary {
	background: var(--ym-blue);
	color: #fff;
}

.ym-button--primary:hover:not(:disabled) {
	background: var(--ym-blue-dark);
}

.ym-button--ghost {
	background: #fff;
	border-color: var(--ym-border);
	color: var(--ym-muted);
}

.ym-button:disabled {
	cursor: progress;
	opacity: 0.6;
}

/* -- done -------------------------------------------------------------------- */

.ym-done {
	background: var(--ym-blue-bg);
	border-radius: 18px;
	padding: 60px 24px;
	text-align: center;
}

.ym-done__card {
	background: #fff;
	border-radius: 28px;
	margin: 0 auto 28px;
	max-width: 520px;
	padding: 40px 32px;
}

.ym-done__check {
	align-items: center;
	background: #e7f8ec;
	border-radius: 50%;
	color: #16a34a;
	display: inline-flex;
	height: 52px;
	justify-content: center;
	margin-bottom: 16px;
	width: 52px;
}

.ym-done__card h2 {
	color: var(--ym-blue);
	font-size: 26px;
	margin: 0 0 10px;
}

.ym-done__order {
	font-size: 18px;
	margin: 0 0 14px;
}

.ym-done__order strong {
	margin-left: 8px;
}

.ym-done__note {
	color: var(--ym-muted);
	margin: 0;
}

.ym-done__home {
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 999px;
	color: #fff;
	display: inline-block;
	padding: 12px 32px;
	text-decoration: none;
}

/* -- overlay ------------------------------------------------------------------ */

.ym-overlay {
	align-items: center;
	background: rgba(15, 23, 42, 0.45);
	display: flex;
	inset: 0;
	justify-content: center;
	position: fixed;
	z-index: 9999;
}

.ym-overlay[hidden] {
	display: none;
}

.ym-overlay__box {
	background: #fff;
	border-radius: 14px;
	max-width: 320px;
	padding: 28px 32px;
	text-align: center;
}

.ym-spinner {
	animation: ym-spin 0.9s linear infinite;
	border: 3px solid var(--ym-border);
	border-radius: 50%;
	border-top-color: var(--ym-blue);
	height: 32px;
	margin: 0 auto 14px;
	width: 32px;
}

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

@media (prefers-reduced-motion: reduce) {
	.ym-spinner {
		animation-duration: 3s;
	}
}

/* -- phone --------------------------------------------------------------------- */

@media (max-width: 782px) {
	.ym-uploads,
	.ym-b2e--esim .ym-uploads {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ym-grid--address {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.ym-b2e {
		padding: 0;
	}

	.ym-b2e .ym-card {
		border-radius: 0;
		padding: 20px 12px;
	}

	.ym-title {
		font-size: 26px;
	}

	.ym-step__title {
		align-items: flex-start;
		font-size: 19px;
	}

	.ym-step__num {
		margin-top: 3px;
	}

	.ym-package {
		gap: 10px;
		padding: 12px;
	}

	.ym-package__name {
		font-size: 14px;
	}

	.ym-carrier {
		flex-basis: 42px;
		font-size: 20px;
	}

	.ym-grid,
	.ym-grid--address,
	.ym-choices--2,
	.ym-uploads,
	.ym-b2e--esim .ym-uploads {
		grid-template-columns: minmax(0, 1fr);
	}

	.ym-b2e .ym-summary {
		padding: 16px;
	}

	.ym-b2e .ym-summary__group {
		grid-template-columns: minmax(0, 1fr);
		gap: 10px;
	}

	.ym-b2e .ym-summary__details {
		grid-template-columns: minmax(90px, 0.9fr) minmax(0, 1fr);
		gap: 6px 12px;
	}

	.ym-actions--split {
		flex-direction: column-reverse;
	}

	.ym-actions--split .ym-button {
		width: 100%;
	}
}
