/* =========================================================
   BlogCourseaPied Affiliate Blocks — Styles front-end
   Design : comparateur éditorial en deux colonnes (image | offres),
   lignes marchand en pilules avec bouton d'action à chevron.
   Toutes les couleurs viennent des variables CSS injectées inline
   par PHP (voir includes/class-render.php) afin de rester
   personnalisables depuis Réglages sans recompiler de CSS.
   ========================================================= */

.bcpa-block {
	--bcpa-primary: #2f6b45;
	--bcpa-button: #2f6b45;
	--bcpa-text: #1f2a24;
	--bcpa-bg: #ffffff;
	--bcpa-border: #e2e5e3;
	--bcpa-radius: 10px;
	--bcpa-badge: #2f6b45;

	box-sizing: border-box;
	display: flex;
	align-items: flex-start;
	gap: 28px;
	background: #f7f8f7;
	border: 1px solid var( --bcpa-border );
	border-radius: calc( var( --bcpa-radius ) + 6px );
	box-shadow: 0 1px 3px rgba( 20, 30, 24, 0.04 );
	padding: 24px;
	margin: 24px 0;
	color: var( --bcpa-text );
	font-family: inherit;
	max-width: 100%;
}

.bcpa-block *,
.bcpa-block *::before,
.bcpa-block *::after {
	box-sizing: border-box;
}

.bcpa-block .bcpa-media {
	flex: 0 0 38%;
	max-width: 340px;
	background: #ffffff;
	border: 1px solid var( --bcpa-border );
	border-radius: var( --bcpa-radius );
	padding: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

.bcpa-block .bcpa-product-image {
	max-width: 100%;
	max-height: 100%;
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.bcpa-content {
	flex: 1 1 auto;
	min-width: 0;
}

.bcpa-category-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var( --bcpa-badge );
	background: color-mix( in srgb, var( --bcpa-badge ) 10%, white );
	padding: 3px 9px;
	border-radius: 999px;
	margin-bottom: 8px;
}

.bcpa-title {
	margin: 0 0 16px;
	font-size: 1.6em;
	line-height: 1.25;
	font-weight: 800;
	color: var( --bcpa-primary );
}

.bcpa-description {
	margin: -8px 0 16px;
	font-size: 0.95em;
	line-height: 1.5;
	opacity: 0.8;
}

.bcpa-merchants-list,
.bcpa-merchants-list li,
.bcpa-merchant-row-wrapper {
	list-style: none !important;
	list-style-type: none !important;
	list-style-image: none !important;
}

.bcpa-merchants-list {
	margin: 0 !important;
	padding: 0 !important;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bcpa-merchant-row-wrapper {
	margin: 0 !important;
	padding: 0 !important;
}

.bcpa-merchant-row {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: nowrap;
	border-radius: 999px;
	padding: 10px 10px 10px 16px;
	background: #ffffff;
	border: 1px solid var( --bcpa-border );
	transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
	text-decoration: none !important;
	color: inherit;
	cursor: pointer;
}

.bcpa-merchant-row:hover,
.bcpa-merchant-row:focus-visible {
	border-color: color-mix( in srgb, var( --bcpa-primary ) 45%, var( --bcpa-border ) );
	box-shadow: 0 1px 6px rgba( 20, 30, 24, 0.08 );
}

.bcpa-merchant-row:hover .bcpa-cta-button,
.bcpa-merchant-row:focus-visible .bcpa-cta-button {
	filter: brightness( 0.9 );
}

.bcpa-merchant-row:focus-visible {
	outline: 2px solid var( --bcpa-primary );
	outline-offset: 2px;
}

.bcpa-merchant-row:active {
	transform: translateY( 1px );
}

.bcpa-merchant-row.bcpa-recommended {
	background: color-mix( in srgb, var( --bcpa-primary ) 8%, white );
	border-color: color-mix( in srgb, var( --bcpa-primary ) 25%, white );
}

.bcpa-row-badge {
	position: absolute;
	top: -9px;
	left: 16px;
	background: var( --bcpa-primary );
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	padding: 2px 9px;
	border-radius: 999px;
	line-height: 1.6;
}

.bcpa-merchant-main {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	min-width: 0;
}

.bcpa-merchant-logo {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	overflow: hidden;
}

.bcpa-merchant-logo img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.bcpa-merchant-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.25;
}

.bcpa-merchant-name {
	font-weight: 700;
	font-size: 1.05em;
	color: var( --bcpa-primary );
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bcpa-merchant-subtitle {
	font-size: 0.8em;
	opacity: 0.55;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bcpa-merchant-price {
	flex: 0 0 auto;
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-weight: 700;
	white-space: nowrap;
}

.bcpa-old-price {
	font-weight: 400;
	font-size: 0.85em;
	opacity: 0.5;
	text-decoration: line-through;
}

.bcpa-current-price {
	color: var( --bcpa-primary );
	font-size: 1.05em;
}

.bcpa-cta-button {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: var( --bcpa-button );
	color: #fff !important;
	font-weight: 700;
	font-size: 0.95em;
	text-decoration: none !important;
	padding: 10px 16px 10px 20px;
	border-radius: 999px;
	white-space: nowrap;
	transition: filter 0.15s ease, transform 0.1s ease;
	margin-left: auto;
}

.bcpa-cta-chevron {
	font-size: 1.2em;
	line-height: 1;
	transform: translateY( 0.5px );
}

.bcpa-legal-text {
	margin: 16px 0 0;
	font-size: 0.78em;
	opacity: 0.55;
	line-height: 1.4;
}

/* ---------------- Mode compact / inline ---------------- */

.bcpa-block.bcpa-mode-compact {
	flex-direction: column;
	padding: 16px;
	gap: 10px;
}

.bcpa-block.bcpa-mode-compact .bcpa-title {
	font-size: 1.1em;
	margin-bottom: 8px;
}

.bcpa-block.bcpa-mode-compact .bcpa-merchant-row {
	padding: 8px 8px 8px 12px;
}

.bcpa-block.bcpa-mode-compact .bcpa-merchant-logo {
	width: 26px;
	height: 26px;
}

.bcpa-block.bcpa-mode-compact .bcpa-cta-button {
	padding: 7px 12px 7px 16px;
	font-size: 0.85em;
}

/* ---------------- Responsive ---------------- */

@media ( max-width: 720px ) {
	.bcpa-block {
		flex-direction: column;
		padding: 16px;
		gap: 16px;
	}

	.bcpa-block .bcpa-media {
		flex: 1 1 auto;
		max-width: 100%;
		width: 100%;
	}

	.bcpa-title {
		font-size: 1.3em;
	}
}

@media ( max-width: 480px ) {
	.bcpa-merchant-row {
		flex-wrap: wrap;
		border-radius: var( --bcpa-radius );
		padding: 12px;
	}

	.bcpa-merchant-price {
		order: 2;
	}

	.bcpa-cta-button {
		order: 3;
		width: 100%;
		justify-content: center;
		margin-left: 0;
		padding: 12px 16px;
	}

	.bcpa-merchant-main {
		order: 1;
	}

	.bcpa-row-badge {
		left: 12px;
	}
}
