/**
 * Formula Ventas - estilos del front.
 * Todo se controla con las variables --fv-* que imprime el plugin en el wrapper.
 */

.fv-wrap {
	--fv-font: inherit;
	--fv-shadow: 0 18px 45px -20px rgba(17, 24, 39, .28);
	box-sizing: border-box;
	width: 100%;
	max-width: var(--fv-max-width, 780px);
	margin: 0 auto;
	padding: 0;
	font-family: var(--fv-font);
	font-size: var(--fv-font-size, 15px);
	color: var(--fv-text, #111827);
	background: var(--fv-page-bg, transparent);
	line-height: 1.5;
}

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

.fv-shadow-none { --fv-shadow: none; }
.fv-shadow-soft { --fv-shadow: 0 18px 45px -20px rgba(17, 24, 39, .28); }
.fv-shadow-strong { --fv-shadow: 0 30px 60px -22px rgba(17, 24, 39, .45); }

.fv-form {
	display: flex;
	flex-direction: column;
	gap: var(--fv-gap, 28px);
	padding: var(--fv-card-padding, 36px);
	background: var(--fv-card-bg, #fff);
	border: 1px solid var(--fv-border, #e5e7eb);
	border-radius: var(--fv-radius, 18px);
	box-shadow: var(--fv-shadow);
}

/* ---------- Encabezado ---------- */

.fv-head {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fv-title {
	margin: 0;
	font-size: var(--fv-heading-size, 34px);
	line-height: 1.15;
	font-weight: 750;
	letter-spacing: -.02em;
	color: var(--fv-text);
}

.fv-subtitle {
	margin: 0;
	font-size: var(--fv-sub-size, 17px);
	line-height: 1.5;
	color: var(--fv-muted, #6b7280);
}

.fv-align-center .fv-head,
.fv-align-center .fv-footnote {
	text-align: center;
}

.fv-align-center .fv-actions {
	justify-content: center;
}

/* ---------- Progreso ---------- */

.fv-progress {
	height: 6px;
	margin-top: -8px;
	background: color-mix(in srgb, var(--fv-border) 70%, transparent);
	border-radius: 999px;
	overflow: hidden;
}

.fv-progress-bar {
	height: 100%;
	width: 0;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--fv-primary), var(--fv-accent, var(--fv-primary)));
	transition: width .35s cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Campos ---------- */

.fv-fields {
	display: flex;
	flex-direction: column;
	gap: var(--fv-gap, 28px);
}

.fv-field {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.fv-label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 0 12px;
	margin: 0;
	font-size: var(--fv-label-size, 15px);
	font-weight: 650;
	color: var(--fv-text);
	line-height: 1.3;
}

.fv-align-center .fv-label {
	justify-content: center;
}

.fv-step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	flex: 0 0 24px;
	border-radius: 50%;
	font-size: 12px;
	font-weight: 700;
	color: var(--fv-primary);
	background: color-mix(in srgb, var(--fv-primary) 12%, transparent);
}

.fv-req {
	color: var(--fv-accent, var(--fv-primary));
}

.fv-help {
	margin: -6px 0 12px;
	font-size: 13px;
	color: var(--fv-muted);
}

.fv-align-center .fv-help {
	text-align: center;
}

/* ---------- Burbujas ---------- */

.fv-bubble-grid {
	display: grid;
	grid-template-columns: repeat(var(--fv-cols, auto-fit), minmax(0, 1fr));
	gap: 12px;
}

.fv-bubble-grid:not([style*="--fv-cols"]) {
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.fv-bubble {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 56px;
	padding: 14px 18px;
	border: 2px solid var(--fv-border, #e5e7eb);
	border-radius: var(--fv-bubble-radius, 999px);
	background: var(--fv-bg, #fff);
	cursor: pointer;
	text-align: center;
	transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease, color .18s ease;
	user-select: none;
}

.fv-bubble:hover {
	border-color: color-mix(in srgb, var(--fv-primary) 55%, var(--fv-border));
	transform: translateY(-1px);
}

.fv-radio {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.fv-bubble-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	min-width: 0;
}

.fv-bubble-icon {
	font-size: 1.35em;
	line-height: 1;
}

.fv-bubble-text {
	font-weight: 600;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.fv-bubble-note {
	font-size: .82em;
	font-weight: 400;
	color: var(--fv-muted);
}

.fv-check {
	position: absolute;
	top: -8px;
	right: -6px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--fv-primary);
	opacity: 0;
	transform: scale(.6);
	transition: opacity .18s ease, transform .18s ease;
}

.fv-check::after {
	content: "";
	position: absolute;
	left: 7px;
	top: 4px;
	width: 6px;
	height: 11px;
	border: solid var(--fv-primary-text, #fff);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* Estados seleccionados por variante */

.fv-bubble:has(.fv-radio:checked) .fv-check,
.fv-bubble.is-selected .fv-check {
	opacity: 1;
	transform: scale(1);
}

.fv-bubbles-soft .fv-bubble:has(.fv-radio:checked),
.fv-bubbles-soft .fv-bubble.is-selected {
	border-color: var(--fv-primary);
	background: color-mix(in srgb, var(--fv-primary) 10%, var(--fv-bg));
	color: color-mix(in srgb, var(--fv-primary) 75%, var(--fv-text));
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--fv-primary) 14%, transparent);
}

.fv-bubbles-outline .fv-bubble:has(.fv-radio:checked),
.fv-bubbles-outline .fv-bubble.is-selected {
	border-color: var(--fv-primary);
	box-shadow: inset 0 0 0 1px var(--fv-primary);
}

.fv-bubbles-solid .fv-bubble:has(.fv-radio:checked),
.fv-bubbles-solid .fv-bubble.is-selected {
	border-color: var(--fv-primary);
	background: var(--fv-primary);
	color: var(--fv-primary-text, #fff);
}

.fv-bubbles-solid .fv-bubble.is-selected .fv-bubble-note,
.fv-bubbles-solid .fv-bubble:has(.fv-radio:checked) .fv-bubble-note {
	color: color-mix(in srgb, var(--fv-primary-text) 80%, transparent);
}

.fv-bubbles-solid .fv-bubble.is-selected .fv-check,
.fv-bubbles-solid .fv-bubble:has(.fv-radio:checked) .fv-check {
	background: var(--fv-primary-text);
}

.fv-bubbles-solid .fv-bubble.is-selected .fv-check::after,
.fv-bubbles-solid .fv-bubble:has(.fv-radio:checked) .fv-check::after {
	border-color: var(--fv-primary);
}

.fv-radio:focus-visible + .fv-bubble-inner {
	outline: none;
}

.fv-bubble:focus-within {
	outline: 3px solid color-mix(in srgb, var(--fv-primary) 35%, transparent);
	outline-offset: 2px;
}

/* ---------- Desplegable ---------- */

.fv-select-wrap {
	position: relative;
	display: block;
}

.fv-select {
	appearance: none;
	-webkit-appearance: none;
	width: 100%;
	min-height: 56px;
	padding: 14px 46px 14px 18px;
	font: inherit;
	font-weight: 600;
	color: var(--fv-text);
	background: var(--fv-bg, #fff);
	border: 2px solid var(--fv-border, #e5e7eb);
	border-radius: var(--fv-bubble-radius, 999px);
	cursor: pointer;
	transition: border-color .18s ease, box-shadow .18s ease;
}

.fv-select:hover {
	border-color: color-mix(in srgb, var(--fv-primary) 55%, var(--fv-border));
}

.fv-select:focus {
	outline: none;
	border-color: var(--fv-primary);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--fv-primary) 16%, transparent);
}

.fv-select-arrow {
	position: absolute;
	right: 20px;
	top: 50%;
	width: 9px;
	height: 9px;
	margin-top: -6px;
	border: solid var(--fv-muted);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
	pointer-events: none;
}

/* ---------- Datos de contacto ---------- */

.fv-lead {
	padding: 20px;
	border: 1px dashed var(--fv-border, #e5e7eb);
	border-radius: calc(var(--fv-radius, 18px) * .7);
	background: color-mix(in srgb, var(--fv-primary) 4%, transparent);
}

.fv-step-lead {
	font-size: 13px;
}

.fv-lead-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 12px;
}

.fv-lead-stacked .fv-lead-grid {
	grid-template-columns: 1fr;
}

.fv-lead-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	text-align: left;
	min-width: 0;
}

.fv-lead-label {
	font-size: .86em;
	font-weight: 600;
	color: var(--fv-muted);
}

.fv-input {
	width: 100%;
	min-height: 48px;
	padding: 12px 16px;
	font: inherit;
	color: var(--fv-text);
	background: var(--fv-bg, #fff);
	border: 2px solid var(--fv-border, #e5e7eb);
	border-radius: min(var(--fv-bubble-radius, 999px), 14px);
	transition: border-color .18s ease, box-shadow .18s ease;
}

.fv-input:focus {
	outline: none;
	border-color: var(--fv-primary);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--fv-primary) 16%, transparent);
}

.fv-input::placeholder {
	color: color-mix(in srgb, var(--fv-muted) 70%, transparent);
}

.fv-lead-field.fv-has-error .fv-input {
	border-color: #fda4af;
	background: #fff5f6;
}

.fv-consent {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin-top: 14px;
	font-size: .88em;
	line-height: 1.45;
	color: var(--fv-muted);
	text-align: left;
	cursor: pointer;
}

.fv-consent input {
	margin: 2px 0 0;
	width: 17px;
	height: 17px;
	flex: 0 0 17px;
	accent-color: var(--fv-primary);
}

.fv-consent.fv-has-error {
	color: #9f1239;
}

/* ---------- Botón ---------- */

.fv-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.fv-submit {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 58px;
	padding: 16px 40px;
	font: inherit;
	font-size: 1.05em;
	font-weight: 700;
	letter-spacing: .01em;
	color: var(--fv-primary-text, #fff);
	background: linear-gradient(135deg, var(--fv-primary), color-mix(in srgb, var(--fv-accent, var(--fv-primary)) 70%, var(--fv-primary)));
	border: 0;
	border-radius: var(--fv-button-radius, 999px);
	cursor: pointer;
	box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--fv-primary) 80%, transparent);
	transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.fv-actions-full,
.fv-actions-full .fv-submit {
	width: 100%;
}

.fv-submit:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 18px 32px -14px color-mix(in srgb, var(--fv-primary) 85%, transparent);
}

.fv-submit:active:not(:disabled) {
	transform: translateY(0);
}

.fv-submit:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--fv-primary) 40%, transparent);
	outline-offset: 3px;
}

.fv-submit:disabled {
	opacity: .5;
	cursor: not-allowed;
	box-shadow: none;
}

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

.fv-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid color-mix(in srgb, var(--fv-primary-text) 35%, transparent);
	border-top-color: var(--fv-primary-text, #fff);
	border-radius: 50%;
	animation: fv-spin .7s linear infinite;
}

.fv-submit.is-loading .fv-spinner {
	display: inline-block;
}

.fv-submit.is-loading {
	pointer-events: none;
	opacity: .85;
}

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

/* ---------- Mensajes ---------- */

.fv-alert,
.fv-inline-error {
	margin: 0;
	padding: 12px 16px;
	font-size: .93em;
	font-weight: 600;
	color: #9f1239;
	background: #fff1f2;
	border: 1px solid #fecdd3;
	border-radius: 12px;
	text-align: center;
}

.fv-inline-error[hidden] {
	display: none;
}

.fv-field.fv-has-error .fv-bubble,
.fv-field.fv-has-error .fv-select {
	border-color: #fda4af;
}

.fv-footnote {
	margin: 0;
	font-size: .85em;
	color: var(--fv-muted);
}

.fv-notice-admin {
	padding: 14px 18px;
	background: #fffbeb;
	border: 1px dashed #fcd34d;
	border-radius: 10px;
	color: #92400e;
	font-size: 14px;
}

/* ---------- Animación de entrada ---------- */

.fv-animate .fv-field {
	animation: fv-fade-up .45s cubic-bezier(.22, 1, .36, 1) both;
}

.fv-animate .fv-field:nth-child(2) { animation-delay: .06s; }
.fv-animate .fv-field:nth-child(3) { animation-delay: .12s; }
.fv-animate .fv-field:nth-child(4) { animation-delay: .18s; }
.fv-animate .fv-field:nth-child(5) { animation-delay: .24s; }

@keyframes fv-fade-up {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.fv-wrap * {
		animation: none !important;
		transition: none !important;
	}
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
	.fv-form {
		padding: clamp(20px, 6vw, var(--fv-card-padding, 36px));
		border-radius: min(var(--fv-radius, 18px), 16px);
	}

	.fv-title {
		font-size: clamp(24px, 6.5vw, var(--fv-heading-size, 34px));
	}

	.fv-bubble-grid {
		grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	}

	.fv-actions-full .fv-submit,
	.fv-submit {
		width: 100%;
	}
}

/* Fallback para navegadores sin color-mix() */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
	.fv-bubbles-soft .fv-bubble.is-selected,
	.fv-bubbles-soft .fv-bubble:has(.fv-radio:checked) {
		background: var(--fv-bg);
		border-color: var(--fv-primary);
		box-shadow: 0 0 0 3px var(--fv-border);
	}

	.fv-step {
		background: var(--fv-border);
	}
}
