/*
 * Header — Glassmorphism dark sticky navigation
 * NINAKURU PRO — NEXUS PATRIMONIAL Design
 */

/* ── Skip Link (accesibilidad) ──────────────────────────────────────────────── */
.np-skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 10000;
    padding: 10px 18px;
    background: var(--np-cyan);
    color: #FFFFFF;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: top 0.2s ease;
}

.np-skip-link:focus {
    top: 12px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ── Top Banner ─────────────────────────────────────────────────────────────── */
.np-topbar {
    position: relative;
    z-index: 200;
    padding: 8px 0;
    text-align: center;
    transition: all 0.3s ease;
}

.np-topbar .np-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.np-topbar__texto {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
}

.np-topbar__cerrar {
    background: none;
    border: none;
    color: rgba(16,24,40,0.8);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    flex-shrink: 0;
}

.np-topbar__cerrar:hover {
    color: #fff;
}

/* ── Header Principal ────────────────────────────────────────────────────────── */
.np-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}

.np-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--np-glass-bg);
    backdrop-filter: var(--np-glass-blur);
    -webkit-backdrop-filter: var(--np-glass-blur);
    border-bottom: 1px solid rgba(21, 101, 192,0.08);
    transition: inherit;
    z-index: -1;
}

/* Al hacer scroll */
.np-header.is-scrolled::before {
    background: rgba(255,255,255,0.95);
    border-bottom-color: rgba(21, 101, 192,0.15);
    box-shadow: 0 4px 30px rgba(16,24,40,0.14);
}

.np-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 72px;
}

/* ── Logo ────────────────────────────────────────────────────────────────────── */
.np-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.np-header__logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.2s;
}

.np-header__logo:hover .np-header__logo-img {
    opacity: 0.85;
}

.np-header__logo-text {
    font-family: var(--np-font-headings);
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--np-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Navegación ──────────────────────────────────────────────────────────────── */
.np-header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.np-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.np-menu-item {
    position: relative;
    list-style: none;
}

.np-menu-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--np-text-secondary);
    text-decoration: none;
    border-radius: 8px;
    position: relative;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

/* Línea inferior animada */
.np-menu-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: calc(100% - 24px);
    height: 2px;
    background: var(--np-gradient-primary);
    border-radius: 2px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Item activo (paginas reales: /portal/, /casos-de-exito/...) */
.np-menu-item.current-menu-item > .np-menu-link,
.np-menu-item.current-menu-ancestor > .np-menu-link {
    color: var(--np-cyan);
    background: rgba(21, 101, 192, 0.08);
}

.np-menu-item.current-menu-item > .np-menu-link::after,
.np-menu-item.current-menu-ancestor > .np-menu-link::after {
    transform: translateX(-50%) scaleX(1);
}

/* WordPress marca como "pagina actual" TODOS los enlaces personalizados que
   apuntan a la propia portada, aunque solo cambien de ancla (/#planes,
   /#contacto...). El menu entero salia encendido, y por eso pasar el raton
   por encima no se notaba: ya estaba todo en su estado maximo.
   Aqui se apagan los que son solo anclas. */
.np-menu-item.current-menu-item > .np-menu-link[href*="#"],
.np-menu-item.current-menu-ancestor > .np-menu-link[href*="#"] {
    color: var(--np-text-secondary);
    background: transparent;
}

.np-menu-item.current-menu-item > .np-menu-link[href*="#"]::after,
.np-menu-item.current-menu-ancestor > .np-menu-link[href*="#"]::after {
    transform: translateX(-50%) scaleX(0);
}

/* Hover y foco de teclado.
   Llevan [href] para igualar el peso de la regla de apagado de arriba (que
   usa [href*="#"]) y van AL FINAL, de modo que ganan por orden. Sin eso, el
   apagado pesaria mas y el hover no se veria. */
.np-menu-item > .np-menu-link[href]:hover,
.np-menu-item > .np-menu-link[href]:focus-visible {
    color: var(--np-cyan);
    background: rgba(21, 101, 192, 0.10);
}

.np-menu-item > .np-menu-link[href]:hover::after,
.np-menu-item > .np-menu-link[href]:focus-visible::after {
    transform: translateX(-50%) scaleX(1);
}

/* Arrow indicator */
.np-menu-arrow {
    display: flex;
    align-items: center;
    transition: transform 0.25s ease;
    color: var(--np-text-muted);
    margin-left: 1px;
}

.np-menu-item.is-open > .np-menu-link .np-menu-arrow {
    transform: rotate(180deg);
}

/* Separador visual entre grupos de ítems (cada 4to ítem) */
.np-menu-item + .np-menu-item {
    position: relative;
}

/* ── Dropdown ────────────────────────────────────────────────────────────────── */
.np-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    min-width: 220px;
    background: var(--np-bg-card);
    border: 1px solid rgba(21, 101, 192,0.12);
    border-radius: 12px;
    padding: 8px;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    box-shadow: 0 16px 48px rgba(16,24,40,0.17), 0 0 0 1px rgba(16,24,40,0.03);
    z-index: 50;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.np-has-dropdown:hover > .np-dropdown,
.np-has-dropdown.is-open > .np-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.np-dropdown .np-menu-link {
    border-radius: 8px;
    font-size: 0.875rem;
    padding: 10px 12px;
    width: 100%;
}

/* Dropdown anidado */
.np-dropdown--sub {
    top: -8px;
    left: calc(100% + 4px);
    transform: translateX(0) translateY(0);
    min-width: 200px;
}

.np-dropdown .np-has-dropdown:hover > .np-dropdown--sub {
    opacity: 1;
    visibility: visible;
}

/* ── Acciones del Header ─────────────────────────────────────────────────────── */
.np-header__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Separador visual antes del CTA */
.np-header__actions::before {
    content: '';
    display: block;
    width: 1px;
    height: 24px;
    background: rgba(16,24,40,0.1);
    margin: 0 4px;
}

/* Botón icono genérico */
.np-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--np-text-secondary);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    position: relative;
}

.np-btn-icon:hover {
    color: var(--np-text-primary);
    background: rgba(16,24,40,0.06);
}

/* WhatsApp */
.np-header__wa {
    color: #25D366;
}
.np-header__wa svg {
    width: 28px;
    height: 28px;
}
.np-header__wa:hover {
    color: #128C7E;
}

/* CTA Principal */
.np-header__cta {
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Botón Mi Portal — estilo outline-cyan mejorado */
.np-header__portal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--np-cyan);
    text-decoration: none;
    border: 1px solid rgba(21, 101, 192, 0.35);
    border-radius: 8px;
    background: rgba(21, 101, 192, 0.06);
    transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.np-header__portal:hover {
    color: #fff;
    background: var(--np-cyan);
    border-color: rgba(21, 101, 192, 0.6);
    box-shadow: 0 0 18px rgba(21, 101, 192, 0.18);
}

.np-header__portal svg {
    transition: transform 0.2s ease;
    opacity: 0.85;
}

.np-header__portal:hover svg {
    transform: scale(1.1);
    opacity: 1;
}

/* ── Hamburger ───────────────────────────────────────────────────────────────── */
.np-header__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid rgba(16,24,40,0.12);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    width: 44px;
    height: 44px;
}

.np-hamburger__bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--np-text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
    transform-origin: center;
}

/* Estado abierto */
.np-header.is-menu-open .np-header__hamburger .np-hamburger__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.np-header.is-menu-open .np-header__hamburger .np-hamburger__bar:nth-child(2) {
    opacity: 0;
    width: 0;
}
.np-header.is-menu-open .np-header__hamburger .np-hamburger__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Overlay de Búsqueda ─────────────────────────────────────────────────────── */
.np-search-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--np-bg-card);
    border-bottom: 1px solid rgba(21, 101, 192,0.12);
    padding: 20px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
    box-shadow: 0 8px 32px rgba(16,24,40,0.11);
}

.np-search-overlay.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.np-search-overlay__inner {
    max-width: var(--np-container-max);
    margin: 0 auto;
    padding: 0 var(--np-container-padding);
    display: flex;
    align-items: center;
    gap: 12px;
}

.np-search-overlay__form {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(16,24,40,0.05);
    border: 1px solid rgba(21, 101, 192,0.15);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.np-search-overlay__form:focus-within {
    border-color: var(--np-cyan);
}

.np-search-overlay__input {
    flex: 1;
    background: none;
    border: none;
    padding: 14px 16px;
    color: var(--np-text-primary);
    font-family: var(--np-font-body);
    font-size: 1rem;
    outline: none;
}

.np-search-overlay__input::placeholder {
    color: var(--np-text-muted);
}

.np-search-overlay__submit {
    background: none;
    border: none;
    padding: 12px 16px;
    color: var(--np-cyan);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
}

.np-search-overlay__submit:hover {
    opacity: 0.7;
}

.np-search-overlay__cerrar {
    background: rgba(16,24,40,0.06);
    border: 1px solid rgba(16,24,40,0.1);
    border-radius: 8px;
    padding: 10px;
    color: var(--np-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s, background 0.2s;
}

.np-search-overlay__cerrar:hover {
    color: var(--np-text-primary);
    background: rgba(16,24,40,0.1);
}

/* ── Overlay de fondo móvil ──────────────────────────────────────────────────── */
.np-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    backdrop-filter: blur(4px);
}

.np-nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ── Spacer header fixed ─────────────────────────────────────────────────────── */
.np-header-spacer {
    height: 72px;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .np-header__nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(360px, 90vw);
        height: 100vh;
        background: var(--np-bg-card);
        border-left: 1px solid rgba(21, 101, 192,0.1);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 88px 24px 32px;
        overflow-y: auto;
        transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
        z-index: 95;
    }

    .np-header.is-menu-open .np-header__nav {
        right: 0;
    }

    .np-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .np-menu-link {
        padding: 12px 16px;
        font-size: 1rem;
    }

    .np-dropdown {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border: none;
        border-left: 2px solid rgba(21, 101, 192,0.2);
        border-radius: 0;
        padding: 4px 0 4px 16px;
        display: none;
        background: transparent;
    }

    .np-dropdown.is-open {
        display: block;
    }

    .np-header__hamburger {
        display: flex;
    }

    .np-header__cta,
    .np-header__portal {
        display: none;
    }

    .np-header__actions::before {
        display: none;
    }
}

@media (max-width: 640px) {
    .np-header__inner {
        height: 64px;
    }
    .np-header-spacer {
        height: 64px;
    }
    .np-header__lang {
        display: none;
    }
}
