/**
 * Ajout au panier depuis une liste de produits (16/10/2026)
 * -----------------------------------------------------------------------------
 * Accueil, catégories, recherche, produits associés : le bouton confirme
 * l'ajout lui-même, et un encart récapitule le produit ajouté et le panier.
 * Le lien « Voir le panier » que WooCommerce glisse sous le bouton est masqué :
 * l'encart le propose déjà, et il décalait la grille.
 */

/* Le lien ajouté par WooCommerce sous le bouton. */
.rn-ajout-liste ~ .added_to_cart,
.rn-ajout-liste + .added_to_cart { display: none !important; }

/* ---------------------------------------------------------------------------
 * Bouton : en cours, puis ajouté
 * ------------------------------------------------------------------------ */
/* Le texte garde sa couleur au repos pendant le chargement (relevée par le
   script) : certains boutons le rendaient presque transparent. */
.rn-ajout-liste.rn-ajout-liste[aria-busy="true"],
.rn-ajout-liste.rn-ajout-liste.loading {
	opacity: 1 !important;
	color: var(--rn-ajout-couleur, inherit) !important;
	-webkit-text-fill-color: var(--rn-ajout-couleur, currentColor) !important;
	cursor: progress;
}

/* Fiche produit : le thème pose un voile blanc sur le formulaire pendant
   l'envoi. Le bouton montre déjà l'attente : le voile reste, invisible, pour
   empêcher un double envoi. */
form.cart:has(.rn-ajout-liste[aria-busy="true"]) .blockUI.blockOverlay { background: transparent !important; opacity: 0 !important; }
.rn-ajout-liste.rn-ajout-liste.loading::after { display: none !important; }

.rn-ajout-liste.rn-ajout-liste .rn-ajout-ico {
	display: inline-block;
	flex: none;
	width: 16px;
	height: 16px;
	margin-right: 8px;
	vertical-align: -3px;
}

.rn-ajout-liste.rn-ajout-liste .rn-ajout-roue {
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: rn-ajout-tourne .7s linear infinite;
}

@keyframes rn-ajout-tourne { to { transform: rotate(360deg); } }

/* Même vert que la confirmation des cartes de la boutique. */
.rn-ajout-liste.rn-ajout-liste.rn-ajout-fait,
.rn-ajout-liste.rn-ajout-liste.rn-ajout-fait:hover,
.rn-ajout-liste.rn-ajout-liste.rn-ajout-fait:focus {
	background: #E8F6EF !important;
	border-color: #0E7C4A !important;
	box-shadow: inset 0 0 0 1px #0E7C4A !important;
	color: #0E7C4A !important;
}

/* ---------------------------------------------------------------------------
 * Encart de confirmation
 * ------------------------------------------------------------------------ */
.rn-confirm {
	position: fixed;
	top: 24px;
	right: clamp(12px, 2vw, 28px);
	z-index: 100000;
	width: 380px;
	max-width: calc(100vw - 24px);
	overflow: hidden;
	background: #FFFFFF;
	border: 1px solid #E3E6ED;
	border-radius: 16px;
	box-shadow: 0 24px 48px -12px rgba(26, 29, 62, .24), 0 4px 10px rgba(26, 29, 62, .06);
	color: #1A1D3E;
	font-family: 'Fredoka', system-ui, -apple-system, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	text-align: left;
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity 180ms ease, transform 220ms ease;
}

body.admin-bar .rn-confirm { top: 56px; }

.rn-confirm.is-visible { opacity: 1; transform: none; }
.rn-confirm[hidden] { display: none; }

.rn-confirm p { margin: 0; padding: 0; }

/* Temps restant avant fermeture automatique. */
.rn-confirm-temps { height: 3px; background: #0E7C4A; transform-origin: left; }
.rn-confirm.is-visible .rn-confirm-temps { animation: rn-confirm-temps var(--rn-confirm-duree, 6000ms) linear forwards; }
.rn-confirm.is-pause .rn-confirm-temps { animation-play-state: paused; }

@keyframes rn-confirm-temps { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.rn-confirm-tete {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 10px 12px 18px;
	background: #E8F6EF;
	color: #0E7C4A;
	font-size: 15px;
	font-weight: 600;
}

.rn-confirm-tete svg { flex: none; }

.rn-confirm button.rn-confirm-fermer {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0 0 0 auto;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 8px;
	box-shadow: none;
	color: #3A4059;
	font-size: 24px;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
}

.rn-confirm button.rn-confirm-fermer:hover { background: rgba(14, 124, 74, .1); color: #1A1D3E; }

.rn-confirm-produit {
	display: flex;
	gap: 14px;
	padding: 16px 18px;
	border-bottom: 1px solid #E3E6ED;
}

.rn-confirm-img {
	flex: none;
	width: 72px;
	height: 72px;
	padding: 6px;
	background: #F7F5F2;
	border-radius: 12px;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.rn-confirm-info { min-width: 0; }

.rn-confirm-ref {
	margin-bottom: 2px !important;
	color: #5B6178;
	font-size: 12px;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.rn-confirm-nom {
	display: -webkit-box;
	overflow: hidden;
	color: #1A1D3E;
	font-size: 15px;
	font-weight: 500;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.rn-confirm-qte { margin-top: 6px !important; color: #5B6178; font-size: 13px; }
.rn-confirm-qte .woocommerce-Price-amount { color: #1A1D3E; font-weight: 600; }
.rn-confirm-qte small { font-size: 11px; }

.rn-confirm-total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px 2px;
	color: #3A4059;
	font-size: 14px;
}

.rn-confirm-montant { color: #1A1D3E; font-size: 18px; font-weight: 600; white-space: nowrap; }
.rn-confirm-montant small { color: #5B6178; font-size: 12px; font-weight: 500; }

.rn-confirm-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	padding: 12px 18px 8px;
}

.rn-confirm-actions a {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 12px;
	border: 1px solid transparent;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	text-decoration: none !important;
	transition: background-color 160ms, border-color 160ms;
}

.rn-confirm-actions .rn-confirm-voir { background: #FFFFFF; border-color: #CBD1DC; color: #1A1D3E; }
.rn-confirm-actions .rn-confirm-voir:hover { background: #F5F5F7; border-color: #1A1D3E; color: #1A1D3E; }

/* Même bouton principal que la fiche produit. */
.rn-confirm-actions .rn-confirm-commander { background: #FD604F; border-color: #E45444; color: #1A1D3E; }
.rn-confirm-actions .rn-confirm-commander:hover { background: #E45444; border-color: #CA4A3C; color: #1A1D3E; }

.rn-confirm-actions--seul { grid-template-columns: 1fr; }

/* Erreur : même encart, en rouge. */
.rn-confirm.is-erreur .rn-confirm-temps { background: #B42318; }
.rn-confirm.is-erreur .rn-confirm-tete { background: #FDECEA; color: #B42318; }
.rn-confirm.is-erreur button.rn-confirm-fermer:hover { background: rgba(180, 35, 24, .1); }

.rn-confirm-message { padding: 16px 18px 4px; color: #1A1D3E; font-size: 15px; line-height: 1.5; }
.rn-confirm-message p + p { margin-top: 8px !important; }

.rn-confirm button.rn-confirm-continuer {
	display: block;
	width: 100%;
	margin: 0;
	padding: 8px 18px 16px;
	background: none;
	border: 0;
	color: #3A4059;
	font-family: inherit;
	font-size: 14px;
	text-align: center;
	border-radius: 0;
	box-shadow: none;
	font-weight: 400;
	line-height: 1.4;
	text-transform: none;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.rn-confirm button.rn-confirm-continuer:hover { background: none; color: #1A1D3E; }

.rn-confirm :focus-visible { outline: 2px solid #1A1D3E; outline-offset: 2px; }

/* Le bouton « haut de page » du thème ne passe pas sur l'encart. */
body.rn-confirm-ouvert #btn-to-top { opacity: 0 !important; pointer-events: none !important; }

/* Mobile : feuille posée en bas de l'écran, à portée du pouce. */
@media (max-width: 640px) {
	.rn-confirm,
	body.admin-bar .rn-confirm {
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		max-width: none;
		border-radius: 20px 20px 0 0;
		border-bottom: 0;
		padding-bottom: env(safe-area-inset-bottom, 0);
		transform: translateY(16px);
	}
	.rn-confirm.is-visible { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.rn-confirm { transition-duration: 1ms; transform: none; }
	.rn-confirm-temps { display: none; }
	.rn-ajout-liste.rn-ajout-liste .rn-ajout-roue { animation-duration: 2s; }
}
