/* ============================================================
 *  HAMBURGER MENU — HealthDesk
 *  Sfondo nero, testo chiaro, dropdown con freccia, slide from top
 *  Bootstrap-compatible, mobile & desktop
 *  ============================================================ */

/* --- Pulsante hamburger --- */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    z-index: 1600;
    position: relative;
}

.hamburger-btn .bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animazione hamburger → X */
.hamburger-btn.is-open .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.is-open .bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger-btn.is-open .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Overlay scuro dietro il menu --- */
.hd-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1490;
}
.hd-nav-overlay.is-visible {
    display: block;
}

/* --- Pannello menu ---
 *  Sempre a tutta larghezza viewport (left:0 right:0).
 *  Il padding interno cresce con clamp() sugli schermi larghi,
 *  creando l'effetto "centrato" senza max-width né transform. */
.hd-nav-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 3000 !important;
    background-color: #1a1a1a;
    color: #f0f0f0;
    transform: translateY(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    /* Padding orizzontale responsivo:
     *    - mobile (< 750px): 0px di margine laterale → contenuto a tutto schermo
     *    - tablet/desktop: cresce fino a ~10% della viewport per lato
     *    clamp(min, preferred, max) */
    padding-inline: clamp(0px, 25vw, 3500px);
}


@media screen and (max-width: 1200px) {
    .hd-nav-panel {
        padding-inline: clamp(0px, 6vw, 160px);
    }
}
.hd-nav-panel.is-open {
    transform: translateY(0);
}

/* Header interno del pannello — sticky in cima
 *  così la X è sempre visibile anche scorrendo */
.hd-nav-panel__header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);

    padding-inline: clamp(0px, 10vw, 10px);
}

.hd-nav-panel__title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.hd-nav-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #ffffff;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    transition: background 0.2s ease;
    font-size: 1.4rem;
    line-height: 1;
}

.hd-nav-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- OVERRIDE: forza layout verticale dentro il pannello
 *  (sovrascrive gli stili orizzontali del tema The X su desktop) --- */

.hd-nav-panel ul.menu,
.hd-nav-panel .menu {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 0 !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.hd-nav-panel ul.menu > li,
.hd-nav-panel .menu > .menu-item {
    width: 100% !important;
    float: none !important;
    display: block !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hd-nav-panel ul.menu > li:last-child,
.hd-nav-panel .menu > .menu-item:last-child {
    border-bottom: none !important;
}

/* Link e span di primo livello */
.hd-nav-panel .menu > .menu-item > a,
.hd-nav-panel .menu > .menu-item > span:not(.hd-arrow) {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 14px 0 !important;
    color: #f0f0f0 !important;
    text-decoration: none !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    transition: background 0.2s ease, color 0.2s ease;
}

.hd-nav-panel .menu > .menu-item > a:hover {
    color: #ffffff !important;
    opacity: 0.8;
}

/* Separatore testuale (es. "-----") */
.hd-nav-panel .menu > .menu-item > span:not(.hd-arrow):not(.hd-parent-toggle span) {
    color: rgba(255, 255, 255, 0.2) !important;
    font-size: 0.75rem !important;
    padding: 8px 0 !important;
    pointer-events: none;
    user-select: none;
}

/* --- Genitore con figli: riga cliccabile con freccia --- */
.hd-nav-panel .menu-item-has-children > .hd-parent-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 14px 0 !important;
    cursor: pointer;
    color: #f0f0f0 !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    transition: opacity 0.2s ease;
    user-select: none;
}

.hd-nav-panel .menu-item-has-children > .hd-parent-toggle:hover {
    opacity: 0.8;
}

.hd-nav-panel .menu-item-has-children > .hd-parent-toggle .hd-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

/* Freccia ruota quando aperto */
.hd-nav-panel .menu-item-has-children.is-expanded > .hd-parent-toggle .hd-arrow {
    transform: rotate(180deg);
}

/* --- Sottomenu (livello 2) --- */
.hd-nav-panel .submenu {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: transparent;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: block !important;
    width: 100% !important;
}

.hd-nav-panel .menu-item-has-children.is-expanded > .submenu {
    max-height: 800px;
}

.hd-nav-panel .submenu .menu-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    width: 100% !important;
    float: none !important;
    display: block !important;
}

.hd-nav-panel .submenu .menu-item:last-child {
    border-bottom: none !important;
}

.hd-nav-panel .submenu .menu-item > a {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 0 12px 20px !important;
    color: rgba(255, 255, 255, 0.65) !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    transition: color 0.2s ease;
}

.hd-nav-panel .submenu .menu-item > a:hover {
    color: #ffffff !important;
}

/* --- Voce attiva --- */
.hd-nav-panel .menu-item a.is-active,
.hd-nav-panel .menu-item a[data-drupal-link-system-path].is-active {
    color: #ffffff !important;
    font-weight: 600 !important;
}
