:root {
	/* Couleurs extraites du logo */
	--primary: #202A4D; /* Bleu foncé du texte "SAINT ANDRÉ" */
	--secondary: #007A8D; /* Sarcelle/Bleu-vert du "A" */
	--accent: #C61F4D; /* Rouge/Magenta de "DROIT DEVANT" */
	--light: #f5f5f5;
	--white: #ffffff;
	--border: #dcdcdc;
	--radius: 8px;
	--shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

body {
	font-family: "Poppins", "Segoe UI", Arial, sans-serif;
	margin: 0;
	background: var(--light);
	color: #333;
	display: flex;
	/* Active le mode Flexbox pour la mise en page principale */
}

header {
	/* Le header fait maintenant partie du contenu principal */
	position: sticky;
	top: 0;
	z-index: 10;
	background: var(--primary);
	/* Fond bleu solide, assorti à la sidebar */
	color: var(--white);
	padding: 20px 25px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
	margin: 0;
	font-size: 24px;
	font-weight: 600;
	text-align: center;
}

.header-date-range {
	margin-top: 8px;
	font-size: 14px;
	font-weight: 500;
	text-align: center;
	opacity: 0.95;
}

.nav-top-logo {
	width: 100%;
	height: auto;
	background: var(--white);
	padding: 8px;
	border-radius: var(--radius);
	box-sizing: border-box;
}

nav {
	/* Transformation de la nav en sidebar */
	width: 230px;
	height: 100vh; /* Prend toute la hauteur de l'écran */
	position: sticky; /* Colle la sidebar à l'écran */
	top: 0;
	background: linear-gradient(180deg, var(--primary), var(--secondary));
	box-shadow: 4px 0px 10px rgba(0, 0, 0, 0.1);
	padding: 25px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

nav a {
	background: var(--white);
	color: var(--primary);
	text-decoration: none;
	font-size: 15px;
	font-weight: 600;
	padding: 12px 15px;
	border-radius: var(--radius);
	border: 1px solid rgba(32, 42, 77, 0.08);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	transition: background-color 0.2s, transform 0.15s ease, box-shadow 0.2s;
}

nav a:hover {
	background: var(--white);
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

nav a.active {
	background: var(--accent);
	color: var(--white);
	border-color: rgba(255, 255, 255, 0.35);
}

nav .nav-section-link:first-of-type {
	margin-top: 22px;
}

.nav-date-clear-button {
	background: rgba(255, 255, 255, 0.18);
	color: var(--white);
	border: 1px solid rgba(255, 255, 255, 0.5);
	font-size: 12px;
	font-weight: 500;
	padding: 8px 10px;
	border-radius: var(--radius);
	cursor: pointer;
	text-align: center;
	transition: background-color 0.2s, color 0.2s;
	font-family: inherit;
	width: 100%;
}

.nav-date-clear-button:hover {
	background: var(--white);
	color: var(--primary);
}

.nav-date-filter-panel {
	margin-top: 90px;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 10px;
	padding: 10px;
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nav-date-filter-title {
	margin: 0 0 2px 0;
	color: var(--white);
	font-size: 12px;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	font-weight: 600;
	opacity: 0.92;
}

.nav-date-label {
	color: var(--white);
	font-size: 12px;
	font-weight: 600;
	margin-bottom: -4px;
}

.nav-date-input {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid rgba(32, 42, 77, 0.2);
	border-radius: var(--radius);
	padding: 9px 10px;
	font-family: inherit;
	font-size: 13px;
	color: var(--primary);
	background: rgba(255, 255, 255, 0.96);
	outline: none;
}

.nav-date-input:focus {
	border-color: var(--secondary);
	box-shadow: 0 0 0 2px rgba(0, 122, 141, 0.18);
}

.main-content {
	flex: 1; /* Prend tout l'espace restant */
	display: flex;
	flex-direction: column;
	height: 100vh; /* Important pour que le flex fonctionne */
	position: relative;
}

.main-content::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image: url('images/fond.png');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-attachment: fixed; /* Le fond reste fixe au défilement */
	opacity: 0.48; /* Ajustez pour un effet plus ou moins prononcé */
	z-index: -1; /* Place le fond derrière le contenu */
}

.main-content::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image: url('images/logo_stat.png');
	background-size: 210px auto;
	background-position: right 20px bottom 70px;
	background-repeat: no-repeat;
	background-attachment: fixed;
	opacity: 0.82;
	z-index: -1;
}

.content-wrapper {
	flex-grow: 1; /* S'étire pour prendre l'espace disponible */
	overflow-y: auto; /* C'est ici que le défilement se produit */
	padding: 25px;
}

section {
	background: var(--white);
	padding: 20px;
	margin-bottom: 25px;
	border-radius: 12px; /* Coins plus arrondis */
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	border: 1px solid #efefef;
}

section:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.dashboard-section {
	display: none;
}

.dashboard-section.is-visible {
	display: block;
}

.section-placeholder {
	margin-bottom: 20px;
	padding: 16px 18px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.86);
	border: 1px solid #e8ebf3;
	color: var(--primary);
	font-weight: 500;
}

footer {
	bottom: 0; /* Positionné en bas */
	z-index: 10;
	padding: 10px 25px;
	background: rgba(255, 255, 255, 0.75);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border-top: 1px solid rgba(255, 255, 255, 0.2);
	color: var(--primary);
	font-size: 12px;
	font-weight: 500;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px;
}

.footer-logo {
	height: 24px;
}

.footer-logicim-logo {
	position: absolute;
	right: 25px;
	top: 50%;
	transform: translateY(-50%);
	height: 35px;
}

section h2 {
	margin-top: 0;
	font-size: 20px;
	color: var(--primary);
	border-left: 5px solid var(--accent);
	padding-left: 10px;
}

.section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
	font-size: 14px;
}

th, td {
	border: 1px solid var(--border);
	padding: 10px;
	text-align: left;
}

th {
	background: #e9eef2;
	font-weight: 600;
}

tr:nth-child(even) {
	background: #fafafa;
}

tr:hover {
	background: #f2f7fa;
}

.chart-container {
	margin-top: 20px;
	max-width: 700px;
	/* Limite la largeur du graphique, vous pouvez ajuster cette valeur */
	margin-left: auto; /* Centre le graphique */
	margin-right: auto; /* Centre le graphique */
}

/* Règle spécifique pour réduire la taille du camembert */
#concessions .chart-container {
	max-width: 450px;
}

/* Nouveau style pour la mise en page en 2 colonnes */
.flex-container {
	display: flex;
	gap: 25px; /* Espace entre les colonnes */
	align-items: flex-start; /* Aligne les éléments en haut */
}

.flex-container>div {
	flex: 1; /* Chaque colonne prend 50% de l'espace disponible */
	min-width: 0; /* Empêche le contenu de déborder */
}

/* Style pour le nouvel indicateur de chargement */
.loader-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 150px;
}

.loader {
	border: 5px solid var(--light);
	border-top: 5px solid var(--secondary);
	border-radius: 50%;
	width: 40px;
	height: 40px;
	animation: spin 1s linear infinite;
}

@keyframes spin { 
	0% {transform: rotate(0deg);} 
	100% {transform: rotate(360deg);}
}

/* =================================================================== */
/*                      STYLES POUR LE RESPONSIVE                      */
/* =================================================================== */
@media ( max-width : 992px) {
	body {
		flex-direction: column; /* La nav passe au-dessus du contenu */
	}
	nav {
		width: 100%;
		height: auto;
		position: static; /* La nav n'est plus collée à gauche */
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: center;
	}
	nav .nav-section-link:first-of-type {
		margin-top: 0;
	}
	.nav-date-filter-panel {
		margin-top: 0;
	}
	.main-content::after {
		background-size: 150px auto;
		background-position: right 12px bottom 86px;
	}
	header {
		justify-content: flex-start; /* On aligne le titre à gauche */
	}
	.flex-container {
		flex-direction: column; /* Les tableaux et graphiques s'empilent */
	}
}

/* Styles pour l'impression et l'export */
.section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-button, .csv-button {
	background: var(--secondary);
	color: var(--white);
	border: none;
	padding: 8px 15px;
	border-radius: var(--radius);
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.2s;
}

.print-button:hover {
	background: var(--primary);
}

.csv-button {
    background: #1f7f43;
}

.csv-button:hover {
    background: #176236;
}

@media print {
	body>*:not(.print-target), .print-target .print-button {
		display: none;
	}
	.print-target {
		display: block !important;
	}
}