/*
 * TuSai Toolkit - Popup acquisizione contatti
 * Palette allineata al sito: inchiostro #334155, prugna #6B1856,
 * corallo #FF4963, menta #61C8A2, sole #FBC90F.
 */

.tusai-pop {
	--tp-ink: #334155;
	--tp-ink-soft: #64748B;
	--tp-plum: #6B1856;
	--tp-coral: #FF4963;
	--tp-coral-deep: #D92244;
	--tp-mint: #61C8A2;
	--tp-sun: #FBC90F;
	--tp-surface: #FFFFFF;
	--tp-field: #FBFAFC;
	--tp-border: #E2E1E8;
	--tp-error: #C0182F;
	--tp-wa: #075E54;
	--tp-radius-card: 24px;
	--tp-radius-field: 14px;
	--tp-shadow: 0 24px 60px rgba(15, 23, 42, .28), 0 4px 12px rgba(15, 23, 42, .12);

	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	padding-bottom: max(16px, env(safe-area-inset-bottom));
	padding-top: max(16px, env(safe-area-inset-top));
	font-family: inherit;
	line-height: 1.5;
}

.tusai-pop[hidden] {
	display: none;
}

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

.tusai-pop__scrim {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, .58);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	animation: tusai-fade 200ms ease-out;
}

.tusai-pop__dialog {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--tp-surface);
	color: var(--tp-ink);
	border-radius: var(--tp-radius-card);
	box-shadow: var(--tp-shadow);
	padding: 26px 20px 22px;
	text-align: center;
	animation: tusai-pop-in 240ms cubic-bezier(.16, 1, .3, 1);
}

/* Chiusura ------------------------------------------------------- */
.tusai-pop__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--tp-ink-soft);
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease;
}

.tusai-pop__close:hover,
.tusai-pop__close:focus-visible {
	background: #F1F0F5;
	color: var(--tp-ink);
}

.tusai-pop__close svg {
	width: 20px;
	height: 20px;
	pointer-events: none;
}

/* Testata -------------------------------------------------------- */
.tusai-pop__logo {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 64px;
	margin: 0 auto 12px;
}

.tusai-pop__title {
	margin: 0 0 8px;
	font-size: 1.375rem;
	line-height: 1.25;
	font-weight: 700;
	color: var(--tp-plum);
}

.tusai-pop__text {
	margin: 0 0 18px;
	font-size: .9375rem;
	color: var(--tp-ink);
}

/* Form ----------------------------------------------------------- */
.tusai-pop__form {
	text-align: left;
}

.tusai-pop__field {
	margin-bottom: 12px;
}

.tusai-pop__label {
	display: block;
	margin-bottom: 6px;
	font-size: .9375rem;
	font-weight: 700;
	color: var(--tp-ink);
}

.tusai-pop__req {
	color: var(--tp-coral-deep);
}

.tusai-pop__input {
	display: block;
	width: 100%;
	min-height: 50px;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 16px; /* evita lo zoom automatico su iOS */
	color: var(--tp-ink);
	background: var(--tp-field);
	border: 1.5px solid var(--tp-border);
	border-radius: var(--tp-radius-field);
	box-shadow: none;
	transition: border-color 160ms ease, box-shadow 160ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.tusai-pop__input::placeholder {
	color: #9AA3AF;
	opacity: 1;
}

.tusai-pop__input:focus {
	outline: none;
	border-color: var(--tp-plum);
	box-shadow: 0 0 0 3px rgba(107, 24, 86, .18);
}

.tusai-pop__input[aria-invalid="true"] {
	border-color: var(--tp-error);
}

.tusai-pop__hint {
	margin: 6px 0 0;
	font-size: .8125rem;
	color: var(--tp-ink-soft);
}

.tusai-pop__error {
	display: none;
	margin: 6px 0 0;
	font-size: .8125rem;
	font-weight: 700;
	color: var(--tp-error);
}

.tusai-pop__error.is-visible {
	display: block;
}

/* Consensi ------------------------------------------------------- */
.tusai-pop__consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 10px;
	padding: 10px 12px;
	border: 1.5px solid var(--tp-border);
	border-radius: var(--tp-radius-field);
	background: var(--tp-field);
	cursor: pointer;
}

.tusai-pop__consent--highlight {
	border-color: rgba(97, 200, 162, .9);
	background: rgba(97, 200, 162, .12);
}

.tusai-pop__consent input[type="checkbox"] {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin: 1px 0 0;
	accent-color: var(--tp-plum);
	cursor: pointer;
}

.tusai-pop__consent input[type="checkbox"]:focus-visible {
	outline: 3px solid rgba(107, 24, 86, .45);
	outline-offset: 2px;
}

.tusai-pop__consent span {
	font-size: .875rem;
	color: var(--tp-ink);
}

.tusai-pop__consent a {
	color: var(--tp-plum);
	text-decoration: underline;
}

/* Bottoni -------------------------------------------------------- */
.tusai-pop__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 52px;
	margin-top: 4px;
	padding: 14px 20px;
	font-family: inherit;
	font-size: 1.0625rem;
	font-weight: 700;
	color: #FFFFFF;
	background: var(--tp-plum);
	background-image: linear-gradient(135deg, var(--tp-plum) 0%, var(--tp-coral-deep) 100%);
	border: 0;
	border-radius: 30px;
	cursor: pointer;
	transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.tusai-pop__submit:hover {
	box-shadow: 0 10px 24px rgba(107, 24, 86, .3);
}

.tusai-pop__submit:active {
	transform: scale(.98);
}

.tusai-pop__submit:focus-visible {
	outline: 3px solid rgba(107, 24, 86, .5);
	outline-offset: 3px;
}

.tusai-pop__submit[disabled] {
	opacity: .6;
	cursor: not-allowed;
}

.tusai-pop__spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2.5px solid rgba(255, 255, 255, .45);
	border-top-color: #FFFFFF;
	border-radius: 50%;
	animation: tusai-spin 700ms linear infinite;
}

.tusai-pop__submit.is-loading .tusai-pop__spinner {
	display: block;
}

.tusai-pop__dismiss {
	display: block;
	width: 100%;
	margin: 12px 0 0;
	padding: 8px;
	font-family: inherit;
	font-size: .875rem;
	color: var(--tp-ink-soft);
	background: none;
	border: 0;
	text-decoration: underline;
	cursor: pointer;
}

.tusai-pop__dismiss:hover {
	color: var(--tp-ink);
}

.tusai-pop__formerror {
	display: none;
	margin: 12px 0 0;
	padding: 10px 12px;
	font-size: .875rem;
	font-weight: 700;
	color: var(--tp-error);
	background: rgba(192, 24, 47, .08);
	border-radius: 12px;
}

.tusai-pop__formerror.is-visible {
	display: block;
}

/* Schermata di conferma ------------------------------------------ */
.tusai-pop__success {
	text-align: center;
}

.tusai-pop__success[hidden] {
	display: none;
}

.tusai-pop__intro[hidden] {
	display: none;
}

.tusai-pop__check {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	margin: 4px auto 14px;
	border-radius: 50%;
	background: rgba(97, 200, 162, .18);
	color: #10715A;
}

.tusai-pop__check svg {
	width: 30px;
	height: 30px;
}

.tusai-pop__wa {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 52px;
	margin-top: 18px;
	padding: 14px 20px;
	font-size: 1.0625rem;
	font-weight: 700;
	color: #FFFFFF;
	background: var(--tp-wa);
	border-radius: 30px;
	text-decoration: none;
	transition: box-shadow 160ms ease, transform 160ms ease;
}

.tusai-pop__wa:hover,
.tusai-pop__wa:focus-visible {
	color: #FFFFFF;
	box-shadow: 0 10px 24px rgba(7, 94, 84, .32);
}

.tusai-pop__wa:active {
	transform: scale(.98);
}

.tusai-pop__wa svg {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
}

.tusai-pop__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

/* Animazioni ----------------------------------------------------- */
@keyframes tusai-pop-in {
	from {
		opacity: 0;
		transform: translateY(14px) scale(.96);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes tusai-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

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

@media (prefers-reduced-motion: reduce) {
	.tusai-pop__dialog,
	.tusai-pop__scrim {
		animation: none;
	}

	.tusai-pop__submit,
	.tusai-pop__wa,
	.tusai-pop__close,
	.tusai-pop__input {
		transition: none;
	}

	.tusai-pop__spinner {
		animation-duration: 2s;
	}
}

/* Schermi piu' grandi -------------------------------------------- */
@media (min-width: 480px) {
	.tusai-pop__dialog {
		padding: 32px 30px 28px;
	}

	.tusai-pop__title {
		font-size: 1.625rem;
	}

	.tusai-pop__logo {
		max-height: 78px;
	}

	.tusai-pop__text {
		font-size: 1rem;
	}
}

/* Schermi bassi in orizzontale ----------------------------------- */
@media (max-height: 560px) {
	.tusai-pop__logo {
		max-height: 54px;
		margin-bottom: 10px;
	}

	.tusai-pop__dialog {
		padding-top: 22px;
	}
}
