/**
 * LDDP – Popup panier
 * Palette « Décision / achat » (contexte d'achat, donc palette claire).
 *
 * Les valeurs hexadécimales sont écrites en dur : les couleurs globales de
 * Divi 5 sont exposées sous des identifiants hachés (--gcid-xxxxx) qui ne sont
 * pas adressables depuis un plugin.
 *
 * Les variables ci-dessous sont locales au composant et surchargeables :
 *   .lddp-pp { --lddp-pp-accent: #B5581E; }
 */

/* Les valeurs de repli reprennent la palette « Décision ». Si les variables
   globales du site sont déclarées (bloc :root du CSS personnalisé Divi), la
   popup les suit automatiquement : une seule source pour la palette. */
.lddp-pp {
	--lddp-pp-fond: var(--lddp-paper, #F3EDE1);
	--lddp-pp-surface: var(--lddp-card, #FBF7EE);
	--lddp-pp-bordure: var(--lddp-border, #E4DBC9);
	--lddp-pp-texte: var(--lddp-ink, #221D18);
	--lddp-pp-texte-2: var(--lddp-ink-muted, #7A7166);
	--lddp-pp-accent: var(--lddp-accent, #8C3B2E);
	--lddp-pp-accent-survol: var(--lddp-accent-2, #B5581E);

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
}

.lddp-pp[hidden] {
	display: none;
}

/* --- Voile ------------------------------------------------------------ */

.lddp-pp__voile {
	position: absolute;
	inset: 0;
	background: rgba(18, 16, 14, 0.62);
	opacity: 0;
	transition: opacity 0.22s ease;
}

.lddp-pp.est-ouverte .lddp-pp__voile {
	opacity: 1;
}

/* --- Boîte ------------------------------------------------------------ */

.lddp-pp__boite {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	padding: 30px 30px 26px;
	background: var(--lddp-pp-surface);
	border: 1px solid var(--lddp-pp-bordure);
	border-radius: 10px;
	box-shadow: 0 18px 48px rgba(18, 16, 14, 0.28);
	color: var(--lddp-pp-texte);
	opacity: 0;
	transform: translateY(14px) scale(0.98);
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.lddp-pp.est-ouverte .lddp-pp__boite {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.lddp-pp__fermer {
	position: absolute;
	top: 14px;
	right: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
	color: var(--lddp-pp-texte-2);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.lddp-pp__fermer:hover {
	color: var(--lddp-pp-texte);
	border-color: var(--lddp-pp-bordure);
	background: var(--lddp-pp-fond);
}

/* --- Accroche --------------------------------------------------------- */

.lddp-pp__eyebrow {
	margin: 0 0 18px;
	padding: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--lddp-pp-accent);
}

/* --- Article ajouté --------------------------------------------------- */

.lddp-pp__article {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	padding-bottom: 22px;
	border-bottom: 1px solid var(--lddp-pp-bordure);
}

.lddp-pp__visuel {
	flex-shrink: 0;
	width: 78px;
	height: 78px;
	object-fit: cover;
	border: 1px solid var(--lddp-pp-bordure);
	border-radius: 6px;
	background: var(--lddp-pp-fond);
}

.lddp-pp__detail {
	min-width: 0;
	flex: 1;
}

.lddp-pp__nom {
	margin: 0 0 4px;
	padding: 0;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--lddp-pp-texte);
}

.lddp-pp__version,
.lddp-pp__quantite {
	margin: 0;
	padding: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--lddp-pp-texte-2);
}

.lddp-pp__prix {
	margin: 8px 0 0;
	padding: 0;
	font-size: 20px;
	font-weight: 700;
	color: var(--lddp-pp-texte);
}

.lddp-pp__prix .amount,
.lddp-pp__prix bdi {
	color: inherit;
}

/* --- Actions ---------------------------------------------------------- */

.lddp-pp__actions {
	display: flex;
	gap: 10px;
	margin-top: 22px;
}

.lddp-pp__btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 16px;
	border: 1px solid var(--lddp-pp-bordure);
	border-radius: 6px;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lddp-pp__btn--fantome {
	background: transparent;
	color: var(--lddp-pp-texte-2);
}

.lddp-pp__btn--fantome:hover {
	border-color: var(--lddp-pp-texte-2);
	color: var(--lddp-pp-texte);
}

.lddp-pp__btn--plein {
	background: var(--lddp-pp-accent);
	border-color: var(--lddp-pp-accent);
	color: var(--lddp-pp-surface);
}

.lddp-pp__btn--plein:hover {
	background: var(--lddp-pp-accent-survol);
	border-color: var(--lddp-pp-accent-survol);
	color: var(--lddp-pp-surface);
}

/* --- Ventes croisées -------------------------------------------------- */

.lddp-pp__croisees {
	margin-top: 26px;
	padding-top: 22px;
	border-top: 1px solid var(--lddp-pp-bordure);
}

.lddp-pp__croisees[hidden] {
	display: none;
}

.lddp-pp__croisees-titre {
	margin: 0 0 14px;
	padding: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--lddp-pp-texte-2);
}

.lddp-pp__liste {
	margin: 0;
	padding: 0;
	list-style: none;
}

.lddp-pp__suggestion {
	display: flex;
	gap: 12px;
	align-items: center;
	margin: 0 0 10px;
	padding: 10px;
	border: 1px solid var(--lddp-pp-bordure);
	border-radius: 8px;
	background: var(--lddp-pp-fond);
	transition: border-color 0.2s ease;
}

.lddp-pp__suggestion:last-child {
	margin-bottom: 0;
}

.lddp-pp__suggestion:hover {
	border-color: var(--lddp-pp-accent);
}

.lddp-pp__suggestion-visuel {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 4px;
	background: var(--lddp-pp-surface);
}

.lddp-pp__suggestion-detail {
	min-width: 0;
	flex: 1;
}

.lddp-pp__suggestion-nom {
	display: block;
	font-size: 14px;
	line-height: 1.3;
	color: var(--lddp-pp-texte);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lddp-pp__suggestion-nom:hover {
	color: var(--lddp-pp-accent);
}

.lddp-pp__suggestion-prix {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: var(--lddp-pp-texte-2);
}

.lddp-pp__suggestion-prix .amount,
.lddp-pp__suggestion-prix bdi,
.lddp-pp__suggestion-prix del,
.lddp-pp__suggestion-prix ins {
	color: inherit;
	text-decoration: inherit;
}

.lddp-pp__suggestion-action {
	flex-shrink: 0;
	padding: 8px 14px;
	border: 1px solid var(--lddp-pp-accent);
	border-radius: 5px;
	background: transparent;
	color: var(--lddp-pp-accent);
	font-family: inherit;
	font-size: 12px;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lddp-pp__suggestion-action:hover {
	background: var(--lddp-pp-accent);
	color: var(--lddp-pp-surface);
}

.lddp-pp__suggestion-action[disabled] {
	border-color: var(--lddp-pp-bordure);
	background: transparent;
	color: var(--lddp-pp-texte-2);
	cursor: default;
}

/* --- Erreur ----------------------------------------------------------- */

.lddp-pp__erreur {
	margin: 18px 0 0;
	padding: 12px 14px;
	border: 1px solid var(--lddp-pp-accent);
	border-radius: 6px;
	background: var(--lddp-pp-fond);
	font-size: 14px;
	line-height: 1.45;
	color: var(--lddp-pp-accent);
}

.lddp-pp__erreur[hidden] {
	display: none;
}

/* --- Focus visible ---------------------------------------------------- */

.lddp-pp__fermer:focus-visible,
.lddp-pp__btn:focus-visible,
.lddp-pp__suggestion-action:focus-visible,
.lddp-pp__suggestion-nom:focus-visible {
	outline: 2px solid var(--lddp-pp-accent);
	outline-offset: 2px;
}

/* --- Bouton d'ajout en cours d'envoi ---------------------------------- */

.lddp-pp-en-cours {
	opacity: 0.6;
	pointer-events: none;
}

/* --- Verrou de défilement du document -------------------------------- */

html.lddp-pp-verrou,
html.lddp-pp-verrou body {
	overflow: hidden;
}

/* --- Mobile ----------------------------------------------------------- */

@media (max-width: 600px) {
	.lddp-pp {
		padding: 0;
		align-items: flex-end;
	}

	.lddp-pp__boite {
		max-width: none;
		max-height: 92vh;
		padding: 26px 20px 22px;
		border-radius: 12px 12px 0 0;
		border-bottom: none;
	}

	.lddp-pp.est-ouverte .lddp-pp__boite {
		transform: translateY(0);
	}

	.lddp-pp__actions {
		flex-direction: column;
	}

	.lddp-pp__suggestion-action {
		padding: 8px 10px;
	}
}

/* --- Mouvement réduit ------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.lddp-pp__voile,
	.lddp-pp__boite {
		transition: opacity 0.15s ease;
		transform: none;
	}

	.lddp-pp.est-ouverte .lddp-pp__boite {
		transform: none;
	}
}
