﻿/**
 * Bloc الأكثر مشاهدة — overlay 3lachtv, grille areas, zéro vide.
 */

/* Conteneur section */
.front-page > .most-viewed-section.container {
	width: 100% !important;
	max-width: var(--container-width, 1280px) !important;
	margin-inline: auto !important;
	padding: 0 !important;
	box-sizing: border-box;
	overflow: hidden;
	background: var(--news-surface, #fff);
	border: 1px solid var(--news-border, #e4e7ec);
	border-radius: var(--news-radius-md, 10px);
	box-shadow: var(--news-shadow, 0 2px 14px rgba(26, 26, 26, 0.06));
}

/* ── En-tête ── */
.front-page .most-viewed-section .most-viewed-header::after {
	background: linear-gradient(
		90deg,
		transparent 0%,
		var(--news-gold) 18%,
		var(--news-red, #c41e24) 50%,
		var(--news-gold) 82%,
		transparent 100%
	) !important;
}

.front-page .most-viewed-section .most-viewed-trend-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	border-radius: 50%;
	background: rgba(255, 204, 0, 0.15);
	border: 1px solid rgba(255, 204, 0, 0.45);
	color: var(--news-gold, #ffcc00);
}

.front-page .most-viewed-section .most-viewed-trend-icon svg {
	width: 18px;
	height: 18px;
	display: block;
}

.front-page .most-viewed-section .most-viewed-header-title {
	align-items: center !important;
	gap: 10px !important;
}

.front-page .most-viewed-section .most-viewed-header-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.front-page .most-viewed-section .most-viewed-heading {
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
}

.front-page .most-viewed-section .most-viewed-subtitle {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 12px !important;
	font-weight: 500 !important;
	line-height: 1.35 !important;
	color: rgba(255, 255, 255, 0.72) !important;
}

/* ── Corps ── */
.front-page .most-viewed-section .most-viewed-body {
	padding: var(--ltv-body-pad, clamp(14px, 1.8vw, 18px)) !important;
	background: var(--news-surface, #fff) !important;
	border-top: none !important;
}

/* Grille areas — vedette droite RTL (desktop) */
.front-page .most-viewed-section .most-viewed-mosaic-grid {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	grid-template-rows: auto auto !important;
	grid-template-areas:
		"feat s1 s2"
		"feat s3 s4" !important;
	gap: clamp(8px, 1vw, 12px) !important;
	align-items: stretch !important;
	min-width: 0;
}

@media (max-width: 640px) {
	.front-page .most-viewed-section .most-viewed-mosaic-grid {
		grid-template-rows: auto !important;
		align-items: start !important;
	}
}

.front-page .most-viewed-section .most-viewed-mosaic-grid > .most-viewed-card--featured {
	grid-area: feat !important;
}

.front-page .most-viewed-section .most-viewed-mosaic-grid > .most-viewed-card:nth-child(2) {
	grid-area: s1 !important;
}

.front-page .most-viewed-section .most-viewed-mosaic-grid > .most-viewed-card:nth-child(3) {
	grid-area: s2 !important;
}

.front-page .most-viewed-section .most-viewed-mosaic-grid > .most-viewed-card:nth-child(4) {
	grid-area: s3 !important;
}

.front-page .most-viewed-section .most-viewed-mosaic-grid > .most-viewed-card:nth-child(5) {
	grid-area: s4 !important;
}

/* Neutraliser ancien layout / grid */
.front-page .most-viewed-section .most-viewed-layout {
	display: contents !important;
}

.front-page .most-viewed-section .most-viewed-card--featured::before {
	display: none !important;
	content: none !important;
}

/* ── Carte overlay ── */
.front-page .most-viewed-section .most-viewed-card {
	margin: 0 !important;
	min-width: 0;
	height: 100% !important;
	align-self: stretch !important;
}

.front-page .most-viewed-section .most-viewed-card-link {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 6px;
	aspect-ratio: 4 / 3;
	min-height: 0;
	height: 100% !important;
	color: inherit;
	text-decoration: none;
	background: #111;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.front-page .most-viewed-section .most-viewed-card-link:hover {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
	transform: translateY(-1px);
}

.front-page .most-viewed-section .most-viewed-card-thumb {
	position: absolute;
	inset: 0;
	display: block;
	overflow: hidden;
	z-index: 0;
}

.front-page .most-viewed-section .most-viewed-card-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover !important;
	object-position: center center !important;
	display: block;
	transition: transform 0.4s ease;
}

.front-page .most-viewed-section .most-viewed-card-link:hover .most-viewed-card-img {
	transform: scale(1.04) !important;
}

.front-page .most-viewed-section .most-viewed-card-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.94) 0%,
		rgba(0, 0, 0, 0.62) 38%,
		rgba(0, 0, 0, 0.12) 62%,
		transparent 100%
	);
}

.front-page .most-viewed-section .most-viewed-card-caption {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 2;
	display: block;
	padding: 24px 10px 10px;
	text-align: start;
	pointer-events: none;
}

.front-page .most-viewed-section .most-viewed-card-title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	font-size: clamp(0.75rem, 0.95vw, 0.8125rem);
	font-weight: 700;
	line-height: 1.4;
	color: #fff !important;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.front-page .most-viewed-section .most-viewed-cat {
	display: block;
	margin: 0 0 3px;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--news-gold, #ffcc00) !important;
}

.front-page .most-viewed-section .most-viewed-views {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 5px;
	font-size: 10px;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.9) !important;
}

.front-page .most-viewed-section .most-viewed-views-icon {
	flex-shrink: 0;
	opacity: 0.9;
}

/* ── Badge rang ── */
.front-page .most-viewed-section .most-viewed-rank {
	position: absolute;
	top: 8px;
	inset-inline-start: 8px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	font-size: 11px;
	font-weight: 800;
	line-height: 1;
	border-radius: 5px;
	background: var(--news-charcoal, #1a1a1a);
	color: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.front-page .most-viewed-section .most-viewed-rank--featured {
	min-width: 34px;
	height: auto;
	padding: 4px 9px;
	gap: 3px;
	background: var(--news-gold, #ffcc00);
	color: var(--news-charcoal, #1a1a1a);
}

/* ── Vedette #1 — overlay plein cadre (priorité sur home-reference / pro-news) ── */
.front-page .most-viewed-section .most-viewed-card--featured {
	display: block !important;
	height: 100% !important;
	align-self: stretch !important;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	overflow: visible !important;
}

.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-link {
	position: relative !important;
	display: block !important;
	height: 100% !important;
	min-height: 100% !important;
	aspect-ratio: unset !important;
	border: 2px solid rgba(255, 204, 0, 0.5);
	box-shadow: 0 4px 16px rgba(201, 162, 39, 0.15);
}

.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-thumb {
	position: absolute !important;
	inset: 0 !important;
	flex: none !important;
	aspect-ratio: unset !important;
	max-height: none !important;
	width: 100% !important;
	height: 100% !important;
	overflow: hidden;
	z-index: 0;
}

.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-img {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	min-height: 100% !important;
	max-height: none !important;
	object-fit: cover !important;
	object-position: center center !important;
}

.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-link::before {
	content: '';
	position: absolute;
	top: 0;
	inset-inline: 0;
	height: 3px;
	z-index: 4;
	background: linear-gradient(90deg, var(--news-gold, #ffcc00), #e8c547);
}

.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-caption {
	padding: 28px 12px 12px;
}

.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-title {
	font-size: clamp(0.8125rem, 1.1vw, 0.9375rem) !important;
	font-weight: 800 !important;
	color: #fff !important;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55) !important;
	display: -webkit-box !important;
	-webkit-box-orient: vertical !important;
	overflow: hidden !important;
	-webkit-line-clamp: 3 !important;
	line-clamp: 3 !important;
	white-space: normal !important;
	max-height: none !important;
}

.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-views {
	font-size: 11px;
	color: rgba(255, 255, 255, 0.9) !important;
}

/* Masquer ancien corps séparé si présent */
.front-page .most-viewed-section .most-viewed-card-body {
	display: none !important;
}

/* ── Tablette ── */
@media (max-width: 991px) {
	.front-page .most-viewed-section .most-viewed-mosaic-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		grid-template-rows: auto !important;
		grid-template-areas:
			"feat feat"
			"s1 s2"
			"s3 s4" !important;
	}

	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-link {
		aspect-ratio: 16 / 9 !important;
		min-height: 0 !important;
	}
}

/* ── Mobile — liste compacte (vedette overlay + 4 lignes horizontales) ── */
@media (max-width: 640px) {
	.front-page .most-viewed-section .most-viewed-body {
		padding: 10px !important;
	}

	.front-page .most-viewed-section .most-viewed-mosaic-grid {
		grid-template-columns: 1fr !important;
		grid-template-rows: auto !important;
		grid-template-areas:
			"feat"
			"s1"
			"s2"
			"s3"
			"s4" !important;
		gap: 8px !important;
		align-items: start !important;
	}

	/* Vedette #1 — overlay lisible */
	.front-page .most-viewed-section .most-viewed-card--featured {
		height: auto !important;
		border: none !important;
		background: transparent !important;
		box-shadow: none !important;
	}

	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-link {
		display: block;
		aspect-ratio: 16 / 9 !important;
		min-height: 0 !important;
		height: auto !important;
		border-radius: 8px;
	}

	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-caption {
		padding: 32px 12px 12px;
	}

	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-title {
		font-size: 0.875rem !important;
		-webkit-line-clamp: 2 !important;
		line-clamp: 2 !important;
		color: #fff !important;
	}

	/* Articles 2–5 — ligne horizontale (thumb + texte) */
	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) {
		height: auto !important;
		border: none !important;
		background: transparent !important;
		box-shadow: none !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-link {
		display: flex;
		flex-direction: row;
		align-items: stretch;
		aspect-ratio: unset !important;
		height: auto !important;
		min-height: 76px;
		background: var(--news-surface, #fff);
		border: 1px solid var(--news-border, #e4e7ec);
		border-radius: 8px;
		overflow: hidden;
		box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-link:hover {
		transform: none;
		box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-thumb {
		position: relative;
		flex: 0 0 108px;
		width: 108px;
		min-height: 76px;
		inset: auto;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-img {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		object-fit: cover !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-overlay {
		display: none !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-caption {
		position: static;
		flex: 1;
		min-width: 0;
		display: flex;
		flex-direction: column;
		justify-content: center;
		gap: 3px;
		padding: 8px 10px;
		background: var(--news-surface, #fff);
		pointer-events: auto;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-cat {
		margin: 0;
		font-size: 10px;
		color: var(--news-red, #e60000) !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-title {
		font-size: 0.8125rem !important;
		font-weight: 600 !important;
		line-height: 1.45 !important;
		color: var(--news-ink, #1a1a1a) !important;
		text-shadow: none !important;
		-webkit-line-clamp: 2 !important;
		line-clamp: 2 !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-views {
		margin-top: 2px;
		font-size: 10px;
		color: var(--news-muted, #5c6670) !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-rank {
		top: 6px;
		inset-inline-start: 6px;
		min-width: 20px;
		height: 20px;
		padding: 0 5px;
		font-size: 10px;
		border-radius: 4px;
	}
}

/* ── Dark mode ── */
body.dark-mode .front-page .most-viewed-section .most-viewed-body {
	background: var(--news-surface, #141414) !important;
}

body.dark-mode .front-page .most-viewed-section .most-viewed-card-title {
	color: #fff !important;
}

body.dark-mode .front-page .most-viewed-section .most-viewed-subtitle {
	color: rgba(255, 255, 255, 0.65) !important;
}

@media (max-width: 640px) {
	body.dark-mode .front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-link {
		background: var(--news-surface, #1a1a1a);
		border-color: var(--news-border, rgba(255, 255, 255, 0.1));
	}

	body.dark-mode .front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-caption {
		background: var(--news-surface, #1a1a1a);
	}

	body.dark-mode .front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-title {
		color: var(--news-ink, #fafafa) !important;
	}
}

/* ── Override legacy home-reference / pro-news — desktop/tablette overlay uniquement ── */
@media (min-width: 641px) {
	.front-page .most-viewed-section .most-viewed-card,
	.front-page .most-viewed-section .most-viewed-card--featured {
		display: block !important;
		flex-direction: unset !important;
		height: 100% !important;
		min-height: 0 !important;
		align-self: stretch !important;
		background: transparent !important;
		border: none !important;
		box-shadow: none !important;
		overflow: hidden !important;
		color: inherit !important;
		transform: none !important;
	}

	.front-page .most-viewed-section .most-viewed-card--featured::before {
		display: none !important;
		content: none !important;
	}

	.front-page .most-viewed-section .most-viewed-card-link,
	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-link {
		position: relative !important;
		display: block !important;
		overflow: hidden !important;
		flex: unset !important;
		flex-direction: unset !important;
		background: #111 !important;
	}

	/* Cartes latérales — ratio fixe (évite corps vide desktop) */
	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-link {
		height: auto !important;
		min-height: 0 !important;
		aspect-ratio: 4 / 3 !important;
	}

	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-link {
		height: 100% !important;
		min-height: 100% !important;
		aspect-ratio: unset !important;
		border: 2px solid rgba(255, 204, 0, 0.5) !important;
		box-shadow: 0 4px 16px rgba(201, 162, 39, 0.15) !important;
	}

	.front-page .most-viewed-section .most-viewed-card-thumb,
	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-thumb {
		position: absolute !important;
		inset: 0 !important;
		flex: none !important;
		width: 100% !important;
		height: 100% !important;
		max-height: none !important;
		min-height: 0 !important;
		aspect-ratio: unset !important;
		overflow: hidden !important;
	}

	.front-page .most-viewed-section .most-viewed-card-img,
	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-img {
		position: absolute !important;
		inset: 0 !important;
		width: 100% !important;
		height: 100% !important;
		min-height: 100% !important;
		max-height: none !important;
		object-fit: cover !important;
		object-position: center center !important;
	}

	.front-page .most-viewed-section .most-viewed-card-caption,
	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-caption {
		position: absolute !important;
		inset-inline: 0 !important;
		bottom: 0 !important;
		top: auto !important;
		display: block !important;
		flex: unset !important;
		width: auto !important;
		padding: 24px 10px 10px !important;
		background: transparent !important;
		text-align: start !important;
	}

	.front-page .most-viewed-section .most-viewed-card-title,
	.front-page .most-viewed-section .most-viewed-card-title a,
	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-title {
		color: #fff !important;
		font-weight: 700 !important;
		text-align: start !important;
		display: -webkit-box !important;
		overflow: hidden !important;
		-webkit-box-orient: vertical !important;
		-webkit-line-clamp: 2 !important;
		line-clamp: 2 !important;
	}

	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-title {
		-webkit-line-clamp: 3 !important;
		line-clamp: 3 !important;
		font-weight: 800 !important;
	}

	.front-page .most-viewed-section .most-viewed-views,
	.front-page .most-viewed-section .most-viewed-views-label,
	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-views {
		color: rgba(255, 255, 255, 0.9) !important;
	}
}

.front-page .most-viewed-section .most-viewed-card-body {
	display: none !important;
}

.front-page .most-viewed-section .most-viewed-layout {
	display: contents !important;
}

/* Renfort mobile — après overrides legacy, priorité sur height:100% / position:absolute */
@media (max-width: 640px) {
	.front-page .most-viewed-section .most-viewed-card,
	.front-page .most-viewed-section .most-viewed-card--featured {
		height: auto !important;
		min-height: 0 !important;
		align-self: start !important;
		overflow: visible !important;
	}

	.front-page .most-viewed-section .most-viewed-card--featured .most-viewed-card-link {
		display: block !important;
		height: auto !important;
		min-height: 0 !important;
		aspect-ratio: 16 / 9 !important;
		background: #111 !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-link {
		display: flex !important;
		flex-direction: row !important;
		height: auto !important;
		min-height: 76px !important;
		aspect-ratio: unset !important;
		background: var(--news-surface, #fff) !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-thumb {
		position: relative !important;
		inset: auto !important;
		flex: 0 0 108px !important;
		width: 108px !important;
		height: auto !important;
		min-height: 76px !important;
	}

	.front-page .most-viewed-section .most-viewed-card:not(.most-viewed-card--featured) .most-viewed-card-caption {
		position: static !important;
		display: flex !important;
		flex: 1 1 auto !important;
		flex-direction: column !important;
		inset: auto !important;
		top: auto !important;
		bottom: auto !important;
	}
}
