body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #212b36; /* Darker blue background */
    color: #ecf0f1; /* Light gray text */
    transition: background-color 0.3s ease;
}

header {
    background-color: #2c3e50; /* Darker header blue */
    color: #fff;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: fadeInDown 1s ease-out;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

nav ul li a {
    color: #1abc9c; /* Teal for links */
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 8px 15px;
    border: 2px solid #1abc9c;
    border-radius: 25px;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    display: inline-block;
}

nav ul li a:hover {
    background-color: #1abc9c;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

main {
    padding: 30px;
    max-width: 1000px;
    margin: 30px auto;
    background-color: #34495e; /* Darker main content blue */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
    transition: transform 0.5s ease-out, box-shadow 0.3s ease;
}

main:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.info-section {
    margin-bottom: 40px;
    padding: 20px;
    background-color: #3e5163; /* Darker blue for sections */
    border-left: 5px solid #1abc9c; /* Teal accent */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 1s ease-out forwards;
    opacity: 0;
}

.info-section:nth-child(1) { animation-delay: 0.2s; } /* Situation administrative */
.info-section:nth-child(2) { animation-delay: 0.4s; } /* Informations géographiques */
.info-section:nth-child(3) { animation-delay: 0.6s; } /* Données démographiques */
.info-section:nth-child(4) { animation-delay: 0.8s; } /* Carte */
.info-section:nth-child(5) { animation-delay: 1.0s; } /* Agenda */
.info-section:nth-child(6) { animation-delay: 1.2s; } /* Patrimoine */
.info-section:nth-child(7) { animation-delay: 1.4s; } /* Rando */
.info-section:nth-child(8) { animation-delay: 1.6s; } /* Synthèse INSEE (now last) */

.info-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.info-section h2 {
    color: #1abc9c; /* Teal for headings */
    border-bottom: 3px solid #16a085; /* Darker teal border */
    padding-bottom: 12px;
    margin-bottom: 20px;
    font-size: 2rem;
    position: relative;
    padding-left: 10px;
    text-align: center;
    overflow: hidden; /* Ensure the pseudo-element doesn't spill */
}

.info-section h2::before {
    content: none; /* Remove the star content */
}

.info-section.animate-title h2::after,
.info-section h2:hover::after { /* Apply animation on hover as well */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #1abc9c, transparent); /* Gradient for the wipe effect */
    transform: translateX(-100%);
    animation: titleWipe 1.5s ease-out forwards;
}

@keyframes titleWipe {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section ul li {
    background-color: #4a617c; /* Darker list item blue */
    margin-bottom: 10px;
    padding: 12px 20px;
    border-radius: 6px;
    border-left: 4px solid #2ecc71; /* Green accent border */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.info-section ul li:hover {
    background-color: #5d7a96; /* Darker hover for list items */
    transform: translateX(5px);
}

.info-section ul ul { /* For nested lists like coordinates */
    margin-top: 10px;
    background-color: #5d7a96; /* Darker nested list blue */
    padding: 15px;
    border-radius: 8px;
    border-left: none;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

.info-section ul ul li {
    background-color: transparent;
    padding: 5px 0;
    margin-bottom: 5px;
    border-left: none;
}

/* Table styles for demographic data */
.info-section table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    background-color: #3e5163; /* Same as section background */
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.info-section th, .info-section td {
    border: 1px solid #4a617c; /* Darker border for table cells */
    padding: 12px 15px;
    text-align: left;
}

.info-section th {
    background-color: #1abc9c; /* Teal for table headers */
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.info-section th:hover {
    background-color: #16a085;
}

.info-section tr:nth-child(even) {
    background-color: #4a617c; /* Alternate row color */
}

.info-section tr:hover {
    background-color: #5d7a96; /* Hover effect for rows */
    transition: background-color 0.2s ease;
}

/* Style for "Année" and "Statut" table headers */
.info-section th:nth-child(3), /* Année */
.info-section th:nth-child(4) { /* Statut */
    background-color: #2c3e50; /* Darker blue for these specific headers */
    color: #ecf0f1; /* Light gray text */
}

.info-section th:nth-child(3):hover, /* Année hover */
.info-section th:nth-child(4):hover { /* Statut hover */
    background-color: #34495e; /* Slightly lighter dark blue on hover */
}

/* Style for cells under "Année" and "Statut" */
.info-section td:nth-child(3), /* Année data */
.info-section td:nth-child(4) { /* Statut data */
    background-color: #3e5163; /* Darker blue for these specific cells */
    color: #ecf0f1; /* Light gray text */
}

.info-section tr:nth-child(even)   td:nth-child(3),
.info-section tr:nth-child(even)   td:nth-child(4) {
    background-color: #4a617c; /* Ensure alternate row color is darker for these cells too */
}

.info-section tr:hover td:nth-child(3),
.info-section tr:hover td:nth-child(4) {
    background-color: #5d7a96; /* Hover effect for these cells */
}

/* Map Placeholder */
.map-placeholder {
    width: 100%;
    height: 450px;
    background-color: #2c3e50;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ecf0f1;
    font-size: 1.2rem;
}

.map-placeholder iframe {
    display: block; /* Remove extra space below iframe */
}

footer {
    text-align: center;
    padding: 25px;
    background-color: #2c3e50; /* Same as header background */
    color: #fff;
    margin-top: 30px;
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    animation: fadeInUp 1s ease-out;
}

/* Keyframe Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        margin: 15px;
        padding: 20px;
    }
    .info-section h2 {
        font-size: 1.8rem;
    }
    .info-section th, .info-section td {
        padding: 10px;
    }
    header h1 {
        font-size: 2rem;
    }
    nav ul {
        gap: 10px;
    }
    nav ul li a {
        padding: 6px 10px;
        font-size: 1rem;
    }
    .map-placeholder {
        height: 300px; /* Adjust map height for smaller screens */
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    .info-section ul li {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    .info-section ul ul {
        padding: 10px;
    }
    .info-section th, .info-section td {
        font-size: 0.85rem;
        padding: 8px;
    }
    .info-section h2::before {
        font-size: 1em;
        left: -5px;
    }
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    nav ul li a {
        width: 80%; /* Make buttons wider */
        max-width: 200px;
        text-align: center;
    }
    .map-placeholder {
        height: 200px; /* Further adjust map height for very small screens */
    }
}

/* Back Button Styles */
.back-button-container {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 20px;
}

.back-button {
    display: inline-block;
    background-color: #d35400; /* Darker orange color */
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.back-button:hover {
    background-color: #e67e22; /* Retain original hover color or make it slightly lighter */
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* En savoir plus Button Styles */
.more-info-button-container {
    text-align: center;
    margin-top: 20px;
}

.more-info-button {
    display: inline-block;
    background-color: transparent; /* Make background transparent */
    color: #1abc9c; /* Teal color for text */
    padding: 8px 18px; /* Slightly less padding */
    border: 2px solid #1abc9c; /* Add a border */
    border-radius: 25px; /* Keep rounded corners */
    text-decoration: none;
    font-size: 0.95rem; /* Slightly smaller font */
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: none; /* Remove initial shadow */
}

.more-info-button:hover {
    background-color: #1abc9c; /* Teal background on hover */
    color: white; /* White text on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Add shadow on hover */
}