/* ============================================================
 * Nefrocenter Nav Integration — CSS v1.2.5
 *
 * Cambiamenti v1.2:
 *  - Trigger mega menu:  li.menu-item.nc-mega  (dal Menu Importer)
 *  - Pannello mega menu: .nc-mega-panel         (nuovo, niente collisione)
 *  - Hover puro CSS: il mega si apre con :hover e :focus-within
 *    del <li> genitore, senza dipendere da JS o da Elementor.
 *
 * Zero conflitti con Elementor — niente override di .elementor-*
 * ============================================================ */

:root {
  --nc-navy:       #0E2A5C;
  --nc-navy-ink:   #081A3D;
  --nc-teal:       #0891B2;
  --nc-teal-soft:  #E8F1F6;
  --nc-teal-deep:  #155E75;
  --nc-heal:       #16A34A;
  --nc-heal-dark:  #15803D;
  --nc-gold:       #D4AF37;
  --nc-ivory:      #F7FAFC;
  --nc-muted:      #6B7280;
  --nc-border:     #E5E7EB;
  --nc-shadow-mega:0 12px 32px rgba(14,42,92,.12), 0 4px 12px rgba(14,42,92,.06);
  --nc-radius-md:  12px;
  --nc-radius-lg:  16px;
  --nc-radius-xl:  20px;
}

/* =========================================================
 * 1) UTILITY BAR (Elementor HTML widget)
 * ========================================================= */
.nc-utility-bar {
  background: var(--nc-navy-ink);
  color: rgba(255,255,255,.85);
  font-family: 'Figtree','Noto Sans',system-ui,sans-serif;
  font-size: 13px;
  line-height: 1.4;
}
.nc-utility-bar__inner {
  max-width: 1360px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; min-height: 40px;
}
.nc-utility-bar__group { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.nc-utility-bar a { color: rgba(255,255,255,.85); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: color .2s; }
.nc-utility-bar a:hover { color: #fff; }
.nc-utility-bar svg { width: 14px; height: 14px; }
.nc-lang-switch {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.08); cursor: pointer;
}
.nc-lang-switch strong { color: #fff; font-weight: 700; }
.nc-lang-switch span { opacity: .5; }
@media (max-width: 900px) {
  .nc-utility-bar__group--secondary { display: none; }
}

/* =========================================================
 * 2) TRIGGER TOP-LEVEL
 *    Elementor renderizza il <li> con il parent walker.
 *    Noi aggiungiamo solo stile senza toccare le classi elementor-*.
 * ========================================================= */

/* Position relative sul <li> trigger per ancorare il panel */
.elementor-nav-menu li.nc-mega,
.nc-nav li.nc-mega,
ul li.nc-mega.menu-item {
  position: relative;
}

/* Overflow visibile sul contenitore: Elementor a volte lo chiude */
.elementor-widget-nav-menu .elementor-nav-menu,
.elementor-widget-nav-menu .elementor-nav-menu > li,
.elementor-widget-nav-menu .elementor-nav-menu > li.nc-mega,
.nc-nav,
.nc-nav > li {
  overflow: visible !important;
}

/* =========================================================
 * 3) MEGA PANEL (il container)
 * ========================================================= */
.nc-mega-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 680px;
  max-width: min(1040px, 94vw);
  background: #fff;
  border: 1px solid var(--nc-border);
  border-radius: var(--nc-radius-xl);
  box-shadow: var(--nc-shadow-mega);
  padding: 26px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  z-index: 999;
  margin-top: 14px;
  text-align: left;
}

/* Bridge invisibile per non perdere hover uscendo dal <a> verso il panel */
.nc-mega-panel::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 0; right: 0;
  height: 14px;
}

/* Freccia pointer sopra il panel */
.nc-mega-panel::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  width: 14px; height: 14px;
  background: #fff;
  border-top: 1px solid var(--nc-border);
  border-left: 1px solid var(--nc-border);
  transform: translateX(-50%) rotate(45deg);
}

/* Varianti di larghezza — v1.2.4 leggermente più larghe per dare respiro a label */
.nc-mega-panel--2col { min-width: 680px; }
.nc-mega-panel--3col { min-width: 880px; }
.nc-mega-panel--4col { min-width: 1080px; max-width: min(1100px, 96vw); }

/* =========================================================
 * 4) APERTURA PANEL — CSS puro, niente JS richiesto
 * ========================================================= */

/* Hover desktop */
li.nc-mega:hover > .nc-mega-panel,
/* Tastiera */
li.nc-mega:focus-within > .nc-mega-panel,
/* Click / touch via JS */
li.nc-mega.nc-is-open > .nc-mega-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Colonne */
.nc-mega-panel__cols {
  display: grid;
  grid-template-columns: repeat(var(--nc-cols, 3), 1fr);
  gap: 26px;
}
.nc-mega-panel--2col .nc-mega-panel__cols { --nc-cols: 2; }
.nc-mega-panel--3col .nc-mega-panel__cols { --nc-cols: 3; }
.nc-mega-panel--4col .nc-mega-panel__cols { --nc-cols: 4; }

.nc-mega-panel__col {
  min-width: 0;
  display: flex; flex-direction: column;
  gap: 2px;
}

.nc-mega-panel__head {
  font-family: 'Figtree', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--nc-teal);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--nc-border);
}

.nc-mega-panel__item { list-style: none; }

/* v1.2.5 — badge come EYEBROW TAG sopra il label
 *  Layout grid 2 righe x 3 colonne:
 *    Riga 1: [.....badge spans tutta la riga.....]
 *    Riga 2: [icon] [label..............] [count]
 *
 *  Vantaggi:
 *  - Label ha tutto lo spazio della cella (niente compressione)
 *  - Badge chiaramente categoria/tag della voce (gerarchia visiva)
 *  - Voci senza badge: row 1 collapsa, layout normale 1-riga
 *  - Niente più spezzatura parole (overflow-wrap default)
 */
.nc-mega-panel__link {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  font-family: 'Noto Sans', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--nc-navy) !important;
  text-decoration: none !important;
  transition: background .2s, color .2s;
  line-height: 1.35;
}
.nc-mega-panel__link:hover {
  background: var(--nc-teal-soft);
  color: var(--nc-teal-deep) !important;
}

/* Badge sopra (riga 1, span tutta la cella) */
.nc-mega-panel__badge {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: start;
  align-self: end;
  margin: 0 0 1px 0;
  display: inline-block;
  width: fit-content;
  font-family: 'Figtree', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(212, 175, 55, .18);
  color: #8B6A00;
  text-transform: uppercase;
  line-height: 1.4;
}

/* Icon (riga 2, col 1) */
.nc-mega-panel__icon {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
  width: 18px;
  height: 18px;
  color: var(--nc-teal);
  flex-shrink: 0;
}

/* Label (riga 2, col 2) — tutto lo spazio per sé */
.nc-mega-panel__label {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  white-space: normal;
  /* default overflow-wrap: parole intere, mai spezzate a sillabe */
}

/* Count (riga 2, col 3) */
.nc-mega-panel__count {
  grid-column: 3;
  grid-row: 2;
  align-self: center;
  color: var(--nc-muted);
  font-size: 12px;
  font-weight: 500;
}
.nc-mega-panel__badge--green { background: rgba(22,163,74,.12); color: var(--nc-heal-dark); }
.nc-mega-panel__badge--teal  { background: var(--nc-teal-soft); color: var(--nc-teal-deep); }
.nc-mega-panel__badge--gold  { background: rgba(212,175,55,.18); color: #8B6A00; }

/* =========================================================
 * 5) HIGHLIGHT CARD
 * ========================================================= */
.nc-mega-panel__highlight {
  background: linear-gradient(135deg, var(--nc-navy) 0%, var(--nc-teal) 100%);
  color: #fff;
  border-radius: 14px;
  padding: 22px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 220px;
}
.nc-mega-panel__highlight-title {
  font-family: 'Figtree', sans-serif;
  font-size: 17px; font-weight: 800;
  line-height: 1.25;
  margin: 0 0 10px;
  color: #fff;
}
.nc-mega-panel__highlight-text {
  font-size: 13px; margin: 0 0 16px;
  color: rgba(255,255,255,.85); line-height: 1.5;
}
.nc-mega-panel__highlight-cta {
  display: inline-flex;
  align-items: center; gap: 6px;
  font-family: 'Figtree', sans-serif;
  font-size: 13px; font-weight: 700;
  background: #fff;
  color: var(--nc-navy) !important;
  padding: 8px 14px;
  border-radius: 999px;
  align-self: flex-start;
  text-decoration: none !important;
  transition: background .2s, transform .2s;
}
.nc-mega-panel__highlight-cta:hover { background: var(--nc-gold); transform: translateY(-1px); }

/* =========================================================
 * 6) MINIMAP CARD
 * ========================================================= */
.nc-mega-panel__minimap {
  background: linear-gradient(160deg, var(--nc-teal-soft) 0%, #fff 100%);
  border-radius: 14px;
  padding: 20px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}
.nc-mega-panel__minimap-lbl {
  font-family: 'Figtree', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--nc-teal);
}
.nc-mega-panel__minimap-text {
  font-size: 13px; color: var(--nc-muted);
  margin: 6px 0 0; line-height: 1.5;
}
.nc-mega-panel__minimap-num {
  font-family: 'Figtree', sans-serif;
  font-size: 42px; font-weight: 800;
  color: var(--nc-navy); line-height: 1;
  margin-top: 14px;
}
.nc-mega-panel__minimap-sublbl {
  font-family: 'Figtree', sans-serif;
  font-size: 12px; font-weight: 600;
  color: var(--nc-muted); text-transform: uppercase;
  letter-spacing: .05em; margin-top: 4px;
}
.nc-mega-panel__minimap-cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, var(--nc-heal), var(--nc-heal-dark));
  color: #fff !important;
  padding: 10px 14px;
  border-radius: 999px;
  font-family: 'Figtree', sans-serif;
  font-size: 13px; font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(22,163,74,.3);
  transition: transform .2s, box-shadow .2s;
}
.nc-mega-panel__minimap-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(22,163,74,.4);
}

/* =========================================================
 * 7) RESPONSIVE — mega nascosto su mobile (usa drawer)
 * ========================================================= */
@media (max-width: 1100px) {
  .nc-mega-panel { display: none !important; }
}

/* =========================================================
 * 8) MOBILE DRAWER — entrata da destra "catchy"
 *    v1.2.3:
 *    - Spring easing sul pannello (cubic-bezier overshoot)
 *    - Backdrop blur progressivo (animato)
 *    - Stagger animation su voci menu (cascata)
 *    - Hamburger morfato in X via CSS
 *    - Decorative shine sul bordo sinistro del pannello
 * ========================================================= */

/* Body lock quando drawer aperto (no scroll background) */
body.nc-drawer-open { overflow: hidden; }

/* === BACKDROP === */
.nc-drawer {
  position: fixed; inset: 0;
  background: rgba(8, 26, 61, 0);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    background .55s cubic-bezier(.2, .8, .2, 1),
    opacity .35s ease,
    visibility .35s ease,
    backdrop-filter .55s ease;
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
}
.nc-drawer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  background: rgba(8, 26, 61, .65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* === PANEL === */
.nc-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(420px, 88vw);
  height: 100vh;
  height: 100dvh;             /* dvh = dynamic viewport (mobile-friendly) */
  background: linear-gradient(180deg, #fff 0%, #FAFCFF 100%);
  padding: 22px 24px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  /* Spring easing — leggero overshoot tipo "card" che entra con energia */
  transition: transform .55s cubic-bezier(.34, 1.36, .64, 1);
  display: flex;
  flex-direction: column;
  font-family: 'Figtree', 'Noto Sans', system-ui, sans-serif;
  box-shadow: -24px 0 60px rgba(8, 26, 61, .25);
  /* Decorative shine sul bordo interno */
  position: absolute;
}
.nc-drawer.is-open .nc-drawer__panel {
  transform: translateX(0);
}

/* Glow line sul bordo sinistro */
.nc-drawer__panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg,
    transparent 0%,
    var(--nc-teal) 30%,
    var(--nc-heal) 70%,
    transparent 100%);
  opacity: 0;
  transition: opacity .8s ease .2s;
}
.nc-drawer.is-open .nc-drawer__panel::before {
  opacity: .6;
}

/* === HEAD === */
.nc-drawer__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--nc-border);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .4s ease .15s, transform .5s cubic-bezier(.2,.8,.2,1) .15s;
}
.nc-drawer.is-open .nc-drawer__head {
  opacity: 1;
  transform: translateY(0);
}

.nc-drawer__brand {
  font-family: 'Figtree', sans-serif;
  font-weight: 800;
  font-size: 19px;
  color: var(--nc-navy);
  text-decoration: none;
  line-height: 1;
}
.nc-drawer__brand-sub {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--nc-muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.nc-drawer__brand-name span { color: var(--nc-teal); }

.nc-drawer__close {
  width: 44px;
  height: 44px;
  border: 0;
  background: var(--nc-ivory);
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--nc-navy);
  transition: background .2s, transform .2s;
}
.nc-drawer__close:hover {
  background: var(--nc-teal-soft);
  transform: rotate(90deg);
}

/* === NAV con stagger animation === */
.nc-drawer__nav {
  list-style: none;
  margin: 0;
  padding: 18px 0 0;
  flex: 1;
}
.nc-drawer__nav > li {
  border-bottom: 1px solid var(--nc-border);
  opacity: 0;
  transform: translateX(28px);
  transition: opacity .5s ease, transform .55s cubic-bezier(.2, .8, .2, 1);
}

/* Stagger: ogni voce ritardata di 60ms in sequenza */
.nc-drawer.is-open .nc-drawer__nav > li:nth-child(1)  { transition-delay: .20s; }
.nc-drawer.is-open .nc-drawer__nav > li:nth-child(2)  { transition-delay: .26s; }
.nc-drawer.is-open .nc-drawer__nav > li:nth-child(3)  { transition-delay: .32s; }
.nc-drawer.is-open .nc-drawer__nav > li:nth-child(4)  { transition-delay: .38s; }
.nc-drawer.is-open .nc-drawer__nav > li:nth-child(5)  { transition-delay: .44s; }
.nc-drawer.is-open .nc-drawer__nav > li:nth-child(6)  { transition-delay: .50s; }
.nc-drawer.is-open .nc-drawer__nav > li:nth-child(7)  { transition-delay: .56s; }
.nc-drawer.is-open .nc-drawer__nav > li {
  opacity: 1;
  transform: translateX(0);
}

.nc-drawer__nav details > summary {
  list-style: none;
  padding: 16px 6px;
  font-weight: 600;
  font-size: 17px;
  color: var(--nc-navy);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s;
}
.nc-drawer__nav details > summary:hover {
  color: var(--nc-teal);
}
.nc-drawer__nav summary::-webkit-details-marker { display: none; }
.nc-drawer__nav details[open] > summary .nc-drawer__chev {
  transform: rotate(180deg);
  color: var(--nc-teal);
}
.nc-drawer__chev {
  width: 18px;
  height: 18px;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), color .2s;
}

/* Sub-list con animazione apertura */
.nc-drawer__sub {
  list-style: none;
  margin: 0 0 14px;
  padding: 0 0 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: nc-drawer-sub-in .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes nc-drawer-sub-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nc-drawer__sub a {
  padding: 11px 12px;
  display: block;
  font-size: 15px;
  color: var(--nc-muted);
  border-radius: 8px;
  text-decoration: none;
  transition: background .2s, color .2s, transform .2s;
}
.nc-drawer__sub a:hover,
.nc-drawer__sub a:active {
  background: var(--nc-teal-soft);
  color: var(--nc-teal-deep);
  transform: translateX(4px);
}

/* === FOOTER del drawer === */
.nc-drawer__foot {
  padding-top: 22px;
  margin-top: 14px;
  border-top: 1px solid var(--nc-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease .65s, transform .55s cubic-bezier(.2,.8,.2,1) .65s;
}
.nc-drawer.is-open .nc-drawer__foot {
  opacity: 1;
  transform: translateY(0);
}

.nc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none !important;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.nc-btn--primary {
  background: linear-gradient(180deg, var(--nc-heal), var(--nc-heal-dark));
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(22,163,74,.35);
}
.nc-btn--primary:hover,
.nc-btn--primary:active {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(22,163,74,.45);
}
.nc-btn--outline {
  background: transparent;
  color: var(--nc-navy) !important;
  border: 1.5px solid var(--nc-border);
}
.nc-btn--outline:hover {
  border-color: var(--nc-navy);
  background: var(--nc-navy);
  color: #fff !important;
}

/* === HAMBURGER classico (v1.2.4) ===
 *  - Design pulito: 3 linee orizzontali, niente box decorativo
 *  - Pseudo-elementi (::before/::after) invece di <span> vuoti
 *    (più robusti — Elementor a volte rimuove span vuoti dal markup)
 *  - Su tap: linea centrale fade, le altre 2 si incrociano in X
 */
.nc-hamburger {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.nc-hamburger:focus-visible {
  outline: 3px solid var(--nc-heal);
  outline-offset: 2px;
  border-radius: 8px;
}

/* La linea centrale (è il <span> stesso) */
.nc-hamburger__icon,
.nc-hamburger__icon::before,
.nc-hamburger__icon::after {
  display: block;
  width: 24px;
  height: 2.5px;
  background: var(--nc-navy);
  border-radius: 2px;
  transition:
    transform .35s cubic-bezier(.4, 0, .2, 1),
    background .25s ease,
    top .35s cubic-bezier(.4, 0, .2, 1),
    opacity .2s ease;
}

.nc-hamburger__icon {
  position: relative;
}

/* Le altre 2 linee come pseudo-elementi */
.nc-hamburger__icon::before,
.nc-hamburger__icon::after {
  content: '';
  position: absolute;
  left: 0;
}
.nc-hamburger__icon::before { top: -8px; }
.nc-hamburger__icon::after  { top:  8px; }

/* Hover: piccolo accent teal */
.nc-hamburger:hover .nc-hamburger__icon,
.nc-hamburger:hover .nc-hamburger__icon::before,
.nc-hamburger:hover .nc-hamburger__icon::after {
  background: var(--nc-teal);
}

/* === ATTIVO: X morfata === */
.nc-hamburger.is-active .nc-hamburger__icon {
  background: transparent;     /* linea centrale scompare */
}
.nc-hamburger.is-active .nc-hamburger__icon::before {
  top: 0;
  transform: rotate(45deg);
  background: var(--nc-navy);
}
.nc-hamburger.is-active .nc-hamburger__icon::after {
  top: 0;
  transform: rotate(-45deg);
  background: var(--nc-navy);
}

@media (max-width: 1100px) {
  .nc-hamburger { display: inline-flex; }
}

/* Reduced motion — rispetta preferenze utente */
@media (prefers-reduced-motion: reduce) {
  .nc-drawer,
  .nc-drawer__panel,
  .nc-drawer__head,
  .nc-drawer__foot,
  .nc-drawer__nav > li,
  .nc-drawer__sub,
  .nc-hamburger__icon,
  .nc-hamburger__icon::before,
  .nc-hamburger__icon::after {
    transition-duration: .15s !important;
    animation-duration: .15s !important;
    transition-delay: 0s !important;
  }
}
