/* ==========================================================================
   ASSETS/CSS/MODULES.CSS - Styles pour la page des modules de FormaCouple
   (Version complète et révisée)
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* SECTION HERO                                                                */
/* -------------------------------------------------------------------------- */

.modules-hero {
    /* Valeur ajustée suite à la discussion sur la hauteur du header */
    /* Vous pouvez l'ajuster finement si nécessaire */
    padding-top: 16rem; /* Exemple: ajusté de 18rem */
    padding-bottom: 8rem;
    position: relative;
    overflow: hidden;
    background-color: var(--white-rock-light);
    /* Optionnel: Décommenter si vous avez une texture */
    /* background-image: url('../images/bg-texture-light.png'); */
    background-size: 200px;
    background-repeat: repeat;
}

.modules-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, var(--quicksand-light) 0%, transparent 60%);
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
}

.modules-hero .container {
    position: relative;
    z-index: 2;
}

.modules-hero .title {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.modules-hero .subtitle {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------------------------------------------------------------------------- */
/* NOUVELLE NAVIGATION DES MODULES (OVERVIEW)                                  */
/* -------------------------------------------------------------------------- */

.modules-overview-nav {
    padding: 5rem 0; /* Espacement vertical */
    background-color: white; /* Fond blanc pour cette section */
    margin-bottom: 5rem; /* Espace avant les détails des modules */
    border-top: 1px solid var(--white-rock-medium);
    border-bottom: 1px solid var(--white-rock-medium);
}

.modules-overview-title {
    font-size: 2.8rem;
    color: var(--black-pearl);
    margin-bottom: 3rem;
    text-align: center;
    font-weight: 600;
    position: relative;
}

.modules-overview-title::after {
    content: '';
    display: block;
    width: 6rem;
    height: 0.3rem;
    background: linear-gradient(to right, var(--walnut), var(--quicksand));
    margin: 1rem auto 0;
    border-radius: 999px;
}

.overview-nav-container {
    /* Pas besoin de style particulier ici, on stylise les lignes */
    width: 100%;
}

.overview-nav-row {
    display: flex;
    flex-wrap: wrap; /* Important pour le responsive desktop */
    justify-content: center; /* Pour centrer les éléments dans la ligne */
    gap: 2rem;
}

/* Ajouter une marge entre les deux lignes */
.overview-nav-row:not(:last-child) {
    margin-bottom: 2rem;
}

/* Ajustement de la taille des boutons pour qu'ils s'alignent bien */
.module-overview-button {
    /* On peut donner une largeur de base ou flex-basis */
    /* Exemple: pour s'assurer qu'ils ne deviennent pas trop larges sur certaines résolutions */
    flex: 0 1 220px; /* Ne grandit pas, rétrécit si besoin, base de 220px (ajuster si besoin) */
    /* Le reste des styles .module-overview-button reste inchangé */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    background-color: var(--white-rock-light);
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: var(--black-pearl);
    transition: all var(--transition-fast);
    box-shadow: var(--box-shadow-sm);
    min-height: 150px;
}

.module-overview-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    background-color: var(--white-rock-light);
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: var(--black-pearl);
    transition: all var(--transition-fast);
    box-shadow: var(--box-shadow-sm);
    min-height: 150px; /* Hauteur minimale pour l'équilibre */
}

.module-overview-button:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-md);
    border-color: var(--quicksand-light);
    background-color: white;
}

/* Style optionnel pour le bouton actif (si besoin via JS) */
.module-overview-button.active-nav-button {
    border-color: var(--walnut);
    background-color: var(--white-rock-medium);
}


.module-overview-icon {
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--walnut-light), var(--walnut));
    color: white;
    box-shadow: 0 4px 8px rgba(112, 58, 24, 0.2);
    transition: all var(--transition-fast);
}

.module-overview-button:hover .module-overview-icon {
    transform: scale(1.1);
}

.module-overview-icon i {
    width: 2.4rem;
    height: 2.4rem;
}

.module-overview-button span {
    font-weight: 500;
    font-size: 1.6rem;
    line-height: 1.3;
}

/* -------------------------------------------------------------------------- */
/* DÉTAILS DES MODULES                                                         */
/* -------------------------------------------------------------------------- */

.modules-content {
    /* Conteneur global si besoin d'espacement */
}

.module-detail {
    display: none; /* Caché par défaut, activé par JS */
    padding: 6rem 0 8rem; /* Espacement vertical */
    opacity: 0;
    transition: opacity 0.6s ease;
    position: relative;
    overflow: hidden;
}

.module-detail.active {
    display: block; /* Affiché par JS */
    opacity: 1;
    animation: fadeInModule 0.8s ease-out forwards;
}

/* Keyframes conservés */
@keyframes fadeInModule {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header de chaque module */
.module-header {
    margin-bottom: 4rem;
    position: relative;
}

.module-number {
    display: inline-block;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 2.2rem;
    color: var(--walnut);
    margin-bottom: 1.2rem;
    position: relative;
}

.module-number::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--walnut-light);
    border-radius: 2px;
}

.module-title {
    font-size: clamp(3.2rem, 5vw, 4.4rem);
    margin-bottom: 0.7rem;
    color: var(--black-pearl);
    line-height: 1.1;
}

/* Grille Texte / Image */
.module-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr; /* <-- COLONNES AJUSTÉES */
    gap: 5rem; /* L'espacement entre colonnes reste le même */
    align-items: center;
}

/* Grille Inversée */
.module-grid-reverse {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr; /* <-- COLONNES AJUSTÉES (ordre inversé !) */
    gap: 5rem;
    align-items: center;
    grid-template-areas: "image content"; /* Les zones restent les mêmes */
}

.module-grid-reverse .module-description {
    grid-area: content;
}

.module-grid-reverse .module-image {
    grid-area: image;
}

/* Description et Features */
.module-description {
    font-size: 1.8rem;
    color: var(--black-pearl-light);
    line-height: 1.7;
}

.module-description p {
    margin-bottom: 2.5rem;
}

.module-features {
    list-style: none;
    padding: 0;
    margin: 0 0 3.5rem 0;
}

.module-features li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.8rem;
    gap: 1.6rem;
    transition: transform 0.3s ease;
}

.module-features li:hover {
    transform: translateX(5px);
}

.module-features i {
    color: var(--walnut);
    flex-shrink: 0;
    margin-top: 0.4rem; /* Alignement icône/texte */
    transition: transform 0.3s ease;
    width: 1.8em; /* Taille icône check */
    height: 1.8em;
}

.module-features li:hover i {
    transform: scale(1.2);
}

.module-features span {
    flex: 1;
}

.module-description .btn {
    margin-top: 3rem;
}

/* Image du module */
.module-image {
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--box-shadow-md);
    position: relative;
    transition: all 0.4s ease;
}

.module-image:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--box-shadow-lg);
}

.module-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, rgba(112, 58, 24, 0.1) 0%, transparent 50%); /* Opacité réduite */
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.4s ease;
    opacity: 0.5; /* Opacité initiale légère */
}

.module-image:hover::before {
    opacity: 0; /* Disparaît au survol pour mieux voir l'image */
}

.module-image img {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    z-index: 0;
    transition: transform 0.6s ease;
}

.module-image:hover img {
    transform: scale(1.03);
}

/* ========================================================================== */
/* RESPONSIVE                                                                 */
/* ========================================================================== */

/* -------------------------------------------------------------------------- */
/* Grands écrans (pas de changement, géré par le CSS de base)                  */
/* -------------------------------------------------------------------------- */
@media (min-width: 1400px) {
    .module-grid,
    .module-grid-reverse {
        gap: 8rem; 
    }
}

/* -------------------------------------------------------------------------- */
/* Tablettes et petits desktops                                               */
/* -------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .modules-hero {
        padding-top: 14rem;
        padding-bottom: 6rem;
    }

    /* --- NOUVELLE MISE EN PAGE POUR LES DÉTAILS DE MODULES (MOBILE/TABLETTE) --- */

    /* On définit une nouvelle grille à une seule colonne pour le conteneur principal */
    .module-grid,
    .module-grid-reverse {
        display: grid;
        grid-template-columns: 1fr; /* Une seule colonne, c'est la clé */
        grid-template-areas: 
            "image"
            "content";
        gap: 0; /* On gère l'espacement manuellement avec les marges */
        align-items: start; /* On aligne le contenu en haut des zones */
    }

    /* L'image est assignée à sa zone et stylisée en médaillon */
    .module-grid .module-image,
    .module-grid-reverse .module-image {
        grid-area: image;
        
        /* Style du médaillon */
        width: 150px;
        height: 150px;
        border-radius: 50%;
        box-shadow: var(--box-shadow-md); /* On garde l'ombre */
        
        /* Positionnement */
        margin: 0 auto; /* Centre horizontalement */
        position: relative;
        z-index: 2; /* Pour passer au-dessus de la carte de texte */
    }

    /* Le texte est assigné à sa zone et stylisé en carte */
    .module-grid .module-description,
    .module-grid-reverse .module-description {
        grid-area: content;
        
        /* On le fait commencer "sous" l'image avec une marge négative */
        margin-top: -75px; /* Exactement la moitié de la hauteur de l'image (150px / 2) */
        
        /* Style de la carte de texte */
        background-color: white;
        border-radius: var(--border-radius-md);
        /* Le padding-top est calculé pour que le texte commence après l'image */
        padding: calc(75px + 2rem) 2.5rem 2.5rem 2.5rem;
        box-shadow: var(--box-shadow-sm);
    }

    .module-title {
        font-size: 3.6rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Mobiles larges et tablettes verticales (Transformation en Carrousel)      */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .modules-hero {
        padding-top: 12rem;
        padding-bottom: 5rem;
    }

    /* --- Styles du Carrousel Mobile pour la Navigation des Modules --- */
    .overview-nav-container {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* On ajoute un clip-path pour masquer tout ce qui pourrait déborder verticalement */
        clip-path: inset(0 -20px -20px -20px); 
        /* Important: on enlève le padding du conteneur */
        padding: 0;
    }
    .overview-nav-container::-webkit-scrollbar {
        display: none;
    }

    /* Les espaceurs au début et à la fin */
    .overview-nav-container::before,
    .overview-nav-container::after {
        content: '';
        /* Cet espaceur prend juste assez de place pour centrer une carte de 70% */
        flex: 0 0 15%; /* (100% - 70%) / 2 = 15% */
    }

    /* La structure des lignes est "aplatie" */
    .overview-nav-row {
        display: contents;
    }

    /* Chaque carte du carrousel */
    .overview-nav-container .module-overview-button {
        flex: 0 0 70%; /* La carte occupe 70% de la largeur */
        scroll-snap-align: center;
        /* On remet le padding à zéro, la taille est gérée par flex-basis */
        padding: 1.5rem 1rem;
        margin: 0 1rem; /* Marge entre les cartes */
    }

    .module-overview-icon {
        width: 4.5rem;
        height: 4.5rem;
        margin-bottom: 1rem;
    }

    .module-overview-button span {
        font-size: 1.4rem;
    }

    /* --- Fin des Styles du Carrousel --- */


    .module-detail {
        padding: 5rem 0 6rem;
    }
    
    .module-title {
        font-size: 3.2rem;
    }

    .module-grid,
    .module-grid-reverse {
        gap: 3rem;
    }

    .module-description {
        display: flex;
        flex-direction: column;
        align-items: center; /* Centre les éléments enfants horizontalement */
    }

    /* On s'assure que le texte et la liste restent alignés à gauche */
    .module-description p,
    .module-description .module-features {
        width: 100%; /* Reprend toute la largeur disponible */
        align-self: flex-start; /* Force l'alignement à gauche */
    }

    /* CTA Section */
    .cta-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .cta-buttons .btn {
        width: 100%;
        max-width: 30rem;
    }

    .cta-section {
        margin-bottom: 4rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Petits mobiles                                                             */
/* -------------------------------------------------------------------------- */
@media (max-width: 576px) {
    .modules-hero {
        padding-top: 10rem;
        padding-bottom: 4rem;
    }

    /* Ajustement des espaceurs et de la largeur des cartes pour les très petits écrans */
    .overview-nav-container::before,
    .overview-nav-container::after {
        flex: 0 0 calc((100% - 76% - 2rem) / 2);
    }

    .overview-nav-container .module-overview-button {
        flex-basis: 76%; /* Cartes un peu plus larges */
    }

    .module-title {
        font-size: 2.8rem;
    }
    
    .module-header {
        margin-bottom: 3rem;
    }

    .module-detail {
        padding: 4rem 0 5rem;
    }

    .module-features li {
        gap: 1rem;
    }
}