/* ==========================================================================
   Eduscol Tunisie — barre latérale, cartes et tuiles pour tout le forum
   À placer dans Themes/default/css/eduscol-ui.css
   Chargé par index.template.php (loadCSSFile). Reprend le bloc « 1.12.0 »
   du module Cours : couleurs + propriétés logiques uniquement (marges et
   positions qui s'inversent en RTL), aucune règle propre au module.
   ========================================================================== */

:root {
	--ed-blue: #123C55;
	--ed-ochre: #C97A26;
	--ed-line: #E4DFD3;
	--ed-green: #1f7a4d;
	--ed-red: #b3362c;
}

/* --- Menu horizontal d'origine : remplacé par la barre latérale --------- */
#main_menu,
a.mobile_user_menu {
	display: none !important;
}

/* --- Coque : barre latérale + contenu ----------------------------------- */
.ed-shell {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 10px;
	box-sizing: border-box;
}
.ed-main {
	flex: 1 1 0;
	min-width: 0;
}

/* --- Barre latérale ------------------------------------------------------ */
.ed-side {
	flex: 0 0 218px;
	position: sticky;
	top: 8px;
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 10px 8px;
	border-radius: 10px;
	background: var(--ed-blue);
	color: #fff;
	box-sizing: border-box;
	max-height: calc(100vh - 16px);
	overflow-y: auto;
}
.ed-side-user {
	padding: 6px 8px 12px;
	margin-bottom: 6px;
	border-bottom: 1px solid rgba(255, 255, 255, .18);
}
.ed-side-user strong {
	display: block;
	font-size: 1.05em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: #fff;
}
.ed-side-user span {
	font-size: .82em;
	opacity: .75;
	color: #fff;
}
.ed-side-user a,
.ed-side-user a:link,
.ed-side-user a:visited {
	display: block;
	background: none;
	padding: 0;
	color: #fff;
	text-decoration: none;
}
.ed-side > a,
.ed-side > a:link,
.ed-side > a:visited {
	position: relative;
	display: flex;
	align-items: center;
	gap: .7em;
	padding: .6em .7em;
	border-radius: 8px;
	color: #dbe7ef;
	text-decoration: none;
}
.ed-side > a:hover,
.ed-side > a:focus {
	background: rgba(255, 255, 255, .12);
	color: #fff;
	text-decoration: none;
}
.ed-side > a.is-on,
.ed-side > a.is-on:link,
.ed-side > a.is-on:visited,
.ed-side > a.is-on:hover {
	background: var(--ed-ochre);
	color: #fff;
	font-weight: bold;
}
.ed-side .ic {
	flex: none;
	width: 1.5em;
	text-align: center;
	font-size: 1.2em;
}
.ed-side .lb {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ed-side .bdg {
	margin-inline-start: auto;
	padding: 0 .5em;
	border-radius: 999px;
	background: var(--ed-red);
	color: #fff;
	font-size: .75em;
	line-height: 1.6;
}

/* Le tableau de bord Cours a déjà sa propre barre (avec « retour au forum ») :
   on évite deux barres côte à côte. Supprimez cette règle pour garder les deux. */
.ed-shell:has(.cours-space) > .ed-side {
	display: none;
}

/* --- Catégories et forums (dépliables) ------------------------------------ */
.ed-cats {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, .18);
}
.ed-cats summary {
	display: flex;
	align-items: center;
	gap: .7em;
	padding: .5em .7em;
	border-radius: 8px;
	color: #fff;
	font-weight: bold;
	cursor: pointer;
	list-style: none;
}
.ed-cats summary::-webkit-details-marker {
	display: none;
}
.ed-cats summary:hover {
	background: rgba(255, 255, 255, .12);
}
.ed-cats details[open] > summary {
	color: #fff;
}
.ed-cats details > a,
.ed-cats details > a:link,
.ed-cats details > a:visited {
	display: block;
	padding: .35em .7em;
	padding-inline-start: calc(2.7em + var(--lvl, 0) * 1em);
	border-radius: 8px;
	color: #dbe7ef;
	font-size: .92em;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ed-cats details > a:hover {
	background: rgba(255, 255, 255, .12);
	color: #fff;
	text-decoration: none;
}
.ed-cats details > a.is-on,
.ed-cats details > a.is-on:link,
.ed-cats details > a.is-on:visited {
	background: var(--ed-ochre);
	color: #fff;
	font-weight: bold;
}

/* --- Annonce en bas de la barre latérale (ordinateur) ---------------------- */
.ed-ad {
	margin-top: 10px;
	padding: 6px;
	border-radius: 8px;
	background: #fff;
	color: #666;
	text-align: center;
	overflow: hidden;
}
.ed-ad small {
	display: block;
	font-size: .7em;
	opacity: .7;
	margin-bottom: 4px;
}

/* --- Icône 📂 (smartphone) : ouvre la liste des catégories ------------------ */
.ed-pop {
	display: none;
}

/* --- Cartes de statistiques (liseré coloré sur le côté) ------------------ */
.ed-kpis {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	margin: 8px 0;
}
.ed-kpi {
	display: flex;
	flex-direction: column;
	gap: .15em;
	margin: 0;
	padding: .7em .9em;
	border: 1px solid var(--ed-line);
	border-inline-start: 4px solid var(--ed-ochre);
	border-radius: 10px;
	background: #fff;
	color: #333;
	text-decoration: none;
}
a.ed-kpi:hover {
	text-decoration: none;
	filter: brightness(.97);
}
.ed-kpi strong {
	font-size: 1.8em;
	line-height: 1.15;
	color: #222;
}
.ed-kpi-l {
	opacity: .8;
	font-size: .9em;
}
.ed-kpi-blue {
	border-inline-start-color: var(--ed-blue);
}
.ed-kpi-green {
	border-inline-start-color: var(--ed-green);
}
.ed-kpi-warn {
	border-inline-start-color: var(--ed-red);
}

/* --- Tuiles d'actions rapides -------------------------------------------- */
.ed-tiles {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	margin: 0 0 8px;
}
.ed-tile,
.ed-tile:link,
.ed-tile:visited {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .3em;
	margin: 0;
	padding: 1em .6em;
	text-align: center;
	text-decoration: none;
	border: 1px solid var(--ed-line);
	border-radius: 10px;
	background: #fff;
	color: var(--ed-blue);
}
.ed-tile:hover {
	text-decoration: none;
	filter: brightness(.96);
	color: var(--ed-ochre);
}
.ed-tile .ic {
	font-size: 1.8em;
	line-height: 1.2;
}

/* --- Smartphone : rail d'icônes FIXE, page sans glissement latéral ------- */
@media (max-width: 820px) {
	html, body {
		overflow-x: hidden;
		max-width: 100%;
	}
	.ed-shell {
		display: block;
		overflow-x: clip;
		padding: 6px;
		padding-inline-start: 66px; /* 6 + 54 (rail) + 6 */
	}
	.ed-main {
		width: 100%;
		max-width: 100%;
		overflow-x: clip;
	}
	.ed-main img, .ed-main table, .ed-main iframe, .ed-main video, .ed-main pre {
		max-width: 100%;
	}
	.ed-main .bbc_code, .ed-main pre {
		overflow-x: auto;
	}
	.ed-side {
		position: fixed;
		top: 8px;
		inset-inline-start: 6px;
		width: 54px;
		max-height: calc(100vh - 16px);
		overflow-y: auto;
		z-index: 50;
		align-items: center;
		padding: 8px 4px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
	}
	.ed-side-user,
	.ed-side .lb,
	.ed-side > .ed-cats,
	.ed-ad {
		display: none;
	}
	.ed-side > a,
	.ed-side > a:link,
	.ed-side > a:visited {
		justify-content: center;
		width: 100%;
		box-sizing: border-box;
		padding: .7em 0;
	}
	.ed-side .bdg {
		position: absolute;
		top: 1px;
		inset-inline-end: 1px;
		margin: 0;
		font-size: .65em;
		padding: 0 .4em;
	}
	.ed-pop {
		display: block;
		width: 100%;
	}
	.ed-pop-btn {
		display: flex;
		justify-content: center;
		width: 100%;
		box-sizing: border-box;
		padding: .7em 0;
		border-radius: 8px;
		color: #dbe7ef;
		cursor: pointer;
		list-style: none;
	}
	.ed-pop-btn::-webkit-details-marker {
		display: none;
	}
	.ed-pop-btn:hover,
	.ed-pop[open] > .ed-pop-btn {
		background: rgba(255, 255, 255, .12);
	}
	.ed-pop-panel {
		position: fixed;
		top: 8px;
		inset-inline-start: 66px;
		width: min(280px, calc(100vw - 80px));
		max-height: calc(100vh - 16px);
		overflow-y: auto;
		padding: 8px;
		box-sizing: border-box;
		border-radius: 10px;
		background: var(--ed-blue);
		box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
		z-index: 60;
	}
	.ed-side .ed-pop-panel .lb {
		display: block;
	}
	.ed-pop-panel .ed-cats {
		margin-top: 0;
		padding-top: 0;
		border-top: 0;
	}
}
