/* ---- GÉNÉRAL ET TYPOGRAPHIE ---- */
body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding-bottom: 100px; /* Ajout d'un espace en bas pour la barre de filtres */
}

main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

a {
    color: #007bff;
    text-decoration: none;
    word-break: break-all; /* Pour éviter que les longues URL ne dépassent */
}

a:hover {
    text-decoration: underline;
}

/* ---- EN-TÊTE ET PIED DE PAGE ---- */
header {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 2rem 1.5rem;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

header p {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    opacity: 0.9;
}

footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
    color: #666;
    border-top: 1px solid #ddd;
    margin-top: 40px;
}

/* ---- NOUVEAU: SECTION LÉGENDE ---- */
#legende-statut {
    max-width: 1200px;
    margin: 25px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#legende-statut h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.4rem;
}

.legende-contenu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 25px; /* Espace vertical et horizontal entre les items */
}

.legende-contenu p {
    margin: 0;
    font-size: 0.95rem;
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 5px;
}

.legende-contenu p strong {
    color: #007bff;
    font-weight: 700;
}


/* ---- SECTION DES FILTRES ---- */
#filtres {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    padding: 15px 20px;
    border-top: 2px solid #007bff;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap; /* Pour la responsivité */
    z-index: 1000;
}

.filtre-item {
    display: flex;
    flex-direction: column;
}

.filtre-item label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #34495e;
    margin-bottom: 5px;
}

.filtre-item input[type="text"],
.filtre-item select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    min-width: 220px;
}

/* ---- STYLES POUR LA RECHERCHE AVEC SUGGESTIONS ---- */
#recherche-container {
    position: relative; /* Contexte de positionnement pour les suggestions */
}

#suggestions-container {
    display: none; /* Caché par défaut */
    position: absolute;
    bottom: 100%; /* S'affiche au-dessus de la barre de filtres */
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    max-height: 300px; /* Hauteur maximale avant de scroller */
    overflow-y: auto;
    z-index: 1010; /* Doit être au-dessus de la barre de filtre */
    box-shadow: 0 -4px 8px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover, .suggestion-item.active {
    background-color: #007bff;
    color: white;
}

.suggestion-item small {
    display: block;
    color: #777;
    margin-top: 2px;
}

.suggestion-item:hover small, .suggestion-item.active small {
    color: #e0e0e0;
}


/* ---- MESSAGE D'ERREUR ---- */
.error-message, .no-results-message {
    background-color: #ffebee;
    border: 1px solid #c62828;
    color: #c62828;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
    text-align: center;
}
.no-results-message {
    background-color: #e3f2fd;
    border-color: #1e88e5;
    color: #1e88e5;
}


/* ---- SECTIONS DÉPLIABLES (RÉGIONS ET MRC) ---- */
details {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden; /* Pour que le border-radius s'applique aux enfants */
}

summary {
    padding: 1rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    outline: none; /* Enlève le contour bleu au focus */
    transition: background-color 0.2s ease-in-out;
}

summary:hover {
    background-color: #f9f9f9;
}

summary h2, summary h3 {
    display: inline;
    font-size: 1.5rem;
    margin: 0;
}

summary h3 {
    font-size: 1.2rem;
    color: #34495e;
}

/* Style de la flèche (marker) */
summary::marker {
    color: #007bff;
}

article.mrc {
    margin: 1rem 1.5rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

article.mrc details {
     border: 1px solid #e8e8e8;
}


/* ---- TABLEAUX DES MUNICIPALITÉS ---- */
.table-container {
    padding: 0 1.5rem 1.5rem 1.5rem;
    overflow-x: auto; /* Ajout pour la responsivité sur mobile */
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

thead tr {
    background-color: #e9ecef;
}

th {
    font-weight: 700;
    color: #495057;
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

tbody tr:hover {
    background-color: #e9ecef;
}

/* Statut de la municipalité (pour le différencier) */
td:nth-child(2) {
    font-weight: 700;
    text-align: center;
    width: 100px;
}