:root {
    --header-height: 0;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}
  
/* ===== HEADER PRINCIPALE ===== */
.header {
    font-family: 'Roboto', sans-serif;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: var(--white);
    color: var(--primary-color);
    transition: transform 0.4s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--box-shadow);
    border-bottom: solid 1px var(--primary-color);
}
.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
  
/* logo */
.logo a {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
.logo-img {
    transition: var(--transition);
    margin-left: 10px;
}
.logo-img:hover {
    transform: scale(1.05);
    filter: brightness(1.05);
}
.logo-img-su {
    height: 60px;
}
.logo-img-giu {
    transition: max-height 0.3s ease;
    max-height: 22px;
    overflow: hidden;
}

/* Header-wrapper “compresso” quando scrollY > 10px */
.header.scrolled .logo-img-giu {
    max-height: 0;
}
  
/* hamburger - visibile solo su mobile */
.hamburger {
    display: none; /* nascosto di default - visibile solo su mobile */
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    padding: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.bars {
    width: 22px;
    height: 2px;
    background: var(--white);
    margin: 3px 0;
    transition: var(--transition);
    border-radius: 1px;
}
  
/* quick nav (desktop) */
.quick-nav {
    display: flex;
    gap: 1.5rem;
    margin-right: 30px;
}
.quick-nav a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 20px;
    position: relative;
    padding: 0.3rem 0;
    transition: var(--transition);
}
.quick-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--secondary-color);
    transition: var(--transition);
}
.quick-nav a:hover {
    color: var(--secondary-color);
}
.quick-nav a:hover::after {
    width: 100%;
}
  
/* ===== NAV PRINCIPALE ===== */
.nav-menu {
    position: relative;
    background: var(--primary-color);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 96%;
    align-self: center;
}
.main-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
    max-width: 1150px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
}
.main-menu li {
    position: relative;
}
.nav-menu a {
    color: var(--white);
    text-decoration: none;
    padding: 0.8rem 0.9rem;
    display: flex;
    align-items: center;
    transition: var(--transition);
    font-weight: 500;
    white-space: nowrap;
}
.nav-menu a:hover {
    color: var(--secondary-color);
}
  
/* color-mark */
.color-mark {
    display: inline-block;
    width: 10px; height: 10px;
    margin-right: 0.5rem;
    border-radius: 50%; /* rendere tondo */
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}
.color-mark.home       { background: #002147; }
.color-mark.chi-siamo  { background: #235559; }
.color-mark.calendario { background: #00a0d1; }
.color-mark.news       { background: #8bae00; }
.color-mark.corsi       { background: #00aea5; }
.color-mark.aggiornato       { background: #ff7f00; }
.color-mark.lavora-con-noi   { background: #fcda00; }
.color-mark.contatti   { background: #d81b60; }

.nav-menu a:hover .color-mark {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}
  
/* dropdown */
.menu-link::after {
    content: '▼';
    font-size: 0.6em;
    margin-left: 0.3rem;
    transition: var(--transition);
}
.dropdown:hover .menu-link::after {
    transform: rotate(180deg);
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100%);
    left: 5%;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    min-width: 220px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    padding: 0.5rem 0;
}
.dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
}
.dropdown-menu li {
    position: relative;
}
.dropdown-menu li a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--primary-color) !important;
    transition: background 0.2s, padding-left 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}
.dropdown-menu li a:hover {
    background: rgba(10, 31, 68, 0.05);
    color: var(--secondary-color) !important;
    padding-left: 1.3rem;
    border-left: 3px solid var(--secondary-color);
}


.utility-links {
    padding: 0.5rem 0 1.5rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.mobile-utility-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.mobile-utility-link:hover {
    color: var(--secondary-color) !important;
}

/* Links visibili solo su mobile (dopo utility-link!!!) */
.mobile-only {
    display: none;
}

/* Freccia per chiudere l'hamburger */
.mobile-header {
    display: none;
}
  
/* ===== MOBILE ===== */
@media (max-width: 1020px) {
    .hamburger {
        position: relative;
        display: flex;
        transition: transform 0.2s ease;
    }
    .hamburger .arrow-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.5rem;
        color: var(--white);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
        /* quando apro il menu: spariscono le bars, appare la freccia */
    .hamburger.active .bars {
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    .hamburger.active .arrow-icon {
        opacity: 1;
        transition-delay: 0.2s;
    }
    /* quando chiudo, invertiamo transizioni */
    .hamburger .bars {
        opacity: 1;
    }
    .hamburger .arrow-icon {
        opacity: 0;
    }
    .header-wrapper {
        flex-direction: row-reverse;
    }
    .quick-nav {
        display: none;
    }
    .nav-menu {
        position: fixed;
        top: 0; left: -100%;
        width: 280px; height: 100vh;
        padding: 2rem 1.5rem;
        transition: left 0.3s ease, opacity 0.3s;
        overflow-y: auto;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
        opacity: 0;
    }
    .nav-menu.active {
        left: 0;
        opacity: 1;
    }
    .main-menu {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0;
    }
    .mobile-header {
        display: flex;
        align-items: center;
        margin-bottom: 1.5rem;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        padding-bottom: 1rem;
    }
    .title-menu {
        flex: 1;
        display: flex;
        justify-content: center;
        width: 100%;
        color: var(--white);
        font-size: 1.5rem;
    }
    .dropdown > .menu-link {
        justify-content: center;
    }
    .dropdown-menu {
        position: static !important;
        transform: none !important;
        background: rgba(255, 255, 255, 0.1);
        box-shadow: none;
    }
    .dropdown.open .dropdown-menu {
        max-height: 300px;
    }    
    .dropdown-menu li a {
        color: var(--white) !important;
        padding: 0.5rem 0.8rem;
        border-left: 2px solid transparent;
    }
    .dropdown-menu li a:hover {
        background: rgba(255,255,255,0.1);
        border-left: 2px solid var(--white);
    }
    /* overlay scuro quando menu è aperto */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    /* Mostra i link utility solo su mobile */
    .mobile-only {
        display: block;
    }
}