/* ============================================================================
   FIX DEFINITIVO MENU MOBILE PWA - AGGIUNGI ALLA FINE DI landpage.css
   ============================================================================ */
/* ============================================================================
   FIX DEFINITIVO MENU MOBILE PWA CON HAMBURGER TRICOLORE
   ============================================================================ */

/* RESET E OVERRIDE COMPLETO PER IL MENU MOBILE */

/* Hamburger Button Tricolore - Forza visibilità e funzionalità */
.nav-toggle {
    display: none !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    z-index: 10001 !important;
    position: relative !important;
    width: 40px !important;
    height: 40px !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
    /* Nascondi il carattere ☰ di default */
    font-size: 0 !important;
    color: transparent !important;
}

/* Crea le 3 linee tricolore con pseudo-elementi */
.nav-toggle::before,
.nav-toggle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Linea VERDE (superiore) */
.nav-toggle::before {
    top: 8px;
    background: #008000;
    /* Linea BIANCA (centrale) creata con box-shadow */
    box-shadow: 0 10px 0 0 #FFFFFF;
}

/* Linea ROSSA (inferiore) */
.nav-toggle::after {
    bottom: 8px;
    background: #FF0000;
}

/* Mostra hamburger solo su mobile */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Nascondi il bottone login desktop */
    .btn-login-header {
        display: none !important;
    }

    .btn-login-mobile {
        display: inline-block !important;
    }

    /* Menu mobile - STATO CHIUSO (default) */
    .nav-links {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 80% !important;
        max-width: 300px !important;
        height: 100vh !important;
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 4rem 2rem 2rem !important;
        transition: right 0.3s ease-in-out !important;
        z-index: 10000 !important;
        overflow-y: auto !important;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3) !important;
        -webkit-overflow-scrolling: touch !important;
        pointer-events: auto !important;
    }

    /* Menu mobile - STATO APERTO */
    .nav-links.active {
        right: 0 !important;
        pointer-events: auto !important;
    }

    /* Animazione hamburger quando menu è aperto - diventa X bianca */
    .nav-links.active ~ .nav-toggle::before {
        top: 50%;
        transform: translateX(-50%) translateY(-50%) rotate(45deg);
        box-shadow: none;
        background: #fff;
    }

    .nav-links.active ~ .nav-toggle::after {
        bottom: 50%;
        transform: translateX(-50%) translateY(50%) rotate(-45deg);
        background: #fff;
    }

    /* Link del menu - FORZA INTERATTIVITÀ */
    .nav-links a {
        width: 100% !important;
        padding: 1rem 0 !important;
        color: #fff !important;
        text-decoration: none !important;
        font-size: 1.1rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        transition: all 0.3s ease !important;
        cursor: pointer !important;
        pointer-events: auto !important;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1) !important;
        touch-action: manipulation !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        display: block !important;
        position: relative !important;
        z-index: 10001 !important;
    }

    .nav-links a:hover,
    .nav-links a:active,
    .nav-links a:focus {
        background: rgba(255, 255, 255, 0.1) !important;
        padding-left: 1rem !important;
        transform: translateX(5px) !important;
        color: #fff !important;
    }

    /* Pulsante X per chiudere */
    .close-menu {
        position: absolute !important;
        top: 1rem !important;
        right: 1rem !important;
        background: none !important;
        border: none !important;
        font-size: 2.5rem !important;
        color: #fff !important;
        cursor: pointer !important;
        padding: 0 !important;
        line-height: 1 !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 10002 !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
        pointer-events: auto !important;
    }

    .close-menu:hover,
    .close-menu:active {
        color: #ff6b6b !important;
        transform: rotate(90deg) !important;
        transition: all 0.3s ease !important;
    }

    /* Overlay scuro quando menu aperto */
    .nav-links.active::before {
        content: '' !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: -1 !important;
        pointer-events: auto !important;
    }

    /* Bottone login nel menu */
    .nav-links .btn-login-header {
        display: block !important;
        width: 100% !important;
        margin-top: 1rem !important;
        padding: 0.8rem !important;
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%) !important;
        border: none !important;
        border-radius: 8px !important;
        color: white !important;
        font-weight: 600 !important;
        text-align: center !important;
        cursor: pointer !important;
        pointer-events: auto !important;
    }
}

/* Fix per PWA standalone mode */
@media (display-mode: standalone) {
    .nav-links {
        padding-top: max(4rem, env(safe-area-inset-top) + 2rem) !important;
    }

    .nav-toggle {
        margin-right: env(safe-area-inset-right) !important;
    }
}

/* Fix per dispositivi con notch (iPhone X e successivi) */
@supports (padding: max(0px)) {
    .header-nav {
        padding-left: max(1rem, env(safe-area-inset-left)) !important;
        padding-right: max(1rem, env(safe-area-inset-right)) !important;
    }
}

/* Previeni selezione testo durante tap */
.nav-toggle,
.close-menu,
.nav-links a {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Fix specifico per Safari iOS */
@supports (-webkit-touch-callout: none) {
    .nav-links {
        height: -webkit-fill-available !important;
    }
}

/* Modal deve stare sopra tutto */
.modal {
    z-index: 10003 !important;
    position: fixed !important;
}

.modal.active,
.modal[style*="display: flex"] {
    display: flex !important;
    pointer-events: auto !important;
}

/* Previeni scroll body quando menu aperto */
body.menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* Fix per header navigation su mobile */
@media (max-width: 768px) {
    .header-nav {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 1rem !important;
        position: relative !important;
        z-index: 999 !important;
    }

    .header-nav .logo {
        z-index: 10001 !important;
    }
}
