/* Styles généraux du corps de la page (body) */
body {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    display: flex; /* Le body est un conteneur flex */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #7f93ad;
    text-align: justify;
}

/* Styles du conteneur des images */
.image-gallery-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 90%;
}

/* Nouveau style pour l'enveloppe de chaque image */
.image-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transform: scale(0.98);
    transition: transform 0.3s ease-in-out;
}

/* Styles pour le titre masqué */
.image-title {
    position: absolute;
    top: -30px;
    width: 100%;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 5px 0;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    z-index: 2;
}

/* Effet de survol sur l'enveloppe de l'image */
.image-wrapper:hover .image-title {
    opacity: 1;
    visibility: visible;
}

/* Styles individuels des images et effet par défaut */
.image-wrapper img {
    width: 200px;
    height: auto;
    display: block;
    border-radius: 4px;
    object-fit: cover;
    filter: brightness(1.5) grayscale(0.8);
    transition: filter 0.3s ease-in-out;
}

/* Effet de survol sur l'image (via le wrapper) */
.image-wrapper:hover {
    transform: scale(1.02);
    z-index: 1;
}

/* Effet de survol sur l'image : quand on survole une image */
.image-wrapper:hover img {
    filter: brightness(1) grayscale(0);
}

/* Décalage des 2ème et 4ème wrappers vers le bas */
.image-wrapper:nth-child(2),
.image-wrapper:nth-child(4) {
    transform: translateY(50px) scale(0.98);
}

/* Correction pour le décalage au survol */
.image-wrapper:nth-child(2):hover,
.image-wrapper:nth-child(4):hover {
    transform: translateY(50px) scale(1.02);
}

/* IMPORTANT : Ajuster le chevauchement sur les wrappers, pas les images */
.image-gallery-container .image-wrapper:nth-child(n+2) {
    margin-left: -30px;
}


/* Media Queries pour la réactivité (adapté aux petits écrans) */
@media (max-width: 768px) {
    .image-wrapper img {
        width: 150px;
    }
    .image-gallery-container .image-wrapper:nth-child(n+2) {
        margin-left: -20px;
    }
    .image-wrapper:nth-child(2),
    .image-wrapper:nth-child(4) {
        transform: translateY(15px) scale(0.98);
    }
    .image-wrapper:nth-child(2):hover,
    .image-wrapper:nth-child(4):hover {
        transform: translateY(15px) scale(1.02);
    }
    .image-title {
        top: -25px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .image-gallery-container {
        gap: 10px;
    }
    .image-wrapper img {
        width: 100px;
    }
    .image-gallery-container .image-wrapper:nth-child(n+2) {
        margin-left: -15px;
    }
    .image-wrapper:nth-child(2),
    .image-wrapper:nth-child(4) {
        transform: translateY(10px) scale(0.98);
    }
    .image-wrapper:nth-child(2):hover,
    .image-wrapper:nth-child(4):hover {
        transform: translateY(10px) scale(1.02);
    }
    .image-title {
        top: -20px;
        font-size: 0.9em;
        padding: 3px 0;
    }
}

/* ========================================= */
/* STYLES POUR LA POPUP (MODALE) */
/* ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #7f93ad;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 80%;
    max-width: 700px;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease-in-out;
    max-height: 90vh; /* La modale a une hauteur maximale */
    overflow: hidden; /* La modale elle-même ne défile pas */
    color: #fff;
    display: flex;
    flex-direction: column;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content hr {
    border-color: rgba(255, 255, 255, 0.3);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #fff;
    transition: color 0.2s ease-in-out;
}

.close-button:hover {
    color: #eee;
}

.tabs-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Permet à tabs-container de prendre l'espace restant */
    min-height: 0; /* Important pour les flex items avec overflow */
}

.tabs-nav {
    display: flex;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 20px;
    flex-wrap: wrap;
    flex-shrink: 0; /* Empêche les boutons de rétrécir */
}

.tab-button {
    background-color: transparent;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    color: #eee;
    transition: background-color 0.3s, color 0.3s;
    outline: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-button img {
    height: 18px;
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
}

.tab-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tab-button.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: bold;
    border-bottom: 2px solid #007bff;
}

/* Zone de contenu des onglets (où se trouvent les tab-pane et où le défilement doit se produire) */
.tabs-content {
    flex-grow: 1; /* Il prend tout l'espace disponible dans tabs-container */
    min-height: 0; /* Essentiel pour que l'overflow fonctionne correctement dans un flex item */

    /* La hauteur maximale est définie par le calcul de l'espace restant.
       Nous devons estimer la hauteur de tout ce qui se trouve au-dessus :
       - padding haut/bas de .modal-content (2 * 30px = 60px)
       - Hauteur estimée de h2 + hr (disons 50px)
       - margin-top de .tabs-container (20px)
       - Hauteur estimée de .tabs-nav (padding + font-size ~ 40px + margin-bottom 20px = 60px)
       TOTAL ESTIMÉ à retirer de 90vh : 60 + 50 + 20 + 60 = 190px.
       Ce "190px" est LA VALEUR LA PLUS SUSCEPTIBLE D'AVOIR BESOIN D'AJUSTEMENT.
       Si la barre est trop petite, diminuez ce chiffre. Si elle est trop grande (déborde), augmentez-le.
    */
    max-height: calc(90vh - 190px); /* Ajustez '190px' si la barre est toujours trop petite/absente */

    overflow-y: auto; /* Active le défilement si le contenu dépasse cette max-height */

    padding: 10px 0; /* Padding interne pour le contenu du défilement */
    box-sizing: border-box; /* Inclure le padding dans la hauteur */

    /* Personnalisation de la barre de défilement (WebKit/Chrome/Safari) */
    scrollbar-width: thin; /* Pour Firefox */
    scrollbar-color: #007bff rgba(255, 255, 255, 0.1); /* thumb color / track color */
}

/* Styles pour le track (la "piste" de la barre) */
.tabs-content::-webkit-scrollbar {
    width: 8px; /* Largeur de la barre */
    height: 8px; /* Pour la barre horizontale si besoin */
}

.tabs-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1); /* Couleur de fond de la piste */
    border-radius: 10px;
}

/* Styles pour le thumb (le "pouce" que l'on manipule) */
.tabs-content::-webkit-scrollbar-thumb {
    background-color: #007bff; /* Couleur du pouce (votre couleur primaire) */
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1); /* Petite bordure pour le détacher du track */
}

.tabs-content::-webkit-scrollbar-thumb:hover {
    background-color: #0056b3; /* Couleur au survol du pouce */
}


.tab-pane {
    display: none; /* Toujours caché par défaut */
    font-size: 14px;
    line-height: 1.6;
    color: #fff;
    /* Aucun positionnement spécial ou overflow ici, car c'est tabs-content qui gère le défilement */
}

.tab-pane.active {
    display: block; /* Rend l'onglet actif visible */
}

/* Cache les modèles de contenu qui sont dans le HTML */
.hidden-modal-template {
    display: none;
}

/* NOUVEAUX STYLES POUR LES CARTES */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    justify-content: center;
    /* Aucune propriété de hauteur fixe ou flex-grow, il doit simplement contenir les cartes */
}

.card-item {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    line-height: 1.5;
    word-wrap: break-word;
    color: #fff; /* Couleur du texte par défaut pour la carte */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-item img.card-icon {
    width: 240px;
    height: auto;
    margin-bottom: 10px;
}

.card-item a {
    color: inherit; /* Le lien hérite de la couleur du texte de son parent (.card-item) */
    text-decoration: none; /* Supprime le soulignement par défaut */
}

.card-item a:hover {
    text-decoration: underline; /* Ajoute le soulignement au survol */
}


/* Media Queries pour la modale sur les petits écrans */
@media (max-width: 600px) {
    .modal-content {
        width: 90%;
        padding: 20px;
    }
    .tab-button {
        padding: 8px 15px;
        font-size: 14px;
    }
    .tab-button img {
        height: 16px;
        margin-right: 5px;
    }
    .cards-container {
        grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
        gap: 10px;
    }
    .card-item {
        padding: 12px;
        font-size: 0.9em;
    }
    .card-item img.card-icon {
        width: 180px;
    }
}