body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.6;
    background-color: #f4f4f4;
    overflow-x: hidden; /* Important pour éviter le scroll horizontal indésirable */
}

header {
    background-color: #fff;
    color: #333;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

header .logo img {
    height: 60px;
}

nav {
    display: flex; /* Pour aligner les éléments du nav */
    align-items: center;
}

.menu-toggle {
    display: none; /* Caché par défaut sur les grands écrans */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    margin-left: 1.5rem;
}

.menu-toggle span {
    height: 3px;
    background-color: #333;
    transition: all 0.3s ease;
}

nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a {
    color: #555;
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: #007bff;
}

main {
    padding: 2rem;
}

footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.section-padding {
    padding: 80px 2rem 60px; /* Ajout de padding en bas */
}

.section-title {
    font-size: 2.5em;
    color: #333;
    text-align: center;
    margin-bottom: 1.5em;
}

.light-title {
    color: #fff;
}

/* Section "Accueil" */
#accueil {
    padding-top: 100px; /* Compenser le header sticky */
    text-align: center;
}

#accueil h1 {
    font-size: 3.5em;
    color: #007bff;
    margin-bottom: 0.5em;
}

#accueil .subtitle {
    font-size: 1.5em;
    color: #555;
    margin-bottom: 1em;
}

/* Section "Qui sommes-nous ?" */
#qui {
    padding-top: 100px; /* Compenser le header sticky */
}

#qui .flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

#qui .flex-item {
    flex: 1 1 calc(50% - 20px);
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#qui .flex-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#qui h3 {
    color: #007bff;
    margin-top: 0;
}

#qui ul {
    list-style: none;
    padding: 0;
}

#qui ul li {
    margin-bottom: 0.5em;
}

#qui .contact-info {
    text-align: center;
    margin-top: 2rem;
}

#qui .contact-info a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

/* Section "Présentation" */
#presentation {
    padding-top: 100px; /* Compenser le header sticky */
    padding-bottom: 0; /* Supprimer le padding par défaut pour l'intro */
    margin-bottom: 0;
}

.presentation-intro {
    text-align: center;
    padding: 40px 2rem;
}

.presentation-intro h2 {
    color: #333;
    margin-bottom: 0.5em;
}

.presentation-intro .centered-subtitle {
    color: #555;
    font-size: 1.2em;
    margin-bottom: 1.5em;
}

#presentation ~ section {
    padding-top: 60px; /* Ajouter du padding au début de la section suivante */
}

#presentation ~ section .flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
}

#presentation ~ section .presentation-item {
    flex: 1 1 calc(50% - 20px);
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#presentation ~ section h3 {
    color: #007bff;
    margin-top: 0;
}

/* Section "Accès sécurisé" */
#acces-securise {
    padding-top: 100px; /* Compenser le header sticky */
    background: linear-gradient(135deg, #e0e0e0 0%, #c0c0c0 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px); /* Ajuster la hauteur pour le footer */
    padding: 2rem;
    text-align: center;
}

#acces-securise .container {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#acces-securise .logos-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

#acces-securise .partner-logo {
    width: 150px;
    height: auto;
    cursor: pointer;
    transition: transform 0.3s ease;
    opacity: 0.8;
}

#acces-securise .partner-logo:hover {
    transform: scale(1.1);
    opacity: 1;
}

#acces-securise p.light-text {
    color: #555;
    font-size: 1.1em;
}

/* Styles pour la fenêtre modale */
.modal {
    display: none; /* Masqué par défaut */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8); /* Fond semi-transparent plus foncé */
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto; /* Réduit la marge */
    padding: 20px;
    border: none; /* Enlever la bordure */
    width: 95%; /* Prend presque toute la largeur */
    height: 95%; /* Prend presque toute la hauteur */
    position: relative;
    display: flex;
    flex-direction: column;
}

.close-button {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px; /* Un peu plus à droite */
    cursor: pointer;
    z-index: 1001; /* Pour être au-dessus de l'iframe */
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
}

#popup-iframe {
    width: 100%;
    height: 100%; /* L'iframe remplit le contenu modal */
    border: none;
    flex-grow: 1; /* L'iframe grandit pour occuper l'espace */
}

/* Styles pour les écrans plus petits (mobile) */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .menu-toggle {
        display: flex; /* Afficher le menu hamburger */
        margin-left: 0;
        margin-top: 1rem;
    }

    nav {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        margin-top: 1rem;
        display: none; /* Cacher le menu par défaut sur mobile */
    }

    nav.open {
        display: flex; /* Afficher le menu quand la classe 'open' est ajoutée */
    }

    nav ul {
        flex-direction: column;
        width: 100%;
    }

    nav ul li {
        margin-left: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    nav ul li a {
        display: block;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #eee;
    }

    nav ul li:last-child a {
        border-bottom: none;
    }

    #accueil {
        padding-top: 120px; /* Ajuster pour le header plus grand sur mobile */
    }

    .section-padding {
        padding-top: 120px; /* Ajuster pour le header plus grand sur mobile */
        padding-bottom: 40px;
    }

    #qui {
        padding-top: 120px;
    }

    #presentation {
        padding-top: 120px;
    }

    #presentation ~ section {
        padding-top: 40px;
    }

    #acces-securise {
        padding-top: 120px;
        min-height: auto; /* Ajuster la hauteur pour le contenu */
    }

    #acces-securise .logos-container {
        gap: 20px;
    }

    #acces-securise .partner-logo {
        width: 120px;
    }

    #qui .flex-item {
        flex: 1 1 100%; /* Une colonne sur mobile */
    }

    #presentation ~ section .presentation-item {
        flex: 1 1 100%; /* Une colonne sur mobile */
    }
}

/* JavaScript pour le menu hamburger */
const menuToggle = document.querySelector('.menu-toggle');
const navMenu = document.querySelector('nav');
const navLinks = document.querySelectorAll('nav a');

if (menuToggle) {
    menuToggle.addEventListener('click', () => {
        navMenu.classList.toggle('open');
    });
}

navLinks.forEach(link => {
    link.addEventListener('click', () => {
        if (window.innerWidth <= 768) {
            navMenu.classList.remove('open'); // Ferme le menu après un clic sur un lien (sur mobile)
        }
        // Le comportement de scroll vers la section est géré par l'attribut href des liens
    });
});

/* Ajustement du scroll-margin-top pour compenser le header sticky */
html {
    scroll-behavior: smooth;
}

#accueil {
    scroll-margin-top: 80px; /* Ajuste en fonction de la hauteur du header */
}

#qui {
    scroll-margin-top: 80px;
}

#presentation {
    scroll-margin-top: 80px;
}

#acces-securise {
    scroll-margin-top: 80px;
}