/* ==========================================
   CABECERA GLOBAL (ESCRITORIO)
   ========================================== */
.site-header {
  background-color: var(--azul-fondo-oscuro, #030a16);
  padding: 12px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Usamos CSS Grid de 3 columnas para centrado absoluto */
.header-container {
  display: grid;
  grid-template-columns: auto 1fr auto; /* Logo | Menú Centrado | Acciones */
  align-items: center;
  width: 100%;
}

.site-logo {
  display: flex;
  align-items: center;
}

.site-logo img {
  max-height: 110px;
  width: auto;
  display: block;
  margin-bottom: 0;
}

/* --- CONTENEDOR NAVEGACIÓN Y ACCIONES --- */
.nav-wrapper {
  display: contents; /* Permite que .main-navigation y .header-actions sigan el grid del padre */
}

/* --- NAVEGACIÓN DESKTOP (Centrada Matemáticamente) --- */
.main-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-list li {
  position: relative;
}

.menu-item-link-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.menu-item-link-wrapper a {
  flex-grow: 1;
}

.nav-list li a {
  color: var(--blanco, #ffffff);
  text-decoration: none;
  font-family: var(--font-principal);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 0;
  position: relative;
  transition: color 0.3s ease;
  white-space: nowrap;
}

.nav-list li a:hover {
  color: var(--verde-hover);
}

.nav-list li.current-menu-item > .menu-item-link-wrapper a::after,
.nav-list li.current_page_item > .menu-item-link-wrapper a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--verde-neon);
  border-radius: 2px;
}

/* --- BOTÓN FLECHA TOGGLE (MENÚS MULTINIVEL) --- */
.submenu-toggle-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.submenu-toggle-btn .arrow-icon {
  transition: transform 0.3s ease;
}

.menu-item-has-children.is-expanded > .menu-item-link-wrapper .submenu-toggle-btn .arrow-icon {
  transform: rotate(180deg);
}

/* --- SUBMENÚ NIVEL 1 (PRIMER DROPDOWN FLOTANTE) --- */
.nav-list .sub-menu {
  list-style: none;
  margin: 0;
  padding: 10px 0;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background-color: var(--azul-fondo-oscuro, #030a16);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1010;
}

@media screen and (min-width: 1271px) {
  .nav-list > .menu-item-has-children:hover > .sub-menu,
  .nav-list > .menu-item-has-children.is-expanded > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.nav-list .sub-menu li {
  width: 100%;
  padding: 0 12px;
}

.nav-list .sub-menu li a {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  display: block;
  border-radius: 4px;
  font-weight: 500;
}

.nav-list .sub-menu li a:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--verde-neon);
}

/* --- SUB-HIJOS (NIVEL 2 Y 3: DESPLIEGUE VERTICAL HACIA ABAJO) --- */
.nav-list .sub-menu .sub-menu {
  position: static;
  box-shadow: none;
  border: none;
  border-left: 2px solid rgba(140, 198, 62, 0.3);
  border-radius: 0;
  margin-left: 10px;
  padding-left: 8px;
  padding-top: 4px;
  padding-bottom: 4px;
  display: none;
  opacity: 1;
  visibility: visible;
  transform: none;
  background: transparent;
}

.nav-list .sub-menu .menu-item-has-children.is-expanded > .sub-menu {
  display: block !important;
}

/* --- ACCIONES DERECHA (Idioma + Contacto) --- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
}

.btn-contact {
  display: inline-block;
  color: var(--verde-neon);
  border: 1.5px solid var(--verde-neon);
  padding: 10px 24px;
  border-radius: 25px;
  font-family: var(--font-principal);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.8px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-contact:hover {
  background-color: var(--verde-neon);
  color: var(--azul-fondo-oscuro, #030a16);
  box-shadow: 0 0 12px rgba(163, 230, 53, 0.4);
}

/* --- SELECTOR DE IDIOMAS (POLYLANG) --- */
.lang-switcher {
  position: relative;
  display: inline-block;
}

.lang-btn-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 20px;
  font-family: var(--font-principal, sans-serif);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lang-btn-current .lang-code {
  color: #ffffff;
  display: inline-block;
}

.lang-btn-current:hover {
  border-color: var(--verde-neon);
  color: var(--verde-neon);
}

.world-icon {
  width: 15px;
  height: 15px;
  stroke: var(--verde-neon, #8CC63E);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background-color: var(--azul-fondo-oscuro, #030a16);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  min-width: 90px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 1005;
}

.lang-switcher:hover .lang-dropdown,
.lang-switcher.is-open .lang-dropdown {
  display: block;
}

.lang-dropdown li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lang-dropdown li a {
  display: block;
  padding: 6px 14px;
  color: #ffffff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
}

.lang-dropdown li a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--verde-neon);
}

/* --- BOTÓN TRES PUNTOS (Mobile / Tablet) --- */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.menu-toggle .dot {
  width: 5px;
  height: 5px;
  background-color: var(--blanco, #ffffff);
  border-radius: 50%;
  display: block;
}

/* ==========================================
   MOBILE & TABLET (<1270px)
   ========================================== */
@media screen and (max-width: 1270px) {
  .header-container {
    display: flex;
    justify-content: space-between;
  }

  .menu-toggle {
    display: flex;
  }

  /* Restablecemos .nav-wrapper como panel lateral para pantallas pequeñas */
  .nav-wrapper {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--azul-fondo-oscuro, #030a16);
    flex-direction: column;
    justify-content: flex-start;
    padding: 80px 24px 40px 24px;
    gap: 32px;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.7);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: none; /* Mantenemos exactamente la configuración original */
    z-index: 1000;
  }

  .nav-wrapper.is-active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  }

  .main-navigation {
    margin: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
  }

  /* Submenús en modo acordeón móvil */
  .nav-list .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--verde-neon);
    margin-left: 10px;
    padding-left: 10px;
    display: none;
    background: transparent;
  }

  .nav-list .menu-item-has-children.is-expanded > .sub-menu {
    display: block !important;
  }

  .header-actions {
    width: 100%;
    flex-direction: column-reverse;
    margin-top: auto;
    justify-content: flex-start;
  }

  .btn-contact {
    width: 100%;
    text-align: center;
  }

  .lang-switcher {
    width: 100%;
  }

  .lang-btn-current {
    width: 100%;
    justify-content: space-between;
  }
}