:root {
    --header-height: 70px;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 0;
    padding: 0;
}

.site-header > .container {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    background: white;
    margin: 0 auto;
    width: 100%;
    max-width: 1920px;
    padding: 0 40px;
    gap: 20px;
}

.logo {
    position: relative;
    z-index: 1002;
}

.logo img {
    height: 50px;
    width: auto;
}

/* Stili del menu principale desktop */
.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.main-nav ul {
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
    list-style: none;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
}

.main-nav ul li a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
}

.main-nav ul li a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

.main-nav ul li a:hover {
    color: var(--primary-color);
}

.main-nav ul li a:hover:after,
.main-nav ul li a.active:after {
    width: 100%;
}

.main-nav ul li a.active {
    color: var(--primary-color);
}

/* Nascondi il bottone menu su desktop */
.mobile-menu {
    display: none;
}

@media (max-width: 768px) {
    /* Menu principale */
    .main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background-color: var(--primary-color);
        padding-top: var(--header-height);
        transition: all 0.3s ease-in-out;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-nav.active {
        left: 0;
    }

    .main-nav ul {
        list-style: none;
        padding: 20px;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 30px;
        width: 100%;
        max-width: 300px;
    }

    .main-nav ul li {
        text-align: center;
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.3s ease-in-out;
    }

    .main-nav.active ul li {
        opacity: 1;
        transform: translateY(0);
        transition-delay: calc(0.1s * var(--item-index));
    }

    .main-nav ul li a {
        color: white;
        text-decoration: none;
        font-size: 24px;
        display: block;
        padding: 15px;
        transition: all 0.3s ease;
        border-radius: 8px;
    }

    .main-nav ul li a:hover,
    .main-nav ul li a.active {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Bottone menu mobile */
    .mobile-menu {
        display: block;
        width: 30px;
        height: 30px;
        margin-left: auto;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1002;
    }

    .hamburger {
        width: 24px;
        height: 20px;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin: 5px auto;
    }

    .hamburger span {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--primary-color);
        border-radius: 2px;
        transition: all 0.3s ease-in-out;
    }

    /* Animazione per la X */
    .mobile-menu.active .hamburger span {
        position: absolute;
        background-color: white;
    }

    .mobile-menu.active .hamburger span:nth-child(1) {
        top: 50%;
        transform: translateY(-50%) rotate(45deg);
    }

    .mobile-menu.active .hamburger span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu.active .hamburger span:nth-child(3) {
        bottom: 50%;
        transform: translateY(50%) rotate(-45deg);
    }
}

/* Overlay del menu */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Impedisci lo scroll quando il menu è aperto */
body.menu-open {
    overflow: hidden;
}

/* Animazione ritardata per i link del menu */
.main-nav ul li:nth-child(1) { transition-delay: 0.1s; }
.main-nav ul li:nth-child(2) { transition-delay: 0.2s; }
.main-nav ul li:nth-child(3) { transition-delay: 0.3s; }
.main-nav ul li:nth-child(4) { transition-delay: 0.4s; }
.main-nav ul li:nth-child(5) { transition-delay: 0.5s; }
