/* ========================================================== */
/* VERSIONE FINALE STABILE (V78 + VALENTINE FIX V5.15) */
/* RISOLVE: Altezza link sottomenu (70px -> 50px) nello STATO STICKY - ISOLAMENTO REGOLA. */
/* ========================================================== */

/* 1. FORZATURA ALTEZZA NORMALE (150px) - REGOLE ESISTENTI E FIX OVERFLOW */
#sp-header {
    height: 150px !important;
    min-height: 150px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: visible !important;
}
#sp-header .container > .row {
    height: 100% !important;
    overflow: visible !important; 
}
.sp-megamenu-wrapper {
    height: 100% !important;
    overflow: visible !important; 
}

/* LOGICA DI CENTRATURA UL (Altezza: 150px) - STATO NORMALE */
.sp-megamenu-wrapper ul.sp-megamenu-parent {
    line-height: 150px !important; 
    overflow: visible !important; 
}

.sp-megamenu-wrapper ul.sp-megamenu-parent > li.sp-menu-item {
    padding: 0 !important;
    margin: 0 !important;
    border-left: none !important;
    border-right: none !important;
}

/* 2. STILE BASE ANIMAZIONE (STATO NORMALE 150px) */
/* Ristretto per colpire SOLO i menu item PRINCIPALI e non i sottomenu */
.sp-megamenu-wrapper ul.sp-megamenu-parent > li.sp-menu-item.menu--valentine { 
    height: 100% !important;
    position: relative !important;
    overflow: visible !important;
    z-index: 10;
}

/* LARGHEZZA CORRETTA (Sempre inline-block per adattarsi al testo) */
.sp-megamenu-wrapper ul.sp-megamenu-parent > li.sp-menu-item.menu--valentine > a {
    position: relative;
    display: inline-block !important; 
    line-height: 150px !important; /* Line height per altezza normale */
    padding: 0 15px !important;
    z-index: 2;
    color: #b5b5b5; 
    transition: color 0.3s;
}

/* 3. PSEUDO-ELEMENTI ANIMAZIONE (VALENTINE - STATO NORMALE 50px) */

/* Ristretto per colpire SOLO i menu item PRINCIPALI (rimosso l'ereditarietà al sottomenu) */
.sp-megamenu-parent > li.sp-menu-item.menu--valentine::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine::after,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine > a::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine > a::after {
    content: '';
    position: absolute;
    background: #13948e; /* COLORE DELLE LINEE */
    transform-origin: 350% 350%;
    transition: transform 0.5s;
    transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
}

/* Linee Verticali (Box 50px centrato) */
.sp-megamenu-parent > li.sp-menu-item.menu--valentine::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine::after {
    top: calc(50% - 25px); 
    width: 2px;
    height: 50px; 
    transform: scale3d(1, 0, 1);
}

/* Linee Orizzontali (Box 50px centrato) */
.sp-megamenu-parent > li.sp-menu-item.menu--valentine > a::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine > a::after {
    left: 0;
    width: 100%;
    height: 2px;
    transform: scale3d(0, 1, 1);
}
.sp-megamenu-parent > li.sp-menu-item.menu--valentine > a::before {
    top: calc(50% - 25px); 
}
.sp-megamenu-parent > li.sp-menu-item.menu--valentine > a::after {
    bottom: calc(50% - 27px); 
}

/* 4. HOVER E STATO ATTIVO (Regole ereditate) */
.sp-megamenu-parent > li.sp-menu-item.menu--valentine:hover::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine:hover::after,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine:hover > a::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine:hover > a::after,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine.current-item::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine.current-item::after,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine.current-item > a::before,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine.current-item > a::after {
    transform: scale3d(1, 1, 1);
}
.sp-megamenu-parent > li.sp-menu-item.menu--valentine:hover > a,
.sp-megamenu-parent > li.sp-menu-item.menu--valentine.current-item > a {
    color: #13948e; 
    background: transparent !important;
}

/* ========================================================== */
/* 5. FIX STICKY HEADER - UTILIZZANDO LA CLASSE .sticky (70px) */
/* Centratura, altezza e animazione a 70px. */
/* ========================================================== */

/* A. Forziamo l'altezza e la line-height sui LI del MENU PRINCIPALE */
#sp-header.sticky .sp-megamenu-parent > li.sp-menu-item.menu--valentine { /* <--- AGGIUNTO > */
    height: 70px !important;
    line-height: 70px !important;
}

/* B. Fix per il link <a>: Cruciale per centratura testo e larghezza (SOLO MENU PRINCIPALE) */
#sp-header.sticky .sp-megamenu-parent > li.sp-menu-item.menu--valentine > a { /* <--- AGGIUNTO > */
    height: 70px !important;
    line-height: 70px !important; 
    display: inline-block !important; 
}


/* C. Animazione 100% Altezza (70px) nello Sticky: Ripristina la visualizzazione */

/* Linee Verticali */
#sp-header.sticky .sp-megamenu-parent li.sp-menu-item.menu--valentine::before,
#sp-header.sticky .sp-megamenu-parent li.sp-menu-item.menu--valentine::after {
    top: 0; 
    height: 100%; 
}

/* Linee Orizzontali */
#sp-header.sticky .sp-megamenu-parent li.sp-menu-item.menu--valentine > a::before,
#sp-header.sticky .sp-megamenu-parent li.sp-menu-item.menu--valentine > a::after {
    top: 0; 
    bottom: 0; 
}


/* ========================================================== */
/* 6. FIX DROPDOWN POSIZIONAMENTO E STILE FINALE (V5.15) */
/* Assicurati che il sottomenu torni a 50px grazie all'isolamento del punto 5. */
/* ========================================================== */

/* A. Posizionamento e allineamento (Stato Normale 150px) */
#sp-header .sp-megamenu-parent > li.sp-has-child > .sp-dropdown {
    top: 150px !important;
}

/* B. Posizionamento e allineamento (Stato Sticky 70px) */
#sp-header.sticky .sp-megamenu-parent > li.sp-has-child > .sp-dropdown {
    top: 70px !important;
}

/* C. Reset Altezza, Spaziatura e Line-Height Drop Down Items */

/* 1. RESET CRITICO SUI CONTENITORI ESTERNI (sp-dropdown e sp-dropdown-inner) */
.sp-dropdown, .sp-dropdown-inner {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 2. Reset sul contenitore UL e sul LI */
.sp-dropdown-items,
.sp-dropdown-items li.sp-menu-item {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 0 !important; 
    margin: 0 !important;  
    line-height: normal !important; 
}


/* 3. Stili finali per il link interno (<a>) - Regola Generica e Aggressiva */
/* Questa regola ora FORZA il 50px, non deve più combattere con il 70px ereditato */
.sp-dropdown-items li.sp-menu-item > a {
    height: 50px !important; 
    min-height: 50px !important;
    display: block !important; 
    line-height: 40px !important; 
    padding: 5px 15px !important; 
    margin: 0 !important;
    width: 100% !important; 
    box-sizing: border-box !important;
}

/* 4. Regola Specifica STICKY (Semplificata) */
/* Questa regola è ora ridondante per l'altezza ma mantenuta per sicurezza */
#sp-header.sticky .sp-dropdown-items li.sp-menu-item > a {
    height: 50px !important; 
    min-height: 50px !important;
}
#scroll-top {
  background-color: #333333 !important;
  color: #ffffff !important;
}

#scroll-top:hover {
  /* Verde acqua scuro all'hover */
  background-color: #008B86 !important;
  /* Icona bianca all'hover */
  color: #fff !important;
}
a#scroll-top >i {
  color: #fff;
}
a#scroll-top {
  bottom: 10px;
}
.map_set156 {
  position: relative;
}
/* popup su mappa */
.map_set156 .leaflet-popup-content-wrapper,
.map_set156 .leaflet-container a.leaflet-popup-close-button,
.map_set156 .leaflet-bar a,
.map_set156 .leaflet-bar a:hover  {
  font-weight: 800;
}
/* Forza il cambio del logo quando l'header è in modalità sticky */
#sp-header.sticky .logo img, 
#sp-header.is-sticky .logo img {
    content: url('/images/logo_europlanet-no-bg-orizz-rid.png') !important;
    width: auto !important;
    height: 65px !important; /* Altezza basata sui tuoi parametri 180x55 */
}

/* Opzionale: assicura che il logo non venga deformato */
.sp-default-logo {
    object-fit: contain;
}