/* =========================================================
   HEADER DESKTOP
   Logo a sinistra | Menu centrato | Login + bandiere a destra
   Attivo da 992px in su
   ========================================================= */
@media (min-width: 992px) {

    /* La riga dell'header diventa il riferimento
       per menu e area Login/bandiere posizionati in assoluto */
    #sp-header .container-inner > .row {
        position: relative;
    }

    /* -----------------------------------------------------
       MENU PRINCIPALE: centrato rispetto alla pagina
       ----------------------------------------------------- */
    #sp-header #sp-menu {
        position: absolute !important;
        top: 0;
        bottom: 0;
        left: 50% !important;

        width: auto !important;
        max-width: none !important;
        padding: 0 !important;

        transform: translateX(-50%) !important;
        z-index: 1000 !important;
        pointer-events: auto !important;
    }

    /* Allineamento interno menu */
    #sp-header #sp-menu > .sp-column,
    #sp-header #sp-menu .sp-megamenu-wrapper {
        display: flex !important;
        width: auto !important;
        height: 100%;
        align-items: center !important;
        justify-content: center !important;
    }

    #sp-header #sp-menu .sp-megamenu-parent {
        margin: 0 !important;
    }

    /* Mantiene voci e dropdown del menu sopra gli altri elementi */
    #sp-header #sp-menu .sp-megamenu-wrapper,
    #sp-header #sp-menu .sp-megamenu-parent,
    #sp-header #sp-menu .sp-megamenu-parent > li,
    #sp-header #sp-menu .sp-megamenu-parent > li > a {
        position: relative !important;
        z-index: 1001 !important;
        pointer-events: auto !important;
    }

    /* -----------------------------------------------------
       LOGO
       Resta nella colonna originale, a sinistra
       ----------------------------------------------------- */
    #sp-header #sp-logo {
        position: relative;
        z-index: 10;
    }

    /* -----------------------------------------------------
       AREA SEARCH
       GTranslate + menu utente a destra, nella stessa riga
       ----------------------------------------------------- */
    #sp-header #sp-search {
        position: absolute !important;
        top: 0;
        right: 15px;
        bottom: 0;
        left: auto !important;

        width: auto !important;
        max-width: none !important;
        padding: 0 !important;

        z-index: 1002 !important;
        pointer-events: auto !important;
    }

    /* I moduli presenti nella posizione search stanno affiancati */
    #sp-header #sp-search > .sp-column {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 12px !important;

        height: 100%;
        flex-wrap: nowrap !important;
    }

    /* Ogni modulo della posizione search occupa solo il proprio contenuto */
    #sp-header #sp-search .sp-module {
        display: block !important;
        flex: 0 0 auto !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Il paragrafo del modulo Custom non deve creare margini verticali */
    #sp-header #sp-search .mod-custom p {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Link Login del modulo Custom */
    #sp-header #sp-search .login-header-link {
        display: inline-block !important;
        white-space: nowrap !important;
        line-height: 24px !important;
        text-decoration: none;
    }

    /* -----------------------------------------------------
       GTRANSLATE
       Deve restare nel flusso della colonna search
       ----------------------------------------------------- */
    #sp-header #gt-wrapper-126 {
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;

        display: flex !important;
        align-items: center !important;
        z-index: auto !important;
        transform: none !important;
    }

    /* Bandiere: niente spostamento verticale artificiale */
    #sp-header #sp-search a.glink img {
        display: block !important;
        transform: none !important;
    }

    /* Spazio tra le bandierine */
    #sp-header #gt-wrapper-126 > a {
        display: inline-flex !important;
        align-items: center !important;
        margin-right: 5px !important;
    }

    #sp-header #gt-wrapper-126 > a:last-child {
        margin-right: 0 !important;
    }

    /* -----------------------------------------------------
       MENU PRINCIPALE DESKTOP
       Le voci non devono andare a capo
       ----------------------------------------------------- */
    #sp-header #sp-menu .sp-megamenu-parent {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        width: max-content !important;
        white-space: nowrap !important;
    }

    #sp-header #sp-menu .sp-megamenu-parent > li {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    #sp-header #sp-menu .sp-megamenu-parent > li > a,
    #sp-header #sp-menu .sp-megamenu-parent > li > span {
        display: inline-block !important;
        white-space: nowrap !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}


/* =========================================================
   SOTTO-VOCI DEL MENU PRINCIPALE
   ========================================================= */
ul.mod-menu__sub.menu-child > li > a {
    display: block;
    font-size: 17px;
    line-height: 1.4;
}

ul.mod-menu__sub.menu-child > li {
    margin-bottom: 6px;
}


/* =========================================================
   MOBILE E TABLET PICCOLI
   Attivo sotto 768px
   ========================================================= */
@media (max-width: 767px) {

    /* Riferimento per il logo centrato */
    #sp-header .row {
        position: relative;
        min-height: 70px;
    }

    /* Il logo diventa centrato rispetto alla riga */
    #sp-header .row > .sp-column:has(.logo) {
        position: static;
    }

    #sp-header .row .logo {
        position: absolute;
        top: 50%;
        left: 50%;
        margin: 0;
        transform: translate(-50%, -50%);
        z-index: 15;
    }

    #sp-header .row .logo img {
        display: block;
        max-width: 145px;
        height: auto;
    }

    /* Hamburger 10px più in basso */
    #sp-header #offcanvas-toggler,
    #sp-header #sp-offcanvas-toggler {
        position: relative;
        top: 10px;
    }

    /* Bandiere 20px più a destra su mobile */
    #sp-header #gt-wrapper-126 {
        transform: translateX(20px) !important;
    }
}


/* =========================================================
   MENU UTENTE FRONTEND
   Modulo Joomla:
   - Position: search
   - Layout: Default
   - Module Class: technova-user-menu
   ========================================================= */

/* Contenitore del menu */
.technova-user-menu {
    position: relative;
    z-index: 1100;
}

/* Lista principale del modulo */
.technova-user-menu .mod-menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Voce principale: Utente */
.technova-user-menu .mod-menu > li {
    position: relative;
    display: inline-block;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Joomla/Helix può produrre span, link o button come voce padre */
.technova-user-menu .mod-menu > li > span,
.technova-user-menu .mod-menu > li > a,
.technova-user-menu .mod-menu > li > button {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin: 0;
    padding: 4px 8px;
    border: 0;
    background: transparent;
    color: #222;
    font-size: inherit;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

/* Freccia ▼ dopo la voce Utente */
.technova-user-menu .mod-menu > li:first-child > *:first-child::after {
    content: " ▼" !important;
    display: inline-block !important;
    margin-left: 6px !important;
    color: #222 !important;
    font-family: Arial, sans-serif !important;
    font-size: 10px !important;
    font-weight: normal !important;
    line-height: 1 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Sottomenu Profilo / Logout inizialmente nascosto */
.technova-user-menu .mod-menu > li > ul {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 9999;

    display: none !important;
    min-width: 150px;
    margin: 4px 0 0;
    padding: 5px 0;

    background: #fff;
    border: 1px solid #ddd;
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    list-style: none;
}

/* Apertura al passaggio del mouse o tramite tastiera */
.technova-user-menu .mod-menu > li:hover > ul,
.technova-user-menu .mod-menu > li:focus-within > ul {
    display: block !important;
}

/* Voci interne: Profilo e Logout */
.technova-user-menu .mod-menu > li > ul li {
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Link del dropdown */
.technova-user-menu .mod-menu > li > ul a {
    display: block;
    padding: 8px 14px;
    color: #333;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
}

/* Hover delle voci del dropdown */
.technova-user-menu .mod-menu > li > ul a:hover,
.technova-user-menu .mod-menu > li > ul a:focus {
    color: #fff;
    background: #087fa9;
    outline: none;
}


/* =========================================================
   MENU UTENTE FRONTEND – FIX HOVER (ponte invisibile)
   ========================================================= */

/* Dropdown: attacca sotto la voce "Utente" senza gap esterno */
.technova-user-menu .mod-menu > li > ul {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 9999;

    display: none !important;
    min-width: 150px;

    /* Nessun margine esterno verticale */
    margin: 0 !important;
    padding-top: 4px;
    padding-bottom: 4px;

    background: #fff;
    border: 1px solid #ddd;
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    list-style: none;
}

/é GESTIONE DEL MENU LOGIN */
/* Ponte invisibile che estende l'area hover verso l'alto e i lati */
.technova-user-menu .mod-menu > li > ul::before {
    content: "";
    position: absolute;
    top: -10px;        /* 10px verso l'alto, verso la voce "Utente" */
    left: -10px;       /* 10px a sinistra */
    right: -10px;      /* 10px a destra */
    bottom: 0;
    background: transparent;
    pointer-events: auto;
}

/* Apertura dropdown: hover + focus-within */
.technova-user-menu .mod-menu > li:hover > ul,
.technova-user-menu .mod-menu > li:focus-within > ul {
    display: block !important;
}

/* Evita che i li interni creino spazi strani */
.technova-user-menu .mod-menu > li > ul li {
    margin: 0;
    padding: 0;
}

/* MM - 12.10.2026 - ordine in position search (in alto a destra) ricerca, bandiere e login */

/* Contenitore dei moduli della posizione search */
#sp-search > .sp-column {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

/* Modulo GTranslate: secondo */
#sp-search > .sp-column > .sp-module:has(#gt-wrapper-126) {
    order: 2 !important;
}

/* Modulo Login: terzo */
#sp-search > .sp-column > .sp-module:has(#mod-custom130) {
    order: 3 !important;
}

/* Modulo ricerca: primo */
#sp-search > .sp-column > .sp-module:has(#jo-smart-search-131) {
    order: 1 !important;
}


/* MODIFICA PAGINA MAPPA DEL SITO */
#osmap-menu-uid-mainmenu {
    font-size: 0;
}

#osmap-menu-uid-mainmenu::after {
    content: "MAPPA DEL SITO";
    margin-top: -60px;
    margin-bottom: 0px;
    font-family: "Noto Sans", sans-serif;
    font-size: 32px;
    color: #2980C0;
    display: block;
    text-align: left;
}
