/* Sécurité : cacher le menu desktop si la fenêtre est trop petite */
@media (max-width: 980px) {
    .hr-main-menu { display: none !important; }
}

/* ==========================================================================
   CORRECTION Z-INDEX - Neutraliser les contextes d'empilement Divi
   ========================================================================== */

/* Neutraliser les z-index des modules Divi */
.et_pb_section,
.et_pb_row,
.et_pb_column,
.et_pb_module,
.et_pb_image,
.et_pb_text,
.et_pb_blurb,
.et_pb_with_background {
    z-index: auto !important;
}

/* ==========================================================================
   MENU PRINCIPAL
   ========================================================================== */

/* Container du menu - créer son propre contexte d'empilement isolé */
.hr-main-menu {
    padding: 0;
    margin: 12px 0px;
    position: relative;
    z-index: 999999 !important;
    isolation: isolate;
    
    /* Aligne les éléments enfants à gauche */
    display: flex !important;
    justify-content: flex-start !important;
}

.hr-main-menu > ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.hr-main-menu > ul > li {
    position: relative;
    margin: 0;
    padding: 0;
}

.hr-main-menu > ul > li > a {
    display: block;
    padding: 15px 15px;
    color: #fff;
    text-decoration: none;
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 18px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.hr-main-menu > ul > li > a:hover {
    color: #02c39a;
}

/* Icône chevron pour Destinations */
.hr-main-menu > ul > li.hr-destinations > a {
    padding-right: 30px;
    position: relative;
}

.hr-main-menu > ul > li.hr-destinations > a::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    transition: transform 0.3s ease;
}

.hr-main-menu > ul > li.hr-destinations.hr-open > a::after {
    transform: translateY(-50%) rotate(180deg);
}

/* ==========================================================================
   MEGA MENU DESTINATIONS
   ========================================================================== */

/* L'item Destinations */
.hr-main-menu > ul > li.hr-destinations {
    position: static; /* Pour que le mega menu prenne toute la largeur */
}

/* Le mega menu (grille de cartes) */
.hr-mega-menu {
    position: fixed; 
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
	background: color-mix(in srgb, #d4d4d4, #05668d 5%);
					  
    padding: 20px;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
    
    /* Animation plus douce */
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* IMPORTANT: empêche les événements souris quand fermé */
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease;
    
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    min-width: 920px;
    width: 1050px;
    max-width: 95vw;
    z-index: 999999 !important;
}

/* Supprimer toutes les puces des listes du menu */
/* ATTENTION: ne pas inclure .hr-country-links ici car on veut garder son padding */
.hr-mega-menu li,
.hr-main-menu > ul,
.hr-main-menu > ul > li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* hr-country-links : supprimer puces mais GARDER le padding-left */
.hr-country-links {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    margin-left: 0 !important;
}

/* Les LI dans hr-country-links : pas de padding-left non plus sur les li */
.hr-country-links > li {
    list-style: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Supprimer les pseudo-éléments ::before et ::marker qui peuvent créer des puces */
.hr-mega-menu li::before,
.hr-country-links::before,
.hr-country-links li::before,
.hr-main-menu ul::before,
.hr-main-menu li::before {
    content: none !important;
    display: none !important;
}

.hr-mega-menu li::marker,
.hr-country-links li::marker,
.hr-main-menu li::marker {
    content: none !important;
    display: none !important;
    font-size: 0 !important;
    color: transparent !important;
}

/* Afficher quand ouvert */
.hr-main-menu > ul > li.hr-destinations.hr-open > .hr-mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto; /* Réactive les événements souris quand ouvert */
}

/* Zone tampon invisible entre le lien Destinations et le mega-menu */
.hr-main-menu > ul > li.hr-destinations.hr-open::after {
    content: '';
    position: fixed;
    top: 48px; /* Hauteur approximative du lien Destinations */
    left: 0;
    right: 0;
    height: 40px; /* Couvre l'espace jusqu'au mega-menu à 80px */
    z-index: 999998;
    pointer-events: auto;
}

/* ==========================================================================
   CARTES PAYS
   ========================================================================== */

.hr-country-card {
    position: relative;
    min-height: 260px;
    border-radius: 16px;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Images de fond par pays */
.hr-country-card[data-country="corse"] {
    background-image: url('https://www.horizonrando.fr/wp-content/uploads/2026/01/Megamenu-8.jpg');
}

.hr-country-card[data-country="norvege"] {
    background-image: url('https://www.horizonrando.fr/wp-content/uploads/2026/01/Megamenu-14.jpg');
}

.hr-country-card[data-country="islande"] {
    background-image: url('https://www.horizonrando.fr/wp-content/uploads/2026/01/Megamenu-12.jpg');
}

.hr-country-card[data-country="ecosse"] {
    background-image: url('https://www.horizonrando.fr/wp-content/uploads/2026/01/Megamenu-6.jpg');
}

/* Overlay de la carte */
.hr-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(0,0,0,0.2) 0%, 
        rgba(0,0,0,0.0) 30%,
        rgba(0,0,0,0.0) 100%);
    z-index: 1;
    transition: background 0.4s ease;
    border-radius: 16px;
    pointer-events: none;
}

/* Hover sur carte */
.hr-country-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    z-index: 100;
}

.hr-country-card:hover .hr-card-overlay {
    background: rgba(0, 0, 0, 0.6);
}

/* Nom du pays */
.hr-country-name {
    position: relative;
    z-index: 2;
    color: #fff;
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 20px 22px 10px;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    text-decoration: none;
    display: block;
    text-align: center;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.hr-country-name:hover {
    text-decoration: underline;
}
						  			  

/* Liens du pays */
.hr-country-links {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 16px 16px 20px !important; 
    margin: 0;
    list-style: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.hr-country-card:hover .hr-country-links {
    opacity: 1;
    transform: translateY(0);
}

/* Boutons individuels */
.hr-country-links > li {
    margin: 0;
    padding: 0;
    width: auto;
    align-self: flex-start;
}

.hr-country-links > li > a {
    display: inline-block;
    background: rgba(2, 195, 154, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(2, 195, 154, 0.5);
    color: #fff;
    padding: 4px 12px;
    border-radius: 8px;
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.hr-country-links > li > a:hover {
    background: #02c39a;
    color: #043a52;
    border-color: #02c39a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 195, 154, 0.4);
}

/* ==========================================================================
   POPOVER (Top 5, Circuits, etc.)
   ========================================================================== */

.hr-country-links > li.hr-has-submenu {
    position: relative;
    display: inline-block;
}

.hr-country-links > li.hr-has-submenu > a {
    padding-right: 28px;
}

/* Chevron */
.hr-country-links > li.hr-has-submenu > a::after {
    content: '›';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: 700;
    transition: transform 0.2s ease;
}

/* Sous-menu (popover) */
.hr-submenu-popover {
    position: absolute;
    top: 0;
    left: calc(100% + 12px);
    margin: 0 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    background: rgba(3, 45, 64, 0.9);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(2, 195, 154, 0.3);
    border-radius: 10px;
    padding: 8px 10px !important;
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
    
    display: flex;
    flex-direction: column;
    gap: 0;
    width: max-content;
    min-width: 120px;
    max-width: 280px;
    z-index: 200;
    list-style: none !important;
}

.hr-submenu-popover > li {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 13px;
    line-height: normal;
    list-style: none !important;
}


/* Popover à gauche UNIQUEMENT pour la carte 4 (la plus à droite) */
.hr-country-card:nth-child(4) .hr-submenu-popover {
    left: auto;
    right: calc(100% + 12px);
    transform: translateX(4px);
}

/* Afficher quand hr-active (géré par JS : hover + clic) */
.hr-country-links > li.hr-has-submenu.hr-active > .hr-submenu-popover {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.hr-country-card:nth-child(4) .hr-has-submenu.hr-active > .hr-submenu-popover {
    transform: translateX(0);
}

/* Style du bouton quand popover ouvert */
.hr-country-links > li.hr-has-submenu.hr-active > a {
    background: #02c39a;
    color: #043a52;
    border-color: #02c39a;
}

/* Liens dans le popover - AVEC PUCES BLANCHES */
.hr-submenu-popover > li > a {
    display: block;
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px 10px; /* Symétrique : 10px gauche et droite */
    border-radius: 8px;
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    box-shadow: none;
    margin: 0 !important;
    position: relative;
}

/* Puce blanche pour les liens des popups */
.hr-submenu-popover > li > a::before {
    content: '•';
    position: absolute;
    left: 0px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    transition: color 0.2s ease;
}

.hr-submenu-popover > li > a:hover {
    background: rgba(2, 195, 154, 0.15);
    color: #02c39a;
    /* Agrandir le fond de 2px à gauche et à droite pour englober la puce */
    margin-left: -2px;
    margin-right: -2px;
    padding-left: 12px;
    padding-right: 12px;
}

.hr-submenu-popover > li > a:hover::before {
    color: #02c39a;
    left: 2px; /* Décaler la puce de 2px pour suivre le texte */
}

/* ==========================================================================
   BARRE DE RECHERCHE
   ========================================================================== */

/* Bouton loupe (desktop) - icône plus visible */
.hr-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 15px 20px;
    color: #fff;
    transition: color 0.3s ease;
}

.hr-search-toggle:hover {
    color: #02c39a;
}

/* Icône loupe modifiée : cercle plus petit, trait plus long, trait plus épais */
.hr-search-icon {
    width: 22px;
    height: 22px;
}

.hr-search-toggle .hr-search-icon {
    stroke-width: 2.5;
}

/* Cacher le bouton loupe quand la recherche est ouverte */
.hr-search-item.hr-search-open .hr-search-toggle {
    visibility: hidden;
}

/* Wrapper du champ de recherche - positionné en absolu pour ne pas décaler */
.hr-search-field-wrapper {
    display: none;
    align-items: center;
    background: transparent;
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    z-index: 999999;
    width: 260px;
}

/* Afficher le champ quand ouvert */
.hr-search-item.hr-search-open .hr-search-field-wrapper {
    display: flex;
}

/* Positionner le search-item pour servir de référentiel */
.hr-search-item {
    position: relative !important;
}

/* Le container sert de référentiel */
.hr-search-container {
    display: flex;
    align-items: center;
    height: 100%;
    position: relative;
}

.hr-search-input {
    flex: 1;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 8px 14px;
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 14px;
    color: #333;
    outline: none;
    min-width: 200px;
    height: 34px;
    box-sizing: border-box;
}

.hr-search-input::placeholder {
    color: #888;
}

.hr-search-input:focus {
    outline: none;
    box-shadow: none;
}

.hr-search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #02c39a;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    height: 32px;
    box-sizing: border-box;
}

.hr-search-submit:hover {
    background: #00a896;
}

.hr-search-submit .hr-search-icon {
    width: 18px;
    height: 18px;
    color: #fff;
}