/*
 * Modal de vales de regalo (ReviewPopupRenderer + assets/js/checkout-voucher.js).
 * Rediseño del 2026-10-16, variante «Targetes que s'obren».
 *
 * Tokens var(--mt-*, fallback) para heredar el design system del tema
 * (docs/12-estilo-visual.md) sin depender de que exista. D-014 del tema:
 * #14B5C5 nunca como texto ni como fondo de texto blanco; los botones llenos
 * van en primary-dark (#0A7A87, 5,0:1 con blanco).
 */

html.vra-modal-open {
	overflow: hidden;
}

.vra-checkout-overlay {
	position: fixed;
	inset: 0;
	/* Por encima del aviso de cookies (La Daurada Cookies: `.ldc-banner` y el botón
	   flotante a 999999, su modal de preferencias a 1000000). Con el token del tema
	   (--mt-z-modal, 400) el aviso tapaba el pie del modal mientras el cliente no
	   había respondido, y «Desar els canvis» no se podía pulsar (pruebas de staging
	   del 18-10). El modal es modal: tapar el aviso mientras está abierto es lo
	   correcto, y el aviso vuelve a verse al cerrarlo. */
	z-index: 1000001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(6, 63, 71, 0.55);
	animation: vra-fade 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.vra-dlg {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(580px, 100%);
	max-height: 100%;
	background: var(--mt-color-white, #fff);
	color: var(--mt-color-text-body, #333);
	border-radius: var(--mt-radius-lg, 16px);
	box-shadow: var(--mt-shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08));
	font-family: var(--mt-font-body, 'Montserrat', sans-serif);
	font-size: 1rem;
	line-height: 1.5;
	text-align: left;
	animation: vra-rise 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.vra-dlg:focus {
	outline: none;
}

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

.vra-dlg button,
.vra-dlg input,
.vra-dlg textarea {
	font: inherit;
}

/* ── Cabecera ─────────────────────────────────────────────────────────── */

.vra-dlg__head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 4px 12px;
	align-items: start;
	padding: 22px 24px 16px;
	border-bottom: 1px solid var(--mt-color-border, #e0e0e0);
}

.vra-dlg__head .vra-icon-btn {
	grid-column: 2;
	grid-row: 1;
}

.vra-dlg__head .vra-back-btn {
	grid-column: 1;
	grid-row: 1;
	justify-self: start;
}

.vra-dlg__head.has-back .vra-dlg__titles {
	grid-column: 1 / span 2;
	grid-row: 2;
}

.vra-dlg__title {
	margin: 0;
	font-family: var(--mt-font-heading, 'Bebas Neue', sans-serif);
	font-weight: 400;
	letter-spacing: 0.05em;
	font-size: 2rem;
	line-height: 1;
	text-transform: none;
	color: var(--mt-color-text-heading, #063f47);
	text-wrap: balance;
}

.vra-dlg__title:focus {
	outline: none;
}

.vra-dlg__sub {
	max-width: 52ch;
	margin: 8px 0 0;
	font-size: 0.9375rem;
	color: var(--mt-color-text-body, #333);
}

.vra-dlg__voucher {
	margin: 12px 0 0;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--mt-color-primary-deep, #063f47);
}

.vra-dlg__voucher span {
	font-weight: 500;
	color: var(--mt-color-text-secondary, #666);
}

.vra-icon-btn {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: -8px -10px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--mt-color-text-heading, #063f47);
	cursor: pointer;
}

.vra-icon-btn:hover {
	background: var(--mt-color-primary-light, #e8f8fa);
}

.vra-back-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	margin: -10px 0 0 -10px;
	padding: 0 10px;
	border: 0;
	border-radius: 22px;
	background: transparent;
	color: var(--mt-color-primary-dark, #0a7a87);
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
}

.vra-back-btn:hover {
	background: var(--mt-color-primary-light, #e8f8fa);
}

.vra-icon-btn:focus-visible,
.vra-back-btn:focus-visible {
	outline: 2px solid var(--mt-color-primary-dark, #0a7a87);
	outline-offset: 0;
}

/* ── Cuerpo y pie ─────────────────────────────────────────────────────── */

.vra-dlg__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px 24px 24px;
}

.vra-dlg__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 12px;
	padding: 14px 24px 18px;
	border-top: 1px solid var(--mt-color-border, #e0e0e0);
	background: var(--mt-color-white, #fff);
	border-radius: 0 0 var(--mt-radius-lg, 16px) var(--mt-radius-lg, 16px);
}

.vra-dlg__status {
	flex: 1 1 100%;
	margin: 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: #b91c1c;
}

.vra-dlg__status:empty {
	display: none;
}

.vra-dlg__actions {
	display: flex;
	gap: 12px;
	margin-left: auto;
}

.vra-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	margin: 0;
	padding: 0 22px;
	border: 2px solid transparent;
	border-radius: var(--mt-radius-pill, 9999px);
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s, transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.vra-btn:active:not(:disabled) {
	transform: scale(0.98);
}

.vra-btn--primary {
	background: var(--mt-color-primary-dark, #0a7a87);
	color: #fff;
}

.vra-btn--primary:hover:not(:disabled) {
	background: var(--mt-color-primary-darker, #086670);
	color: #fff;
}

.vra-btn--ghost {
	background: transparent;
	color: var(--mt-color-primary-dark, #0a7a87);
}

.vra-btn--ghost:hover {
	background: var(--mt-color-primary-light, #e8f8fa);
	color: var(--mt-color-primary-darker, #086670);
}

.vra-btn--sm {
	min-height: 44px;
	padding: 0 16px;
	font-size: 0.875rem;
	border-color: var(--mt-color-primary-dark, #0a7a87);
	background: #fff;
	color: var(--mt-color-primary-dark, #0a7a87);
}

.vra-btn--sm:hover {
	background: var(--mt-color-primary-light, #e8f8fa);
}

.vra-btn:focus-visible {
	outline: 2px solid var(--mt-color-primary-dark, #0a7a87);
	outline-offset: 2px;
}

.vra-btn:disabled {
	cursor: progress;
	opacity: 0.75;
}

.vra-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: vra-spin 0.8s linear infinite;
}

.vra-alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 16px;
	padding: 12px 14px;
	border: 1px solid #fbd5d5;
	border-radius: var(--mt-radius-md, 8px);
	background: #fef2f2;
	color: #8b1c1c;
	font-size: 0.875rem;
}

.vra-alert[hidden] {
	display: none;
}

.vra-alert svg {
	flex: none;
	margin-top: 2px;
}

/* ── Grupos y campos ──────────────────────────────────────────────────── */

.vra-grp {
	min-width: 0;
	margin: 0 0 22px;
	padding: 0;
	border: 0;
}

.vra-grp:last-child {
	margin-bottom: 0;
}

.vra-grp--tight {
	margin-bottom: 16px;
}

.vra-grp__title {
	display: block;
	margin: 0 0 10px;
	padding: 0;
	font-size: 1rem;
	font-weight: 700;
	color: var(--mt-color-text-heading, #063f47);
}

.vra-grp__hint {
	margin: -6px 0 10px;
	font-size: 0.8125rem;
	color: var(--mt-color-text-secondary, #666);
}

.vra-fld {
	margin: 0 0 16px;
}

.vra-fld:last-child {
	margin-bottom: 0;
}

.vra-reveal .vra-fld:last-child {
	margin-bottom: 16px;
}

.vra-fld__label {
	display: block;
	margin: 0 0 2px;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--mt-color-text-primary, #111);
}

.vra-fld__opt {
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--mt-color-text-secondary, #666);
}

.vra-fld__help {
	margin: 0 0 8px;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--mt-color-text-secondary, #666);
}

.vra-fld__label + .vra-fld__input {
	margin-top: 6px;
}

.vra-dlg .vra-fld__input {
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 11px 14px;
	font-size: 1rem;
	line-height: 1.4;
	color: var(--mt-color-text-primary, #111);
	background: #fff;
	border: 1px solid #bdbdbd;
	border-radius: var(--mt-radius-md, 8px);
	box-shadow: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.vra-dlg textarea.vra-fld__input {
	min-height: 96px;
	resize: vertical;
	line-height: 1.5;
}

.vra-dlg .vra-fld__input::placeholder {
	color: #767676;
}

.vra-dlg .vra-fld__input:hover {
	border-color: #8a8a8a;
}

.vra-dlg .vra-fld__input:focus {
	outline: none;
	border-color: var(--mt-color-primary-dark, #0a7a87);
	box-shadow: 0 0 0 3px rgba(10, 122, 135, 0.22);
}

.vra-fld.has-error .vra-fld__input {
	border-color: var(--mt-color-error, #dc2626);
	box-shadow: 0 0 0 1px var(--mt-color-error, #dc2626);
}

.vra-fld__err {
	display: none;
	align-items: flex-start;
	gap: 6px;
	margin: 6px 0 0;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #b91c1c;
}

.vra-fld.has-error .vra-fld__err {
	display: flex;
}

.vra-fld__err svg {
	flex: none;
	margin-top: 1px;
}

.vra-fld__meta {
	display: flex;
	justify-content: flex-end;
	margin-top: 4px;
	font-size: 0.75rem;
	font-variant-numeric: tabular-nums;
	color: var(--mt-color-text-secondary, #666);
}

.vra-fld__meta.is-near {
	color: #b45309;
	font-weight: 600;
}

/* ── Tarjetas de elección (radio) ─────────────────────────────────────── */

.vra-choices {
	display: grid;
	gap: 10px;
}

.vra-choice {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	gap: 4px 12px;
	align-items: start;
	margin: 0;
	padding: 14px;
	border: 1px solid #c9c9c9;
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.vra-choice:hover {
	border-color: var(--mt-color-primary-dark, #0a7a87);
}

.vra-dlg .vra-choice__input,
.vra-dlg .vra-seg__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	appearance: none;
	pointer-events: none;
}

.vra-choice__ico {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--mt-color-primary-light, #e8f8fa);
	color: var(--mt-color-primary-dark, #0a7a87);
}

.vra-choice__txt strong {
	display: block;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--mt-color-text-primary, #111);
}

.vra-choice__txt > span {
	display: block;
	margin-top: 3px;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--mt-color-text-secondary, #666);
}

.vra-choice__mark {
	width: 22px;
	height: 22px;
	margin-top: 2px;
	border: 2px solid #9e9e9e;
	border-radius: 50%;
	transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.vra-choice.is-checked {
	border-color: var(--mt-color-primary-dark, #0a7a87);
	box-shadow: inset 0 0 0 1px var(--mt-color-primary-dark, #0a7a87);
	background: var(--mt-color-primary-subtle, #f4fbfc);
}

.vra-choice.is-checked .vra-choice__mark {
	border-color: var(--mt-color-primary-dark, #0a7a87);
	background: var(--mt-color-primary-dark, #0a7a87);
	box-shadow: inset 0 0 0 4px #fff;
}

.vra-choice.is-checked .vra-choice__ico {
	background: var(--mt-color-primary-dark, #0a7a87);
	color: #fff;
}

.vra-choice:has(.vra-choice__input:focus-visible) {
	outline: 2px solid var(--mt-color-primary-dark, #0a7a87);
	outline-offset: 2px;
}

.vra-choice--big {
	padding: 18px;
}

.vra-choice--big .vra-choice__ico {
	width: 48px;
	height: 48px;
	border-radius: 12px;
}

.vra-choice--big .vra-choice__txt strong {
	font-size: 1.0625rem;
}

.vra-choice--sm {
	padding: 12px;
}

.vra-choice--sm .vra-choice__ico {
	width: 34px;
	height: 34px;
	border-radius: 9px;
}

/* La tarjeta «És un regal» se abre por debajo con lo que hace falta. */
.vra-choice-wrap.is-open > .vra-choice {
	border-radius: 12px 12px 0 0;
}

.vra-nest {
	margin: -1px 0 4px;
	padding: 16px;
	border: 1px solid var(--mt-color-primary-dark, #0a7a87);
	border-top: 0;
	border-radius: 0 0 12px 12px;
	background: #fff;
}

/* Segmentado (idioma) */
.vra-seg {
	display: flex;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--mt-color-border, #e0e0e0);
	border-radius: 12px;
	background: var(--mt-color-bg-light, #f5f5f5);
}

.vra-seg__opt {
	position: relative;
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
}

.vra-seg__opt > span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 6px 8px;
	border-radius: 9px;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	color: var(--mt-color-text-body, #333);
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.vra-seg__opt.is-checked > span {
	background: #fff;
	color: var(--mt-color-primary-deep, #063f47);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), inset 0 0 0 1px var(--mt-color-primary-dark, #0a7a87);
}

.vra-seg__opt:has(.vra-seg__input:focus-visible) > span {
	outline: 2px solid var(--mt-color-primary-dark, #0a7a87);
	outline-offset: 1px;
}

/* Desplegables animados */
.vra-reveal {
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden;
	transition: grid-template-rows 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.24s;
}

.vra-reveal > .vra-reveal__in {
	min-height: 0;
	overflow: hidden;
}

.vra-reveal.is-open {
	grid-template-rows: 1fr;
	visibility: visible;
	transition: grid-template-rows 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.vra-reveal.no-anim {
	transition: none;
}

/* ── Resumen del paso previo al pago ──────────────────────────────────── */

.vra-vlist {
	display: grid;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.vra-vrow {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px 16px;
	align-items: center;
	margin: 0;
	padding: 16px;
	border: 1px solid var(--mt-color-border, #e0e0e0);
	border-radius: 12px;
	background: #fff;
}

.vra-vrow.has-error {
	border-color: var(--mt-color-error, #dc2626);
	box-shadow: inset 0 0 0 1px var(--mt-color-error, #dc2626);
}

.vra-vrow__name {
	margin: 0;
	font-weight: 700;
	color: var(--mt-color-text-primary, #111);
}

.vra-vrow__name span {
	font-weight: 500;
	color: var(--mt-color-text-secondary, #666);
}

.vra-vrow__say {
	margin: 4px 0 0;
	font-size: 0.875rem;
	color: var(--mt-color-text-body, #333);
	overflow-wrap: anywhere;
}

.vra-vrow__say em {
	font-style: normal;
	font-weight: 600;
	color: #8b1c1c;
}

.vra-vrow__err {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin: 8px 0 0;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #b91c1c;
}

.vra-vrow__err svg {
	flex: none;
	margin-top: 1px;
}

.vra-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ── Móvil: hoja inferior con el botón de guardar siempre a la vista ─── */

@media (max-width: 620px) {
	.vra-checkout-overlay {
		align-items: flex-end;
		padding: 0;
	}

	.vra-dlg {
		width: 100%;
		max-height: calc(100% - 28px);
		border-radius: 20px 20px 0 0;
		animation: vra-sheet 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	}

	.vra-dlg::before {
		content: "";
		position: absolute;
		top: 8px;
		left: 50%;
		width: 40px;
		height: 4px;
		margin-left: -20px;
		border-radius: 4px;
		background: #d0d0d0;
	}

	.vra-dlg__head {
		padding: 22px 16px 14px;
	}

	.vra-dlg__title {
		font-size: 1.75rem;
	}

	.vra-dlg__body {
		padding: 16px 16px 24px;
	}

	.vra-dlg__foot {
		padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
		border-radius: 0;
	}

	.vra-dlg__actions {
		width: 100%;
	}

	.vra-dlg__actions .vra-btn--primary {
		flex: 1 1 auto;
	}

	.vra-choice--big {
		padding: 14px;
	}

	.vra-vrow {
		grid-template-columns: minmax(0, 1fr);
	}

	.vra-vrow .vra-btn--sm {
		justify-self: start;
	}
}

@keyframes vra-fade {
	from {
		opacity: 0;
	}
}

@keyframes vra-rise {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

@keyframes vra-sheet {
	from {
		opacity: 0;
		transform: translateY(40px);
	}
}

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

@media (prefers-reduced-motion: reduce) {
	.vra-checkout-overlay,
	.vra-dlg,
	.vra-reveal,
	.vra-choice,
	.vra-btn {
		animation: none;
		transition: none;
	}

	.vra-spinner {
		animation: none;
		border-top-color: rgba(255, 255, 255, 0.45);
	}
}
