/* ===== DESIGN MAGAZINE MINIMALISTE - ARTICLES ===== */
.sidebar-swipe-fade, .sidebar-swipe-dots { display: none; }

:root {
	--primary-green: #198754;
	--primary-green-dark: #146c43;
	--primary-teal: #20c997;
	--text-dark: #2c3e50;
	--text-secondary: #546e7a;
	--text-muted: #95a5a6;
	--bg-white: #ffffff;
	--bg-light: #f8f9fa;
	--bg-lighter: #fafbfc;
	--border-light: #ecf0f1;
	--border-color: #dfe6e9;
}

body {
	background: #fafbfc;
	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	overflow-x: hidden;
}

/* ===== CONTENEUR PRINCIPAL ARTICLES ===== */
#arcticles {
	padding-top: 2rem;
}

#arcticles > .col-lg-8,
#arcticles > .col-lg-4 {
	padding-left: 15px;
	padding-right: 15px;
}

/* ===== CONTAINER PRINCIPAL ===== */
.article-container {
	width: 100%;
	margin: 0 0 2rem 0;
	background: white;
	border-radius: 8px;
	border: 1px solid var(--border-light);
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ===== HEADER ARTICLE - STYLE ÉPURÉ ===== */
.article-header {
	background: white;
	padding: 3.5rem 3rem 2.5rem;
	border-bottom: 1px solid var(--border-light);
	position: relative;
}

.article-category-badge {
	display: inline-block;
	padding: 0.45rem 1.1rem;
	background: rgba(25, 135, 84, 0.08);
	color: var(--primary-green);
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1px;
	border-radius: 4px;
	margin-bottom: 1.75rem;
	border: 1px solid rgba(25, 135, 84, 0.15);
}

.article-title {
	font-size: 2.75rem;
	font-weight: 800;
	line-height: 1.15;
	margin-bottom: 1.5rem;
	color: var(--text-dark);
	letter-spacing: -0.8px;
	word-break: break-word;
	overflow-wrap: break-word;
}

.article-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	font-size: 0.9rem;
	color: var(--text-secondary);
	padding-top: 1.25rem;
	border-top: 1px solid var(--border-light);
}

.article-meta-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 500;
}

.article-meta-item svg {
	width: 18px;
	height: 18px;
	opacity: 0.6;
}

/* ===== CONTENU PRINCIPAL ===== */
.article-content {
	padding: 3rem 3rem 2rem;
}

.article-image-main {
	width: 100%;
	max-height: 480px;
	object-fit: cover;
	border-radius: 6px;
	margin-bottom: 2.5rem;
	border: 1px solid var(--border-light);
}

.article-text {
	font-size: 1.125rem;
	line-height: 1.8;
	color: var(--text-dark);
	margin-bottom: 2.5rem;
	font-weight: 400;
	overflow-wrap: break-word;
	word-wrap: break-word;
	text-align: justify;
}
.article-text p,
.article-text div,
.article-text span {
	text-align: justify !important;
}

.article-text p {
	margin-bottom: 1.75rem;
}

.article-text strong {
	font-weight: 600;
	color: var(--text-dark);
}

/* Liens dans le contenu CMS — visibilité tactile */
.article-text a {
	color: var(--primary-green);
	text-decoration: underline;
	text-decoration-color: rgba(25, 135, 84, 0.3);
	text-underline-offset: 3px;
	transition: all 0.2s ease;
}

.article-text a:hover {
	color: var(--primary-green-dark);
	text-decoration-color: var(--primary-green-dark);
}

/* ===== SECTION MÉDIAS ===== */
/* Masquer le conteneur médias si la grille est vide */
.media-grid:empty {
	display: none;
}

.media-grid:empty ~ * {
	display: none;
}

.media-section:has(.media-grid:empty) {
	display: none;
}

/* Masquer le conteneur entier si la section médias est cachée */
.article-container.mt-4:has(.media-section:has(.media-grid:empty)) {
	display: none;
}

.media-section {
	margin-top: 3.5rem;
	padding-top: 2.5rem;
	border-top: 1px solid var(--border-light);
}

.media-section-title {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--text-dark);
	margin-bottom: 2rem;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	letter-spacing: -0.3px;
}

.media-section-title::before {
	content: '';
	width: 3px;
	height: 28px;
	background: var(--primary-green);
	border-radius: 2px;
}

.media-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 1.25rem;
}

.media-card {
	background: white;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid var(--border-light);
	transition: all 0.25s ease;
}

.media-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.08);
	border-color: var(--border-color);
}

.media-card img {
	width: 100%;
	height: 200px;
	object-fit: cover;
}

.media-card-caption {
	padding: 0.9rem 1rem;
	text-align: center;
	font-size: 0.875rem;
	color: var(--text-secondary);
	background: var(--bg-lighter);
	font-weight: 500;
	border-top: 1px solid var(--border-light);
}

.media-card audio,
.media-card video {
	width: 100%;
}

/* ===== SIDEBAR - STYLE MINIMALISTE ===== */
.sidebar-container {
	position: sticky;
	top: 100px;
	max-height: calc(100vh - 120px);
	overflow-y: auto;
	padding: 0;
}

.sidebar-card {
	background: white;
	border: 1px solid var(--border-light);
	border-radius: 8px;
	padding: 1.75rem 1.5rem;
	box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sidebar-title {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--text-dark);
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 2px solid var(--primary-green);
	letter-spacing: -0.2px;
}

.related-articles-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.related-article-item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.9rem 1rem;
	background: var(--bg-lighter);
	border-radius: 6px;
	text-decoration: none;
	color: var(--text-dark);
	transition: all 0.2s ease;
	border: 1px solid var(--border-light);
}

.related-article-item:hover {
	background: white;
	border-left-color: var(--primary-green);
	box-shadow: 0 2px 8px rgba(25, 135, 84, 0.1);
	transform: translateX(3px);
}

.related-article-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-teal) 100%);
	border-radius: 8px;
	color: white;
	flex-shrink: 0;
}

.related-article-item:hover .related-article-icon {
	color: white;
}

.related-article-title {
	font-size: 0.9rem;
	line-height: 1.5;
	color: var(--text-dark);
	font-weight: 500;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.related-article-item:hover .related-article-title {
	color: var(--primary-green-dark);
}

/* Scrollbar personnalisé pour sidebar */
.sidebar-container::-webkit-scrollbar {
	width: 5px;
}

.sidebar-container::-webkit-scrollbar-track {
	background: var(--bg-light);
	border-radius: 10px;
}

.sidebar-container::-webkit-scrollbar-thumb {
	background: var(--primary-green);
	border-radius: 10px;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
	background: var(--primary-green-dark);
}

/* ===== BOUTONS D'ACTION ===== */
.article-actions {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 1rem;
	margin-top: 2.5rem;
	padding: 1.75rem;
	background: var(--bg-lighter);
	border-radius: 6px;
	border: 1px solid var(--border-light);
}

/* Masquer si vide (pas admin + pas de liens sociaux) */
.article-actions:not(:has(*)) {
	display: none;
}

.btn-action {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.8rem 1.75rem;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.95rem;
	transition: all 0.2s ease;
	text-decoration: none;
	border: none;
	cursor: pointer;
	letter-spacing: 0.2px;
}

.btn-action-primary {
	background: var(--primary-green);
	color: white;
}

.btn-action-primary:hover {
	background: var(--primary-green-dark);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(25,135,84,0.25);
	color: white;
}

.btn-action-secondary {
	background: white;
	color: var(--primary-green);
	border: 2px solid var(--primary-green);
}

.btn-action-secondary:hover {
	background: var(--primary-green);
	color: white;
}

/* ===== RESPONSIVE ===== */

/* --- 991px : tablettes larges, Surface Pro 7 --- */
@media (max-width: 991px) {
	/* Remonter la sidebar au-dessus de l'article (les col-lg s'empilent ici) */
	#arcticles > .col-lg-4 {
		order: -1;
	}

	.sidebar-container {
		position: static;
		max-height: none;
		margin-top: 0;
		padding-top: 0;
	}

	/* Sidebar — tailles confortables pour écran 12" */
	.sidebar-card {
		position: relative;
		margin-top: 0;
		margin-bottom: 1rem;
		padding: 1.25rem 1.5rem;
	}

	.sidebar-title {
		font-size: 1.1rem;
		margin-bottom: 0.85rem;
		padding-bottom: 0.6rem;
	}

	.related-articles-list {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
		max-height: 260px;
		overflow-y: auto;
		overflow-x: hidden;
		scrollbar-width: thin;
		scrollbar-color: var(--primary-green) var(--bg-light);
		-webkit-overflow-scrolling: touch;
		padding-bottom: 0.25rem;
	}

	.related-articles-list::-webkit-scrollbar {
		width: 4px;
	}

	.related-articles-list::-webkit-scrollbar-track {
		background: var(--bg-light);
		border-radius: 3px;
	}

	.related-articles-list::-webkit-scrollbar-thumb {
		background: var(--primary-green);
		border-radius: 3px;
	}

	.related-article-item {
		flex: none;
		min-width: unset;
		padding: 0.85rem 1rem;
		border-radius: 10px;
		min-height: 54px;
	}

	.related-article-icon {
		width: 34px;
		height: 34px;
		border-radius: 8px;
	}

	.related-article-icon svg {
		width: 16px;
		height: 16px;
	}

	.related-article-title {
		font-size: 0.95rem;
		line-height: 1.45;
		-webkit-line-clamp: 2;
	}

	.article-header {
		padding: 2.5rem 2rem 2rem;
	}

	.article-title {
		font-size: 2.4rem;
	}

	.article-content {
		padding: 2rem;
	}

	.article-text {
		font-size: 1.1rem;
		line-height: 1.8;
	}

	.article-category-badge {
		font-size: 0.82rem;
	}

	.article-meta {
		font-size: 0.92rem;
	}

	.media-section-title {
		font-size: 1.4rem;
	}
}

/* --- 768px : tablette portrait --- */
@media (max-width: 768px) {
	.article-header {
		padding: 2rem 1.5rem 1.5rem;
	}

	.article-title {
		font-size: 2rem;
		letter-spacing: -0.5px;
	}

	.article-content {
		padding: 1.5rem;
	}

	.article-text {
		font-size: 1.05rem;
		line-height: 1.7;
	}

	/* CMS content overflow protection */
	.article-text img,
	.article-text iframe,
	.article-text table,
	.article-text video,
	.article-text embed,
	.article-text object {
		max-width: 100% !important;
		width: auto !important;
		height: auto !important;
	}

	.article-text iframe {
		width: 100% !important;
		aspect-ratio: 16 / 9;
	}

	.article-text table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Liens tactiles plus gros */
	.article-text a {
		padding: 2px 0;
		text-underline-offset: 4px;
	}

	.media-grid {
		grid-template-columns: 1fr;
	}

	/* Vidéo : forcer 1 colonne */
	.media-card[style*="grid-column"] {
		grid-column: span 1 !important;
	}

	/* Remonter la sidebar AU-DESSUS de l'article sur mobile */
	#arcticles > .col-lg-4 {
		order: -1;
	}

	.sidebar-card {
		margin-top: 0;
		margin-bottom: 0.75rem;
		padding: 1rem 1.25rem;
	}

	.sidebar-title {
		font-size: 0.95rem;
		margin-bottom: 0.75rem;
		padding-bottom: 0.5rem;
	}

	.related-articles-list {
		max-height: 165px;
	}

	.related-article-item {
		padding: 0.55rem 0.7rem;
	}

	.related-article-title {
		font-size: 0.78rem;
	}
}

/* --- 576px : smartphone --- */
@media (max-width: 576px) {
	/* Neutraliser le double padding body.container-fluid */
	body.container-fluid {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	#arcticles {
		margin-left: 0 !important;
		margin-right: 0 !important;
		padding-left: 0.75rem;
		padding-right: 0.75rem;
	}

	#arcticles > .col-lg-8,
	#arcticles > .col-lg-4 {
		padding-left: 0;
		padding-right: 0;
	}

	.article-container {
		border-radius: 6px;
		margin-bottom: 0.75rem;
	}

	/* Réduire gap entre article principal et médias */
	.article-container.mt-4 {
		margin-top: 0.5rem !important;
	}

	.article-header {
		padding: 1.5rem 1rem 1.2rem;
	}

	.article-category-badge {
		font-size: 0.72rem;
		padding: 0.35rem 0.8rem;
		margin-bottom: 1rem;
		letter-spacing: 0.8px;
	}

	.article-title {
		font-size: 1.4rem;
		margin-bottom: 1rem;
	}

	.article-meta {
		gap: 1rem;
		font-size: 0.82rem;
		padding-top: 0.75rem;
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		-ms-overflow-style: none;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 0.25rem;
	}

	.article-meta::-webkit-scrollbar {
		display: none;
	}

	.article-meta-item {
		flex-shrink: 0;
		white-space: nowrap;
	}

	.article-meta-item svg {
		width: 14px;
		height: 14px;
	}

	.article-content {
		padding: 1.25rem 1rem;
	}

	.article-image-main {
		max-height: 280px;
		margin-bottom: 1.5rem;
		border-radius: 0;
		border: none;
		margin-left: -1rem;
		margin-right: -1rem;
		width: calc(100% + 2rem);
	}

	.article-text {
		font-size: 0.95rem;
		line-height: 1.7;
		margin-bottom: 1.5rem;
	}

	.article-text p {
		margin-bottom: 1.25rem;
	}

	.media-section {
		margin-top: 2rem;
		padding-top: 1.5rem;
	}

	.media-section-title {
		font-size: 1.15rem;
		margin-bottom: 1rem;
	}

	/* Galerie médias : scroll horizontal avec snap */
	.media-grid {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		gap: 0.75rem;
		padding-bottom: 0.75rem;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}

	.media-grid::-webkit-scrollbar {
		display: none;
	}

	.media-grid .media-card {
		flex: 0 0 80vw;
		min-width: 80vw;
		scroll-snap-align: start;
	}

	.media-card img {
		height: 180px;
	}

	.article-actions {
		padding: 1rem;
		margin-top: 1.5rem;
		flex-direction: column;
	}

	.btn-action {
		padding: 0.75rem 1.25rem;
		font-size: 0.88rem;
		justify-content: center;
		min-height: 48px;
		width: 100%;
		border-radius: 8px;
	}

	/* ── Sidebar : scroll horizontal avec snap ── */
	.sidebar-card {
		padding: 0.85rem;
		margin-top: 0;
		margin-bottom: 0.5rem;
		border-radius: 10px;
		border: none;
		background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
		box-shadow: 0 2px 8px rgba(25,135,84,0.08);
	}

	.sidebar-title {
		font-size: 0.85rem;
		margin-bottom: 0.6rem;
		padding-bottom: 0.45rem;
		display: flex;
		align-items: center;
		gap: 0.4rem;
	}

	.sidebar-title::before {
		content: '';
		width: 3px;
		height: 14px;
		background: var(--primary-green);
		border-radius: 2px;
		flex-shrink: 0;
	}

	.related-articles-list {
		display: flex;
		flex-direction: row;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		gap: 0.5rem;
		max-height: none;
		padding-bottom: 0.5rem;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}

	.related-articles-list::-webkit-scrollbar {
		display: none;
	}

	.related-article-item {
		flex: 0 0 72vw;
		min-width: 72vw;
		scroll-snap-align: start;
		flex-direction: row;
		align-items: center;
		padding: 0.65rem 0.75rem;
		min-height: 52px;
		gap: 0.6rem;
		background: #fff;
		border-radius: 10px;
		border: 1px solid rgba(25,135,84,0.12);
		box-shadow: 0 1px 4px rgba(0,0,0,0.04);
	}

	.related-article-icon {
		width: 32px;
		height: 32px;
		border-radius: 8px;
	}

	.related-article-icon svg {
		width: 14px;
		height: 14px;
	}

	.related-article-title {
		font-size: 0.78rem;
		-webkit-line-clamp: 2;
		line-height: 1.4;
	}

	/* Sidebar : position relative pour le fade */
	.sidebar-card {
		position: relative;
	}

	/* Fade droit */
	.sidebar-swipe-fade {
		display: block;
		position: absolute;
		top: 0;
		right: 0;
		width: 36px;
		height: calc(100% - 32px);
		pointer-events: none;
		background: linear-gradient(to right, transparent, rgba(240,253,244,0.9));
		z-index: 2;
		transition: opacity 0.3s;
	}
	.sidebar-swipe-fade.hidden { opacity: 0; }

	/* Dots */
	.sidebar-swipe-dots {
		display: flex;
		justify-content: center;
		gap: 5px;
		padding: 0.35rem 0 0;
	}
	.sidebar-swipe-dot {
		width: 6px;
		height: 6px;
		border-radius: 50%;
		background: #ced4da;
		transition: all 0.3s;
	}
	.sidebar-swipe-dot.active {
		background: var(--primary-green);
		transform: scale(1.3);
	}

	/* Animation hint */
	@keyframes sidebarSwipeHint {
		0%   { transform: translateX(0); }
		30%  { transform: translateX(-25px); }
		60%  { transform: translateX(4px); }
		100% { transform: translateX(0); }
	}
	.sidebar-swipe-hint {
		animation: sidebarSwipeHint 0.8s ease-out 0.6s 1;
	}
}

/* --- 380px : petits smartphones (edge-to-edge) --- */
@media (max-width: 380px) {
	#arcticles {
		padding-left: 0.4rem;
		padding-right: 0.4rem;
	}

	.article-container {
		border-radius: 0;
		border-left: none;
		border-right: none;
		margin-bottom: 0.5rem;
	}

	.article-header {
		padding: 1.2rem 0.85rem 1rem;
	}

	.article-category-badge {
		font-size: 0.65rem;
		padding: 0.3rem 0.6rem;
		margin-bottom: 0.75rem;
	}

	.article-title {
		font-size: 1.15rem;
		letter-spacing: -0.3px;
	}

	.article-meta {
		gap: 0.5rem;
		font-size: 0.75rem;
		flex-direction: column;
	}

	.article-content {
		padding: 1rem 0.85rem;
	}

	.article-image-main {
		max-height: 200px;
		border-radius: 0;
		border: none;
		margin-left: -0.85rem;
		margin-right: -0.85rem;
		width: calc(100% + 1.7rem);
	}

	.article-text {
		font-size: 0.88rem;
	}

	.media-section-title {
		font-size: 1.05rem;
	}

	.media-section-title::before {
		height: 22px;
	}

	.media-grid .media-card {
		flex: 0 0 85vw;
		min-width: 85vw;
	}

	.media-card img {
		height: 140px;
	}

	.article-actions {
		padding: 0.75rem;
		gap: 0.5rem;
	}

	.btn-action {
		padding: 0.6rem 1rem;
		font-size: 0.82rem;
		min-height: 44px;
	}

	.sidebar-card {
		padding: 0.65rem;
		border-radius: 8px;
		margin-bottom: 0.4rem;
	}

	.sidebar-title {
		font-size: 0.8rem;
		margin-bottom: 0.45rem;
		padding-bottom: 0.35rem;
	}

	.sidebar-title::before {
		height: 12px;
	}

	.related-article-item {
		flex: 0 0 78vw;
		min-width: 78vw;
		padding: 0.55rem 0.65rem;
		min-height: 48px;
		gap: 0.5rem;
	}

	.related-article-icon {
		width: 26px;
		height: 26px;
		border-radius: 6px;
	}

	.related-article-icon svg {
		width: 12px;
		height: 12px;
	}

	.related-article-title {
		font-size: 0.72rem;
		-webkit-line-clamp: 2;
	}
}

/* ===== DÉSACTIVER HOVER SUR TACTILE ===== */
@media (hover: none) and (pointer: coarse) {
	.media-card:hover {
		transform: none;
		box-shadow: none;
	}

	.related-article-item:hover {
		transform: none;
	}

	.btn-action-primary:hover {
		transform: none;
	}

	.btn-edit-article:hover {
		transform: none;
	}
}

/* ===== ANIMATIONS SUBTILES ===== */
.btnAnime {
	transition: all 0.2s ease;
}

.btnAnime:hover {
	transform: translateY(-2px);
}
