/**
 * WAYT MailUp Connect — frontend.
 * Tutto pilotato da custom properties: il tema può sovrascrivere
 * qualsiasi cosa senza toccare questo file.
 */

.wmuc {
	--wmuc-pad: 28px;
	font-family: inherit;
	color: var( --wmuc-text );
	box-sizing: border-box;
}

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

/*
 * L'attributo hidden vale solo quanto la regola dello user-agent
 * [hidden]{display:none}, che perde contro qualsiasi classe con display.
 * Senza questa riga il riquadro del codice sconto compariva vuoto quando
 * non c'era nessun codice, e nella top bar il form restava visibile sotto
 * al messaggio di conferma. Nascosto deve voler dire nascosto.
 */
.wmuc[hidden],
.wmuc [hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------- */
/* Modale                                                           */
/* ---------------------------------------------------------------- */

.wmuc--modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	visibility: hidden;
	transition: opacity .28s ease, visibility .28s ease;
}

.wmuc--modal.is-open {
	opacity: 1;
	visibility: visible;
}

.wmuc__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, var( --wmuc-overlay ) );
	backdrop-filter: blur( 2px );
}

.wmuc--modal .wmuc__panel {
	position: relative;
	width: 100%;
	max-width: var( --wmuc-width );
	max-height: calc( 100vh - 32px );
	overflow-y: auto;
	background: var( --wmuc-bg );
	border-radius: var( --wmuc-radius );
	box-shadow: 0 24px 60px -12px rgba( 0, 0, 0, .35 );
	transform: translateY( 14px ) scale( .98 );
	transition: transform .28s cubic-bezier( .16, 1, .3, 1 );
}

.wmuc--modal.is-open .wmuc__panel {
	transform: none;
}

.wmuc--pos-bottom-right { align-items: flex-end; justify-content: flex-end; }
.wmuc--pos-bottom-left  { align-items: flex-end; justify-content: flex-start; }

.wmuc--pos-bottom-right .wmuc__overlay,
.wmuc--pos-bottom-left .wmuc__overlay {
	background: transparent;
	backdrop-filter: none;
	pointer-events: none;
}

/* Immagine laterale */
.wmuc--img-left .wmuc__panel {
	display: grid;
	grid-template-columns: 40% 1fr;
}

.wmuc__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wmuc--img-top .wmuc__media img {
	max-height: 190px;
	border-radius: var( --wmuc-radius ) var( --wmuc-radius ) 0 0;
}

.wmuc--img-left .wmuc__media img {
	border-radius: var( --wmuc-radius ) 0 0 var( --wmuc-radius );
}

.wmuc__body { padding: var( --wmuc-pad ); }

/* ---------------------------------------------------------------- */
/* Top bar                                                          */
/* ---------------------------------------------------------------- */

.wmuc--topbar {
	position: relative;
	z-index: 9999;
	width: 100%;
	background: var( --wmuc-accent );
	color: var( --wmuc-accent-text );
	max-height: 0;
	overflow: hidden;
	transition: max-height .35s ease;
}

.wmuc--topbar.is-open { max-height: 260px; }

.wmuc--topbar .wmuc__panel {
	max-width: 1200px;
	margin: 0 auto;
	position: relative;
}

.wmuc--topbar .wmuc__body {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	flex-wrap: wrap;
	padding: 12px 46px;
}

.wmuc--topbar .wmuc__title {
	font-size: 16px;
	margin: 0;
	color: var( --wmuc-accent-text );
}

.wmuc--topbar .wmuc__sub {
	margin: 0;
	font-size: 14px;
	opacity: .9;
}

.wmuc--topbar .wmuc__view[data-view="form"] {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	justify-content: center;
	width: 100%;
}

.wmuc--topbar .wmuc__form {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.wmuc--topbar .wmuc__fields {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.wmuc--topbar .wmuc__label { display: none; }

.wmuc--topbar .wmuc__check span,
.wmuc--topbar .wmuc__check a { color: var( --wmuc-accent-text ); }

.wmuc--topbar .wmuc__check { font-size: 12px; max-width: 320px; }

.wmuc--topbar .wmuc__submit {
	background: var( --wmuc-bg );
	color: var( --wmuc-accent );
	margin: 0;
	white-space: nowrap;
}

/* ---------------------------------------------------------------- */
/* Contenuti                                                        */
/* ---------------------------------------------------------------- */

.wmuc__title {
	margin: 0 0 8px;
	font-size: 24px;
	line-height: 1.25;
	font-weight: 700;
	color: inherit;
}

.wmuc__sub {
	margin: 0 0 18px;
	font-size: 15px;
	line-height: 1.5;
	opacity: .8;
}

.wmuc__fields { display: grid; gap: 12px; }

.wmuc__field { display: block; }

.wmuc__label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 5px;
}

.wmuc__field input {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	line-height: 1.3;
	border: 1px solid rgba( 0, 0, 0, .18 );
	border-radius: calc( var( --wmuc-radius ) / 2 );
	background: #fff;
	color: #1a1a1a;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.wmuc__field input:focus {
	outline: none;
	border-color: var( --wmuc-accent );
	box-shadow: 0 0 0 3px color-mix( in srgb, var( --wmuc-accent ) 22%, transparent );
}

.wmuc__check {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin-top: 14px;
	font-size: 13px;
	line-height: 1.45;
}

.wmuc__check input {
	flex: 0 0 auto;
	margin-top: 2px;
	width: 16px;
	height: 16px;
	accent-color: var( --wmuc-accent );
}

.wmuc__check a { color: inherit; text-decoration: underline; }

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

.wmuc__submit {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	margin-top: 18px;
	padding: 13px 22px;
	font-size: 15px;
	font-weight: 600;
	color: var( --wmuc-accent-text );
	background: var( --wmuc-accent );
	border: 0;
	border-radius: calc( var( --wmuc-radius ) / 2 );
	cursor: pointer;
	transition: filter .15s ease, transform .12s ease;
}

.wmuc__submit:hover:not( :disabled ) { filter: brightness( 1.08 ); }
.wmuc__submit:active:not( :disabled ) { transform: translateY( 1px ); }
.wmuc__submit:disabled { cursor: wait; }

.wmuc__spinner {
	width: 15px;
	height: 15px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: wmuc-spin .7s linear infinite;
}

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

.wmuc__error {
	margin: 12px 0 0;
	font-size: 13px;
	color: #b42318;
	font-weight: 500;
}

.wmuc__close {
	position: absolute;
	top: 8px;
	right: 10px;
	z-index: 2;
	width: 32px;
	height: 32px;
	font-size: 24px;
	line-height: 1;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	opacity: .55;
	transition: opacity .15s ease;
}

.wmuc__close:hover { opacity: 1; }

.wmuc--img-top .wmuc__close,
.wmuc--img-left .wmuc__close {
	color: #fff;
	text-shadow: 0 1px 3px rgba( 0, 0, 0, .5 );
}

/* Coupon */

.wmuc__coupon {
	display: flex;
	align-items: stretch;
	gap: 8px;
	margin: 18px 0 10px;
}

.wmuc__code {
	flex: 1;
	padding: 14px 16px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 19px;
	font-weight: 700;
	letter-spacing: .06em;
	text-align: center;
	color: var( --wmuc-accent );
	background: color-mix( in srgb, var( --wmuc-accent ) 10%, transparent );
	border: 1px dashed var( --wmuc-accent );
	border-radius: calc( var( --wmuc-radius ) / 2 );
}

.wmuc__copy {
	padding: 0 18px;
	font-size: 14px;
	font-weight: 600;
	color: var( --wmuc-accent-text );
	background: var( --wmuc-accent );
	border: 0;
	border-radius: calc( var( --wmuc-radius ) / 2 );
	cursor: pointer;
}

.wmuc__hint { margin: 0; font-size: 13px; opacity: .75; }

/* ---------------------------------------------------------------- */
/* Mobile                                                           */
/* ---------------------------------------------------------------- */

@media ( max-width: 600px ) {
	.wmuc { --wmuc-pad: 22px; }

	.wmuc--modal { align-items: flex-end; padding: 0; }

	.wmuc--modal .wmuc__panel {
		max-width: 100%;
		max-height: 92vh;
		border-radius: var( --wmuc-radius ) var( --wmuc-radius ) 0 0;
		transform: translateY( 100% );
	}

	.wmuc--modal.is-open .wmuc__panel { transform: none; }

	.wmuc--img-left .wmuc__panel { grid-template-columns: 1fr; }
	.wmuc--img-left .wmuc__media img { max-height: 150px; border-radius: var( --wmuc-radius ) var( --wmuc-radius ) 0 0; }

	.wmuc__title { font-size: 20px; }

	.wmuc--topbar .wmuc__body { padding: 12px 40px; gap: 10px; }
	.wmuc--topbar .wmuc__form { width: 100%; flex-direction: column; align-items: stretch; }
	.wmuc--topbar .wmuc__submit { width: 100%; }
	.wmuc--topbar.is-open { max-height: 400px; }
}

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

/* ---------------------------------------------------------------- */
/* Formattazione dei testi                                          */
/* ---------------------------------------------------------------- */

.wmuc--align-center .wmuc__title,
.wmuc--align-center .wmuc__sub,
.wmuc--align-center .wmuc__hint,
.wmuc--align-center .wmuc__error {
	text-align: center;
}

/* I campi restano allineati a sinistra anche col testo centrato:
   etichette e checkbox centrate si leggono male. */
.wmuc--align-center .wmuc__field,
.wmuc--align-center .wmuc__check {
	text-align: left;
}

.wmuc .wmuc-hl {
	color: var( --wmuc-accent );
	font-weight: 700;
}

/* Nella top bar l'accento è il colore di sfondo: evidenziare con
   quello renderebbe il testo invisibile. */
.wmuc--topbar .wmuc-hl {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.wmuc__title a,
.wmuc__sub a,
.wmuc__hint a {
	color: inherit;
	text-decoration: underline;
}

.wmuc__title br,
.wmuc__sub br {
	line-height: inherit;
}
