/* --- MEGA MENU SETFORGE - VERSION FINALE STABILISÉE --- */

/* Empêche le panneau de rester bloqué si on survole Careers/Investors */
.sf-main-menu > li:not(.sf-has-sub):hover ~ li .sf-mega-panel,
.sf-main-menu > li:not(.sf-has-sub):hover .sf-mega-panel {
    display: none !important;
}
/* S'assurer que Careers et Investors n'ont pas de pointeur d'événement sur un panel fantôme */
.menu-title-blue:not(.sf-has-sub) {
    position: relative;
    z-index: 10;
}

@media (min-width: 981px) {
    /* Conteneur principal */
    .et-l--header ul { padding: 0px !important; }
    #sf-mega-wrapper { 
        position: relative; 
        width: 100%; 
        margin-top: 10px; 
        display: block; 
    }

    /* Menu horizontal (Onglets) */
    .sf-main-menu {
        display: flex !important;
        gap: 40px;
        list-style: none !important;
        position: relative;
        margin: 0; padding: 0;
        font-size: 16px;
    }

    .sf-main-menu > li { position: static !important; }

    .sf-main-menu > li > a {
        display: block;
        margin-top: 20px;
        margin-bottom: 20px;
        padding: 0px 6px 0px 5px !important;
        color: #fff;
        font-weight: bold;
        text-transform: uppercase;
        text-decoration: none !important;
        transition: background-color 0.3s ease-in-out;
    }

    /* HOVERS ONGLETS : Le cadre de couleur apparaît uniquement au survol */
    .menu-title-blue:hover > a { background-color: #5191cd !important; color: #fff !important; }
    .menu-title-orange:hover > a { background-color: #f28705 !important; color: #fff !important; }
    .menu-title-green:hover > a { background-color: #009358 !important; color: #fff !important; }

    /* PANNEAU DÉROULANT (MEGA PANEL) */
    .sf-mega-panel {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: calc(100vw - 15%);
        max-width: 1450px;
        height: 350px;
        z-index: 9999;
        flex-direction: row;
        border: none !important;
        background-color: rgba(44, 73, 100, 0.9) !important;
        backdrop-filter: blur(10px) brightness(1.05) !important;
    }

    /* Colonne Image (Gauche) */
    .sf-mega-image-col {
        flex: 0 0 350px;
        width: 350px;
        height: 350px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

    /* Wrapper de contenu (Titres + Grilles) */
    .sf-text-wrapper { 
        display: flex !important; 
        flex-grow: 1; 
        padding: 20px !important; 
        gap: 40px !important; /* Espace entre Col 1 et Col 2 */
        align-items: flex-start;
    }

    /* COLONNE 1 : Titres (History, Companies, Know-how...) */
    .sf-col-titles {
        flex: 0 0 240px !important; /* Largeur fixe pour stabiliser l'alignement */
        list-style: none !important;
        display: flex !important;
        flex-direction: column;
        gap: 10px !important;
        margin: 0; padding: 0;
    }

    .sf-col-titles li a {
        color: #fff !important;
        font-weight: bold;
        text-transform: uppercase;
        text-decoration: none !important;
    }

    /* COLONNE 2 : Grilles de liens (Le contenu qui change) */
    .sf-col-content { 
        flex: 1; 
        display: block !important; 
    }

    /* STRUCTURE DES GRILLES (Serrées sur le texte) */
    .sf-grid-links, .sf-grid-companies {
        display: inline-grid !important; /* Force la grille à ne pas prendre 100% de largeur */
        grid-auto-flow: column !important;
        grid-column-gap: 35px !important; /* Écart maîtrisé entre les colonnes de texte */
        grid-row-gap: 8px !important;
        grid-auto-columns: max-content !important; /* Aligne les colonnes au plus près du texte */
        list-style: none !important;
        margin: 0; padding: 0;
    }

    /* MARKETS & STANDARDS : 9 items max par colonne */
    .sf-grid-links {
        grid-template-rows: repeat(9, min-content) !important;
    }

    /* SOCIÉTÉS : 6 items max (Correction Near Net pour écrans classiques) */
    .sf-grid-companies {
        grid-template-rows: repeat(6, min-content) !important;
    }

    /* Style des liens dans les grilles */
    .sf-grid-links li a, .sf-grid-companies li a { 
        color: #fff !important;
        font-weight: normal; 
        font-size: 15px;
        text-transform: uppercase;
        text-decoration: none !important;
        white-space: nowrap !important; /* Empêche les retours à la ligne */
        transition: color 0.3s;
    }

    /* HOVERS INTERNES (Couleurs selon l'onglet parent) */
    /* Bleu */
    .menu-title-blue .sf-col-titles li:hover > a, 
    .menu-title-blue .sf-col-content li:hover a { color: #5191cd !important; }
    /* Orange */
    .menu-title-orange .sf-col-titles li:hover > a, 
    .menu-title-orange .sf-col-content li:hover a { color: #f28705 !important; }
    /* Vert */
    .menu-title-green .sf-col-titles li:hover > a, 
    .menu-title-green .sf-col-content li:hover a { color: #009358 !important; }

    /* Icônes de flèche */
    .sf-col-titles li i { display: none; }
    .sf-col-titles li.has-grand-children i { display: inline-block; margin-left: 10px; }

    /* Données cachées */
    .sf-hidden-data { display: none !important; }
	
	/* Style pour le sélecteur de langue */
	.sf-menu-language-switcher {
		display: flex;
		align-items: center;
		color: #fff;
		font-size: 14px;
		font-weight: bold;
		text-transform: uppercase;
		margin-left: 10px; /* Écart après Investors */
	}

	/* Langue inactive (Lien cliquable) */
	.sf-menu-language-switcher a.sf-lang-inactive {
		color: rgba(255, 255, 255, 0.6) !important;
		text-decoration: none !important;
		transition: color 0.3s ease;
	}

	.sf-menu-language-switcher a.sf-lang-inactive:hover {
		color: #fff !important;
	}

	/* LANGUE ACTIVE : Coloriée en bleu Setforge */
	.sf-menu-language-switcher .sf-lang-active {
		color: #5191cd !important;
	}

	/* Séparateur | */
	.sf-menu-language-switcher .sf-lang-separator {
		color: rgba(255, 255, 255, 0.4);
		margin: 0 5px;
	}
}

/* Cache le menu sur mobile (Divi s'occupe du menu mobile standard) */
@media (max-width: 980px) {
    #sf-mega-wrapper { display: none !important; }
}