/* ============================================================
   Menevo — shared app header (.mnv-header)
   Logo+tagline · text nav w/ active yellow underline ·
   search circle · notification bell · user pill.
   Reuses existing components: #notification-bell-mount, #user-menu-mount.
   ============================================================ */
.mnv-header {
  --mh-navy:   #003E54;
  --mh-cream:  #FDF3D7;
  --mh-yellow: #F9CD2D;
  --mh-teal:   #5A9A9C;
  position: sticky; top: 0; z-index: 120;
  display: flex; align-items: center;
  gap: clamp(1rem, 3vw, 2.6rem);
  width: 100%;
  padding: 0.65rem clamp(1rem, 4vw, 3rem);
  background: #FCF4DB;
  border-bottom: 1px solid rgba(0, 62, 84, 0.08);
  font-family: var(--font, "Poppins", -apple-system, sans-serif);
}

/* ── logo + tagline ── */
.mnv-logo { display: flex; flex-direction: column; justify-content: center; gap: 1px; text-decoration: none; flex: 0 0 auto; }
/* Wordmark deep-blue (logo-blu-wordmark.png, ratio ~6:1): più basso del
   vecchio logo quadrato, sennò a parità di altezza domina l'header. */
.mnv-logo img { height: clamp(1.7rem, 2.2vw, 2.2rem); width: auto; display: block; }
.mnv-logo .mnv-tag { font-size: clamp(0.46rem, 0.62vw, 0.56rem); letter-spacing: 0.03em;
  color: rgba(0, 62, 84, 0.55); font-weight: 600; white-space: nowrap; }
.mnv-logo:focus-visible { outline: 3px solid var(--mh-yellow); outline-offset: 3px; border-radius: 6px; }

/* ── nav ── */
.mnv-nav { display: flex; align-items: center; gap: clamp(1rem, 2.3vw, 2.1rem); flex: 1 1 auto; }
.mnv-nav a {
  position: relative; text-decoration: none; color: rgba(0, 62, 84, 0.6);
  font-weight: 600; font-size: clamp(0.95rem, 1.1vw, 1.18rem);
  padding: 0.45rem 0; transition: color 0.15s ease; white-space: nowrap;
}
.mnv-nav a:hover { color: var(--mh-navy); }
.mnv-nav a:not(.is-active):hover::after { content:""; position:absolute; left:0; right:0; bottom:-1px; height:3px; border-radius:3px; background:rgba(249,205,45,.55); }
.mnv-nav a.is-active { color: var(--mh-navy); font-weight: 800; }
.mnv-nav a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 4px; border-radius: 3px; background: var(--mh-yellow);
}
.mnv-nav a:focus-visible { outline: 3px solid var(--mh-yellow); outline-offset: 3px; border-radius: 4px; }

/* ── actions (search · bell · user) ── */
.mnv-actions { display: flex; align-items: center; gap: clamp(0.55rem, 1.1vw, 0.95rem); flex: 0 0 auto; }
.mnv-icon-btn {
  width: clamp(2.6rem, 3.3vw, 3rem); height: clamp(2.6rem, 3.3vw, 3rem);
  border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 1px solid rgba(0, 62, 84, 0.1);
  box-shadow: 0 4px 14px rgba(0, 62, 84, 0.08); cursor: pointer;
  color: var(--mh-navy); transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.mnv-icon-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 62, 84, 0.14); }
.mnv-icon-btn svg { width: 45%; height: 45%; }
.mnv-icon-btn:focus-visible { outline: 3px solid var(--mh-yellow); outline-offset: 2px; }

/* keep the lang switcher discreet inside the header */
.mnv-actions #menevo-lang-switcher { display: flex; align-items: center; }

/* ── mobile-menu extras ──────────────────────────────────────
   Tab icons + the user/lang/logout rows live inside .mnv-nav but are
   HIDDEN on desktop. They only appear inside the open mobile dropdown
   (revealed in the @media block below). Injected by app-header.js when
   the page has a real mobile menu (burger + nav → .mnv-mmenu). */
.mnv-nav .mnv-nav-ico,
.mnv-nav .mnv-m { display: none; }

/* ── hamburger (mobile) ── */
.mnv-burger { display: none; width: 2.8rem; height: 2.8rem; border: none; background: none;
  cursor: pointer; padding: 0; place-items: center; gap: 5px; flex-direction: column; }
.mnv-burger span { display: block; width: 24px; height: 2.5px; background: var(--mh-navy); border-radius: 2px; }

@media (max-width: 880px) {
  /* The middle nav is gone on mobile → without it the flex items bunched on the
     left. Push the logo to the left and the actions (bell, burger) to the right. */
  .mnv-header { justify-content: space-between; }
  .mnv-nav { display: none; }
  /* flex-direction is column, so justify-content centres the 3 lines
     vertically — without it they pack at the top and the burger sits
     higher than the search circle / bell (header looked misaligned). */
  .mnv-burger { display: flex; align-items: center; justify-content: center; }
  .mnv-logo .mnv-tag { display: none; }
  /* Wordmark più piccolo su mobile: a 1.7rem occupava ~42% dello schermo */
  .mnv-logo img { height: 1.35rem; }
  #appHeader #navGreeting { display: none; }

  /* Consolidated mobile menu: the top bar stays clean (logo + bell + burger);
     the avatar/greeting, language switch and logout all move INTO the dropdown.
     Only on pages that actually have the mobile menu (.mnv-mmenu, set by JS). */
  .mnv-header.mnv-mmenu #user-menu-mount,
  .mnv-header.mnv-mmenu #menevo-lang-switcher { display: none; }

  /* self-contained mobile dropdown */
  .mnv-header.nav-open .mnv-nav {
    display: flex; flex-direction: column; align-items: stretch; gap: 0.05rem;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 119;
    background: #FCF4DB; border-bottom: 1px solid rgba(0,62,84,0.1);
    box-shadow: 0 14px 26px rgba(0,62,84,0.12); padding: 0.5rem clamp(1rem,4vw,3rem) 0.9rem;
  }
  .mnv-header.nav-open .mnv-nav a {
    display: flex; align-items: center; gap: 0.85rem;
    width: 100%; padding: 0.8rem 0; font-size: 1.1rem;
  }
  .mnv-header.nav-open .mnv-nav a.is-active::after { display: none; }
  .mnv-header.nav-open .mnv-nav a.is-active { color: var(--mh-navy); }

  /* tab icons (mobile-only) */
  .mnv-header.nav-open .mnv-nav .mnv-nav-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.4rem; height: 1.4rem; flex-shrink: 0; color: rgba(0, 62, 84, 0.7);
  }
  .mnv-header.nav-open .mnv-nav a.is-active .mnv-nav-ico { color: var(--mh-navy); }
  .mnv-header.nav-open .mnv-nav .mnv-nav-ico svg {
    width: 100%; height: 100%; stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }

  /* user header (avatar + greeting) */
  .mnv-header.nav-open .mnv-nav .mnv-m { display: flex; }
  .mnv-header.nav-open .mnv-nav .mnv-m-user {
    align-items: center; gap: 0.7rem; width: 100%;
    padding: 0.3rem 0 0.85rem; margin-bottom: 0.25rem;
    border-bottom: 1px solid rgba(0, 62, 84, 0.12);
  }
  .mnv-m-av {
    width: 2.6rem; height: 2.6rem; border-radius: 50%; overflow: hidden;
    background: rgba(0, 62, 84, 0.1); color: var(--mh-navy);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.95rem; flex-shrink: 0;
  }
  .mnv-m-av img { width: 100%; height: 100%; object-fit: cover; }
  .mnv-m-hi { font-weight: 800; color: var(--mh-navy); font-size: 1.05rem; }

  /* footer: language switch + logout */
  .mnv-header.nav-open .mnv-nav .mnv-m-foot {
    flex-direction: column; align-items: stretch; gap: 0.1rem; width: 100%;
    margin-top: 0.25rem; padding-top: 0.35rem;
    border-top: 1px solid rgba(0, 62, 84, 0.12);
  }
  .mnv-m-lang {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 0.75rem 0;
  }
  .mnv-m-lang-label {
    display: flex; align-items: center; gap: 0.85rem;
    color: var(--mh-navy); font-weight: 600; font-size: 1rem;
  }
  .mnv-m-lang-label svg {
    width: 1.4rem; height: 1.4rem; flex-shrink: 0; stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }
  .mnv-m-lang-btns { display: inline-flex; gap: 6px; flex-shrink: 0; }
  .mnv-m-lang-btns button {
    border: 1px solid rgba(0, 62, 84, 0.2); background: none; color: var(--mh-navy);
    font-family: inherit; font-size: 0.95rem; font-weight: 700;
    padding: 6px 12px; border-radius: 9px; cursor: pointer; opacity: 0.65;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  }
  .mnv-m-lang-btns button.active {
    opacity: 1; background: var(--mh-yellow); border-color: var(--mh-yellow); color: var(--mh-navy);
  }
  .mnv-m-logout {
    display: flex; align-items: center; gap: 0.85rem; width: 100%;
    padding: 0.75rem 0; background: none; border: none; cursor: pointer;
    color: #C0392B; font-family: inherit; font-size: 1rem; font-weight: 600; text-align: left;
  }
  .mnv-m-logout svg {
    width: 1.4rem; height: 1.4rem; flex-shrink: 0; stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }
}

/* ── reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mnv-icon-btn, .mnv-nav a { transition: none; }
}

/* skip-to-content link */
.mnv-skip { position: absolute; left: -9999px; top: 0; z-index: 200; background: var(--mh-navy, #003E54);
  color: #fff; padding: 0.7rem 1.1rem; border-radius: 0 0 8px 0; font-weight: 700; text-decoration: none; }
.mnv-skip:focus { left: 0; }


/* anon sign-in (news/public) */
.mnv-signin { display: inline-flex; align-items: center; font-weight: 800; color: #003E54;
  text-decoration: none; padding: 0.5rem 1.1rem; border: 2px solid #003E54; border-radius: 999px; }
.mnv-signin:hover { background: #003E54; color: #fff; }
