/**
 * Nexus Nav — Estilos del widget de navegación
 * Compatible con Elementor Free/Pro
 *
 * Autor: Jesús Ángel Hernández / Jetechnik
 * Versión: 1.0.0
 */

/* ============================================================
   1 · RESET BASE
   ============================================================ */
.nnav-wrapper *,
.nnav-wrapper *::before,
.nnav-wrapper *::after {
  box-sizing: border-box;
}

.nnav-wrapper ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nnav-wrapper a {
  text-decoration: none;
}


/* ============================================================
   2 · CONTENEDOR PRINCIPAL
   ============================================================ */
.nnav-wrapper {
  position: relative;
  width: 100%;
}


/* ============================================================
   3 · MENÚ HORIZONTAL (escritorio)
   ============================================================ */
.nnav-layout-horizontal .nnav-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

/* Alineación */
.nnav-layout-horizontal.nnav-align-left   .nnav-nav { justify-content: flex-start; }
.nnav-layout-horizontal.nnav-align-center .nnav-nav { justify-content: center;     }
.nnav-layout-horizontal.nnav-align-right  .nnav-nav { justify-content: flex-end;   }

/* Lista de ítems */
.nnav-layout-horizontal .nnav-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* Ítem */
.nnav-item {
  position: relative;
}

/* Enlace */
.nnav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1;
  color: rgba(255,255,255,.85);
  padding: 8px 16px;
  border-radius: 8px;
  transition: background .2s ease, color .2s ease;
  white-space: nowrap;
  cursor: pointer;
}

.nnav-link:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Ítem activo */
.nnav-item.current-menu-item > .nnav-link,
.nnav-item.current-menu-ancestor > .nnav-link,
.nnav-item.current-page-ancestor > .nnav-link {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Indicador activo (línea naranja bajo el ítem) */
.nnav-has-indicator .nnav-link {
  position: relative;
}

.nnav-has-indicator .nnav-item.current-menu-item > .nnav-link::after,
.nnav-has-indicator .nnav-item.current-menu-ancestor > .nnav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: #D9581A;
  border-radius: 2px;
}

/* Flecha de dropdown */
.nnav-arrow {
  font-size: .7rem;
  opacity: .7;
  transition: transform .2s ease;
  display: inline-block;
}

.nnav-item:hover > .nnav-link .nnav-arrow,
.nnav-item.nnav-open > .nnav-link .nnav-arrow {
  transform: rotate(180deg);
}


/* ============================================================
   4 · DROPDOWN (submenú escritorio)
   ============================================================ */
.nnav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  z-index: 9999;

  /* Oculto por defecto */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

/* Sombra del dropdown */
.nnav-dropdown-shadow .nnav-dropdown {
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

/* Mostrar dropdown */
.nnav-item:hover > .nnav-dropdown,
.nnav-item:focus-within > .nnav-dropdown,
.nnav-item.nnav-open > .nnav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
}

/* Ítems del dropdown */
.nnav-dropdown .nnav-item {
  display: block;
  width: 100%;
}

.nnav-link-sub {
  color: #2C2C3A !important;
  border-radius: 8px;
  font-size: .86rem;
  font-weight: 500;
  padding: 9px 14px;
  white-space: normal;
}

.nnav-link-sub:hover {
  background: rgba(26,63,122,.06) !important;
  color: #1A3F7A !important;
}

/* Dropdown de tercer nivel */
.nnav-dropdown .nnav-dropdown {
  top: 0;
  left: calc(100% + 6px);
}


/* ============================================================
   5 · MENÚ VERTICAL
   ============================================================ */
.nnav-layout-vertical .nnav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nnav-layout-vertical .nnav-dropdown {
  position: static;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: none;
  box-shadow: none;
  background: transparent;
  padding: 0 0 0 16px;
  margin-top: 2px;
}

.nnav-layout-vertical .nnav-dropdown .nnav-link-sub {
  color: inherit !important;
}


/* ============================================================
   6 · BOTÓN CTA
   ============================================================ */
.nnav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 9px 22px;
  border-radius: 50px;
  background: #D9581A;
  color: #fff;
  margin-left: 8px;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(217,88,26,.35);
}

.nnav-cta:hover {
  background: #bf4d14;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217,88,26,.45);
  color: #fff;
}

.nnav-cta-icon {
  font-size: 1rem;
  line-height: 1;
}


/* ============================================================
   7 · BOTÓN HAMBURGUESA
   ============================================================ */
.nnav-toggle {
  display: none;  /* Oculto en escritorio — JS lo muestra en móvil */
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.2rem;
  color: #fff;
  transition: background .2s ease, border-color .2s ease;
  line-height: 1;
}

.nnav-toggle:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.6);
}

.nnav-toggle-icon {
  display: block;
  line-height: 1;
}


/* ============================================================
   8 · PANEL MÓVIL
   ============================================================ */
.nnav-mobile-panel {
  display: none;  /* JS lo muestra cuando corresponde */
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100vh;
  background: #0D2754;
  z-index: 99999;
  padding: 24px 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,.3);
}

.nnav-mobile-panel.nnav-panel-open {
  transform: translateX(0);
}

/* Botón cerrar */
.nnav-mobile-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  margin-left: auto;
  margin-bottom: 24px;
  transition: background .2s;
}

.nnav-mobile-close:hover {
  background: rgba(255,255,255,.2);
}

/* Lista de ítems móviles */
.nnav-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nnav-mobile-list .nnav-item {
  display: block;
  width: 100%;
}

.nnav-mobile-list .nnav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255,255,255,.85);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  width: 100%;
  transition: background .2s;
}

.nnav-mobile-list .nnav-link:hover,
.nnav-mobile-list .nnav-item.current-menu-item > .nnav-link {
  background: rgba(255,255,255,.12);
  color: #fff;
}

/* Expand icon para sub-menús móviles */
.nnav-mobile-expand {
  font-size: 1.2rem;
  opacity: .6;
  transition: transform .2s ease;
  line-height: 1;
}

.nnav-mobile-list .nnav-item.nnav-mobile-sub-open > .nnav-link .nnav-mobile-expand {
  transform: rotate(90deg);
  opacity: 1;
}

/* Sub-menús en móvil */
.nnav-mobile-sub {
  display: none;
  padding-left: 16px;
  margin-top: 2px;
}

.nnav-mobile-sub.nnav-mobile-sub-visible {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nnav-mobile-sub .nnav-link {
  font-size: .88rem;
  opacity: .85;
  padding: 10px 14px;
}

/* Botón CTA en móvil */
.nnav-mobile-cta {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.nnav-mobile-cta .nnav-cta {
  width: 100%;
  justify-content: center;
  margin: 0;
  padding: 13px 24px;
}


/* ============================================================
   9 · OVERLAY OSCURO (fondo al abrir el móvil)
   ============================================================ */
.nnav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99998;
  opacity: 0;
  transition: opacity .3s ease;
  cursor: pointer;
}

.nnav-overlay.nnav-overlay-visible {
  opacity: 1;
}


/* ============================================================
   10 · BREAKPOINT RESPONSIVE
   (el JS inyecta el <style> con el breakpoint correcto,
    este CSS base cubre el caso 768px por defecto)
   ============================================================ */
@media (max-width: 768px) {

  /* Ocultar menú de escritorio */
  .nnav-nav {
    display: none !important;
  }

  /* Mostrar hamburguesa */
  .nnav-toggle {
    display: flex !important;
  }

  /* El panel se inicializa como display:none vía JS,
     pero necesitamos que sea visible cuando se abre */
  .nnav-mobile-panel.nnav-panel-init {
    display: block;
  }
}

/* Escritorio: ocultar botón hamburguesa y panel */
@media (min-width: 769px) {
  .nnav-toggle      { display: none !important;   }
  .nnav-mobile-panel{ display: none !important;   }
  .nnav-overlay     { display: none !important;   }
}


/* ============================================================
   11 · ACCESIBILIDAD
   ============================================================ */
.nnav-link:focus-visible {
  outline: 2px solid #D9581A;
  outline-offset: 2px;
}

.nnav-toggle:focus-visible,
.nnav-mobile-close:focus-visible {
  outline: 2px solid #D9581A;
  outline-offset: 2px;
}

/* Screen reader */
.nnav-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}


/* ============================================================
   12 · SCROLL-SPY — Estado activo dinámico vía JS
   ============================================================ */

/*
 * Cuando el scroll-spy está activo en el wrapper (.nnav-spy-active),
 * suprimimos el estilo de current-menu-item de WordPress (que siempre
 * apunta a "Inicio") y lo sustituimos por .nnav-active que el JS
 * asigna al ítem cuya sección está en pantalla.
 */

/* Suprimir current-menu-item cuando hay scroll-spy activo */
.nnav-spy-active .nnav-item.current-menu-item > .nnav-link {
  background: transparent;
  color: rgba(255,255,255,.85);
}
.nnav-spy-active.nnav-has-indicator
  .nnav-item.current-menu-item > .nnav-link::after {
  display: none;
}

/* Ítem activo por scroll-spy */
.nnav-item.nnav-active > .nnav-link {
  background: rgba(255,255,255,.15) !important;
  color: #fff !important;
}

/* Indicador naranja bajo el ítem activo por scroll-spy */
.nnav-has-indicator .nnav-item.nnav-active > .nnav-link {
  position: relative;
}
.nnav-has-indicator .nnav-item.nnav-active > .nnav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: #D9581A;
  border-radius: 2px;
  display: block !important;
}

/* En móvil */
.nnav-mobile-list .nnav-item.nnav-active > .nnav-link {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
}
