/* Barra d'acquisto nella scheda prodotto: fissa in basso, entra dal fondo. */
.ndp-ba {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1030;
	box-sizing: border-box;
	padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
	background: #0b4d4a;
	border-top: 1px solid rgba(250, 248, 241, 0.35);
	box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
	color: #fff;
	transform: translateY(110%);
	transition: transform 0.25s ease;
}

/*
 * Agli utenti loggati WordPress carica wp-components, con
 * [role="region"] { position: relative }: stessa specificità di .ndp-ba e
 * caricato dopo, annullava la posizione fissa (la barra finiva in fondo alla pagina).
 */
.ndp-ba[data-ndp-ba] {
	position: fixed;
}

.ndp-ba.is-on {
	transform: none;
}

.ndp-ba__in {
	display: flex;
	align-items: center;
	gap: 16px;
	max-width: 1140px;
	margin: 0 auto;
}

.ndp-ba .ndp-ba__img {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.06);
	object-fit: contain;
}

.ndp-ba__info {
	flex: 1 1 auto;
	min-width: 0;
}

/* Il tema colora i paragrafi di grigio: qui servono chiari sul verde. */
.ndp-ba .ndp-ba__title {
	margin: 0;
	overflow: hidden;
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

.ndp-ba .ndp-ba__price {
	margin: 2px 0 0;
	color: #fff;
	font-size: 1rem;
	line-height: 1.2;
}

.ndp-ba .ndp-ba__price del {
	margin-right: 6px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.85em;
}

.ndp-ba .ndp-ba__price ins {
	background: none;
	color: #fff;
	text-decoration: none;
}

.ndp-ba__qty {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	background: #faf8f1;
	color: #0b4d4a;
}

.ndp-ba .ndp-ba__qty button {
	width: 34px;
	height: 40px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #0b4d4a;
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
}

.ndp-ba .ndp-ba__qty input {
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #0b4d4a;
	font-size: 1rem;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.ndp-ba .ndp-ba__qty input::-webkit-outer-spin-button,
.ndp-ba .ndp-ba__qty input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

/* Come il pulsante "Aggiungi al carrello" del tema: scuro, maiuscolo, spaziato. */
.ndp-ba .ndp-ba__add {
	flex: 0 0 auto;
	margin: 0;
	padding: 12px 26px;
	border: 0;
	border-radius: 3px;
	background: #333;
	color: #fff;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 400;
	letter-spacing: 1px;
	line-height: 1.2;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.2s ease;
}

.ndp-ba .ndp-ba__add:hover {
	background: #161615;
}

.ndp-ba .ndp-ba__add.is-busy {
	opacity: 0.6;
	cursor: progress;
}

.ndp-ba button:focus-visible,
.ndp-ba input:focus-visible {
	outline: 2px solid #faf8f1;
	outline-offset: 2px;
}

/* Il fondo pagina non resta nascosto sotto la barra. */
body.ndp-ba-on {
	padding-bottom: var(--ndp-ba-h, 80px);
}

/*
 * Con la barra visibile, il pulsante delle preferenze cookie di iubenda (fisso
 * in basso a destra, sopra tutto) coprirebbe "Aggiungi": sale sopra la barra.
 * La freccia "torna su" del tema sale sopra iubenda, con lo stesso stacco di
 * 24 px che ha senza barra.
 */
/* Selettore lungo di proposito: iubenda fissa la posizione con regole molto specifiche e !important. */
html body.ndp-ba-on button.iubenda-tp-btn.iubenda-cs-preferences-link[data-tp-float][data-tp-float="bottom-right"] {
	bottom: var(--ndp-ba-h, 80px) !important;
	transition: bottom 0.25s ease;
}

html body.ndp-ba-on .derbe-top {
	bottom: calc(var(--ndp-ba-h, 80px) + 78px);
}

@media (max-width: 575.98px) {
	.ndp-ba {
		padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
	}

	.ndp-ba__in {
		gap: 10px;
	}

	.ndp-ba .ndp-ba__img {
		width: 44px;
		height: 44px;
	}

	/* Su telefono il nome va su due righe invece di tagliarsi dopo poche lettere. */
	.ndp-ba .ndp-ba__title {
		display: -webkit-box;
		font-size: 0.74rem;
		line-height: 1.25;
		white-space: normal;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}

	/* Prezzo su una riga anche quando c'è quello barrato. */
	.ndp-ba .ndp-ba__price {
		font-size: 0.9rem;
		white-space: nowrap;
	}

	.ndp-ba .ndp-ba__price del {
		margin-right: 4px;
		font-size: 0.75em;
	}

	.ndp-ba .ndp-ba__qty button {
		width: 28px;
		height: 38px;
	}

	.ndp-ba .ndp-ba__qty input {
		width: 28px;
		height: 38px;
	}

	.ndp-ba .ndp-ba__long {
		display: none;
	}

	.ndp-ba .ndp-ba__add {
		padding: 11px 14px;
		font-size: 0.85rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ndp-ba {
		transition: none;
	}
}
