/**
 * SP Pneus — Pop-up de confirmation d'ajout au panier.
 * Chargée uniquement sur les fiches produit.
 */

.sp-cart-popup {
	--sp-green: #92c12a;
	--sp-green-dark: #7faa20;
	--sp-text: #000000;
	--sp-muted: #7a7a7a;
	--sp-border: #dcdfe4;
	--sp-surface: #f6f6f8;

	position: fixed;
	z-index: 999999;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sp-cart-popup[hidden] {
	display: none;
}

.sp-cart-popup__overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: rgba( 0, 0, 0, 0.45 );
	opacity: 0;
	transition: opacity 0.2s ease;
}

.sp-cart-popup.is-open .sp-cart-popup__overlay {
	opacity: 1;
}

.sp-cart-popup__box {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 420px;
	max-height: calc( 100vh - 40px );
	overflow-y: auto;
	padding: 26px 24px 22px;
	border-radius: 14px;
	background-color: #ffffff;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.18 );
	color: var( --sp-text );
	text-align: left;
	opacity: 0;
	transform: translateY( 12px ) scale( 0.98 );
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.sp-cart-popup.is-open .sp-cart-popup__box {
	opacity: 1;
	transform: translateY( 0 ) scale( 1 );
}

/* --- Bouton de fermeture --- */

.sp-cart-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var( --sp-muted );
	cursor: pointer;
	line-height: 1;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.sp-cart-popup__close:hover,
.sp-cart-popup__close:focus-visible {
	background-color: var( --sp-surface );
	color: var( --sp-text );
}

.sp-cart-popup__close svg {
	width: 14px;
	height: 14px;
}

/* --- En-tête --- */

.sp-cart-popup__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-right: 30px;
}

.sp-cart-popup__check {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background-color: var( --sp-green );
	color: #ffffff;
}

.sp-cart-popup__check svg {
	width: 17px;
	height: 17px;
}

.sp-cart-popup__title {
	margin: 0;
	color: var( --sp-text );
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
}

/* --- Récapitulatif produit --- */

.sp-cart-popup__product {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 18px 0;
	padding: 12px;
	border: 1px solid var( --sp-border );
	border-radius: 10px;
	background-color: var( --sp-surface );
}

.sp-cart-popup__img {
	flex: 0 0 auto;
	width: 64px;
	height: 64px;
	border-radius: 8px;
	background-color: #ffffff;
	object-fit: contain;
}

.sp-cart-popup__img[hidden] {
	display: none;
}

.sp-cart-popup__infos {
	min-width: 0;
	flex: 1 1 auto;
}

.sp-cart-popup__name {
	margin: 0 0 6px;
	color: var( --sp-text );
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.sp-cart-popup__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 10px;
	margin: 0;
	color: var( --sp-muted );
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
}

.sp-cart-popup__total {
	color: var( --sp-green-dark );
	font-size: 14px;
	font-weight: 700;
}

/* --- Actions --- */

.sp-cart-popup__actions {
	display: flex;
	gap: 10px;
}

.sp-cart-popup__btn {
	display: flex;
	flex: 1 1 0;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 46px;
	padding: 0 14px;
	border: 1px solid transparent;
	border-radius: 10px;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sp-cart-popup__btn--ghost {
	border-color: var( --sp-border );
	background-color: #ffffff;
	color: var( --sp-text );
}

.sp-cart-popup__btn--ghost:hover,
.sp-cart-popup__btn--ghost:focus-visible {
	border-color: var( --sp-green );
	color: var( --sp-green-dark );
}

.sp-cart-popup__btn--primary,
.sp-cart-popup__btn--primary:visited {
	background-color: var( --sp-green );
	color: #ffffff;
}

.sp-cart-popup__btn--primary:hover,
.sp-cart-popup__btn--primary:focus-visible {
	background-color: var( --sp-green-dark );
	color: #ffffff;
}

.sp-cart-popup__btn:focus-visible,
.sp-cart-popup__close:focus-visible {
	outline: 2px solid var( --sp-green-dark );
	outline-offset: 2px;
}

/* --- Blocage du défilement de la page --- */

body.sp-cart-popup-open {
	overflow: hidden;
}

/* --- Bouton « Ajouter au panier » pendant la requête --- */

.single_add_to_cart_button.sp-is-loading {
	opacity: 0.6;
	cursor: wait;
}

/* --- Mobile : feuille ancrée en bas d'écran --- */

@media screen and ( max-width: 600px ) {
	.sp-cart-popup {
		align-items: flex-end;
		padding: 0;
	}

	.sp-cart-popup__box {
		max-width: none;
		max-height: 88vh;
		padding: 22px 18px calc( 18px + env( safe-area-inset-bottom ) );
		border-radius: 16px 16px 0 0;
		transform: translateY( 100% );
	}

	.sp-cart-popup.is-open .sp-cart-popup__box {
		transform: translateY( 0 );
	}

	.sp-cart-popup__actions {
		flex-direction: column;
	}

	.sp-cart-popup__btn {
		width: 100%;
	}
}

/* --- Accessibilité : animations réduites --- */

@media ( prefers-reduced-motion: reduce ) {
	.sp-cart-popup__overlay,
	.sp-cart-popup__box {
		transition: none;
	}

	.sp-cart-popup__box,
	.sp-cart-popup.is-open .sp-cart-popup__box {
		transform: none;
	}
}
