/* ==========================================================================
   MACRO-LAYOUT: VIEW GRID (Mutualisé)
   Architecture : CSS Grid fluide, Agnostique des modules, Zero-Media Query
   ========================================================================== */

/* --- L'ORCHESTRATION SPATIALE (La grille) --- */

.shared-grid.flow-row {
	--item-min-width: 300px;
	--item-gap: 20px;

	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: var(--item-gap);
	align-items: start;
	justify-content: center;
	padding: 20px 10px;
}

.shared-grid.flow-column {
	--item-gap: 15px;

	display: flex;
	flex-direction: column;
	gap: var(--item-gap);
	align-items: center; /* Centre les articles qui ont une largeur max */
	padding: 20px 10px;
}

body {
	--item-width: auto;
	--item-height: auto;
	--item-img-width: 100%;
	--item-img-height: 150px;
	--item-img-fill: cover;
	--item-color-fg: black;
	--item-color-bg: var(--fg-color-light);
	--item-content-padding: 5px 10px;
}

article {
	background-color: var(--item-color-bg);
	color: var(--item-color-fg);
	border: var(--bordure, 1px solid #e0e0e0);
	border-radius: var(--radius-md, 8px);
	box-shadow: var(--ombre, 0 2px 4px rgba(0,0,0,0.05));
	overflow: hidden; /* Encapsulation stricte du débordement */
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	display: flex; /* Layout interne par défaut (Vertical) */
	flex-direction: column;
	width: var(--item-width);
	height: var(--item-height);
	flex-shrink: 0; /* Empêche l'écrasement dans un conteneur flex parent */
}
article:not([data-default-action="none"]) {
	cursor: pointer;
}
article:not([data-default-action="none"]):hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0,0,0,0.1);
	border-color: #ccc;
}
article .btn-delete { position: absolute; top: 0px; right: 0px; background: white; border: 1px solid #ccc; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity 0.2s; color: #dc3545; }
article:hover .btn-delete { opacity: 1; }


/* VARIANTES TOPOLOGIQUES (Layouts) */

/* Layout Horizontal (ex: Annuaires Asso/Pro, Actus) */
@media (max-width: 599px), (orientation: portrait) {
	.layout-horizontal article:not(.item-layout-gallery) .item-media {
		display: none;
	}
}
@media (min-width: 600px) and (orientation: landscape) {
	.layout-horizontal article:not(.item-layout-gallery) {
		display: grid;
		grid-template-columns: var(--item-img-width, 120px) 1fr;
		grid-template-rows: var(--item-height);
	}
}
.layout-horizontal article .item-title { margin: 5px 0px; }

/* Variante 2 : Layout Bubble (Chat) */
.layout-bubble article {
	position: relative;
	margin-bottom: 15px;
	display: flex;
	flex-direction: column;
	max-width: 75%;
	height: auto;
	width: auto;
	padding: 10px 15px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.layout-bubble article.is-mine {
	align-self: flex-end;
	background-color: #dcf8c6;
	border-radius: 20px 0px 0px 20px;
}
.layout-bubble article.is-other {
	align-self: flex-start;
	background-color: #dcc6f8;
	border-radius: 0px 20px 20px 0px;
}

/* Variante 3 : Layout Feed (RSS) */
.layout-feed article {
	max-width: 100%;
	align-self: stretch;
	height: auto;
	width: auto;
	padding: 10px 15px;
}

/* Variante 4 : Item Galerie / Mosaïque */
article.item-layout-gallery {
	display: flex;
	flex-direction: column;
	width: var(--item-width);
	box-sizing: border-box;
	background-color: transparent;
	border: none;
}
article.item-layout-gallery .gallery-title {
	margin: 0 0 8px 0;
	font-size: 1.15rem;
	font-weight: 600;
}
article.item-layout-gallery .gallery-desc {
	margin: 0 0 12px 0;
	color: var(--fg-color-muted, #555);
	font-size: 0.95rem;
}
.gallery-mosaic {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 10px;
}
.gallery-item {
	position: relative;
	border-radius: 10px;
	border: 2px solid white;
	overflow: hidden;
	cursor: pointer;
	background-color: #eee;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gallery-item:hover {
	transform: scale(1.03);
	box-shadow: 0 4px 10px rgba(0,0,0,0.15);
	z-index: 2;
}
.gallery-item img {
	max-width: 150px;
	max-height: 150px;
	display: block;
	transition: transform 0.3s ease;
}
.gallery-item:hover img {
	transform: scale(1.05);
}
.gallery-item-title {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 4px 6px;
	background: rgba(0,0,0,0.6);
	color: #fff;
	font-size: 0.75rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
}
.gallery-item .btn-delete-child {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 5;
	opacity: 0;
	transition: opacity 0.2s ease, background 0.2s ease;
}
.gallery-item:hover .btn-delete-child {
	opacity: 1;
}
.gallery-item .btn-delete-child:hover {
	background: #dc3545;
}
.gallery-item .btn-view-child {
	position: absolute;
	top: 4px;
	left: 4px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 5;
	opacity: 0;
	transition: opacity 0.2s ease, background 0.2s ease;
}
.gallery-item:hover .btn-view-child {
	opacity: 1;
}
.gallery-item .btn-view-child:hover {
	background: var(--primary-color, #007bff);
}
.gallery-add-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px dashed var(--border-color, #ccc);
	background: rgba(0, 0, 0, 0.02);
	color: var(--primary-color, #007bff);
	cursor: pointer;
	transition: all 0.2s ease;
	position: relative;
}
.gallery-add-slot .symbol {
	font-size: 2rem;
	pointer-events: none;
}
.gallery-add-slot:hover,
.gallery-add-slot.drag-over {
	border-color: var(--primary-color, #007bff);
	background: rgba(0, 123, 255, 0.08);
	transform: scale(1.05);
}
.gallery-add-slot.drag-over {
	border-style: solid;
	box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}
article.grid-add-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px dashed var(--border-color, #ccc);
	background: rgba(0, 0, 0, 0.02);
	color: var(--primary-color, #007bff);
	cursor: pointer;
	min-height: 80px;
	padding: 20px;
	box-shadow: none;
	transition: all 0.2s ease;
}
article.grid-add-slot:hover {
	border-color: var(--primary-color, #007bff);
	background: rgba(0, 123, 255, 0.06);
	transform: translateY(-2px);
}
article.grid-add-slot .symbol {
	font-size: 2.5rem;
	pointer-events: none;
}
.shared-composite-layout.mode-split {
	display: flex;
	height: calc(100vh - 120px);
	overflow: hidden;
	gap: 15px;
}
.composite-panel.composite-master {
	flex: 0 0 350px;
	overflow-y: auto;
	border-right: 1px solid var(--border-color, #eee);
}
.composite-panel.composite-detail {
	flex: 1 1 auto;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}
.composite-empty-state {
	margin: auto;
	text-align: center;
	color: #888;
}
.composite-empty-state .symbol {
	font-size: 3rem;
	display: block;
	margin-bottom: 10px;
}
