/* ===== NAVIGATION STYLES - ALSense ===== */

/* Adaptive colors for navigation */
.custom-nav.dark-bg {
    --nav-link-color: rgba(255, 255, 255, 0.7);
    --nav-link-hover-color: rgba(255, 255, 255, 1);
    --nav-dropdown-color: rgba(255, 255, 255, 0.85);
    --nav-dropdown-hover-color: rgba(255, 255, 255, 1);
    --nav-dropdown-hover-bg: rgba(255, 255, 255, 0.12);
}

.custom-nav.light-bg {
    --nav-link-color: rgba(44, 62, 80, 0.8);
    --nav-link-hover-color: rgba(44, 62, 80, 1);
    --nav-dropdown-color: rgba(44, 62, 80, 0.9);
    --nav-dropdown-hover-color: rgba(44, 62, 80, 1);
    --nav-dropdown-hover-bg: rgba(44, 62, 80, 0.08);
}

.custom-nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    transition: all 0.4s ease;
}

.custom-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(25px);
    mask: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.8) 60%, rgba(0,0,0,0) 100%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.8) 60%, rgba(0,0,0,0) 100%);
    z-index: -1;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 40px;
    position: relative;
    z-index: 1;
    gap: 40px;
}

/* ===== NAVBAR LOGO ===== */
.nav-logo {
    position: absolute;
    left: 40px;
    z-index: 2;
}

.navbar-logo {
    height: 45px;
    width: auto;
    transition: all 0.3s ease;
    opacity: 0.7; /* Misma transparencia que los nav-links por defecto */
}

.navbar-logo:hover {
    transform: scale(1.05);
    opacity: 1; /* Opacidad completa al hacer hover */
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 50px;
    justify-content: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--nav-link-color, rgba(255, 255, 255, 0.7));
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 12px 20px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-link:hover {
    color: var(--nav-link-hover-color, rgba(255, 255, 255, 1));
}

/* ===== DROPDOWN STYLES ===== */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(25px);
    border-radius: 15px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.nav-item:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.nav-dropdown a {
    display: block;
    color: var(--nav-dropdown-color, rgba(255, 255, 255, 0.85));
    text-decoration: none;
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 400;
    transition: all 0.3s ease;
    border-radius: 10px;
    margin: 3px 6px;
    opacity: 0;
    transform: translateX(-10px);
}

/* Animación staggered para los elementos del dropdown */
.nav-item:hover .nav-dropdown a {
    opacity: 1;
    transform: translateX(0);
}

.nav-dropdown a:nth-child(1) { transition-delay: 0.1s; }
.nav-dropdown a:nth-child(2) { transition-delay: 0.15s; }
.nav-dropdown a:nth-child(3) { transition-delay: 0.2s; }
.nav-dropdown a:nth-child(4) { transition-delay: 0.25s; }
.nav-dropdown a:nth-child(5) { transition-delay: 0.3s; }

.nav-dropdown a:hover {
    color: var(--nav-dropdown-hover-color, rgba(255, 255, 255, 1));
    background: var(--nav-dropdown-hover-bg, rgba(255, 255, 255, 0.12));
    transform: translateX(5px) scale(1.02);
}

.dropdown-arrow {
    font-size: 0.5rem;
    transition: transform 0.3s ease;
}

.nav-item:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    position: relative;
    border-radius: 6px;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.nav-toggle:active,
.nav-toggle:focus {
    background: none !important;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.nav-toggle:hover .hamburger-line {
    background-color: rgba(255, 255, 255, 1); /* Opacidad completa al hacer hover */
}

.hamburger-line {
    position: absolute;
    width: 28px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.7); /* Misma transparencia que los nav-links */
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-line:nth-child(1) {
    top: 14px;
}

.hamburger-line:nth-child(2) {
    top: 21px;
}

.hamburger-line:nth-child(3) {
    top: 28px;
}

/* Animación cuando está activo (X) */
.nav-toggle.active .hamburger-line:nth-child(1) {
    top: 21px;
    transform: translateX(-50%) rotate(45deg);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
    top: 21px;
    transform: translateX(-50%) rotate(-45deg);
}

/* ===== MOBILE NAVIGATION (incluye horizontal) ===== */
@media (max-width: 1024px), (max-height: 600px) {
    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px); /* Para móviles modernos */
        background: rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(40px);
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 60px;
        gap: 40px;
        transition: left 0.3s ease, opacity 0.3s ease;
        z-index: 9999;
        overflow-x: hidden;
        opacity: 0;
    }
    
    .nav-menu.active {
        left: 0;
        opacity: 1;
    }
    
    .nav-toggle {
        display: flex !important;
        position: absolute;
        right: 20px;
        top: 5px;
        z-index: 10000;
        padding: 8px;
    }
    
    .nav-container {
        padding: 0 15px;
        justify-content: center;
        position: relative;
    }
    
    /* Mobile dropdown adjustments */
    .nav-dropdown {
        position: static;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        background: rgba(255, 255, 255, 0.08);
        margin-top: 10px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
        max-height: 0;
        overflow: hidden;
    }
    
    .nav-item:hover .nav-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        max-height: 300px;
    }
    
    /* Mobile nav links styling */
    .nav-link {
        justify-content: center;
        text-align: center;
        width: 100%;
        padding: 15px 20px;
        font-size: 1.2rem;
    }
    
    /* Reset staggered animations for mobile */
    .nav-dropdown a {
        opacity: 1;
        transform: translateX(0);
        transition-delay: 0s;
        text-align: left;
        justify-content: flex-start;
    }
    
    .dropdown-arrow {
        display: none;
    }
    
    /* Mobile logo adjustments */
    .nav-logo {
        top: 5px;
        left: 20px;
    }
    
    .navbar-logo {
        height: 40px;
    }
}

/* ===== CAMBIO DE COLOR HAMBURGUESA SEGÚN FONDO ===== */
.custom-nav.light-bg .hamburger-line {
    background-color: rgba(44, 62, 80, 0.8); /* Misma transparencia que nav-links en fondo claro */
}

.custom-nav.light-bg .nav-toggle:hover .hamburger-line {
    background-color: rgba(44, 62, 80, 1); /* Opacidad completa al hacer hover en fondo claro */
}

/* Logo transparency and color adjustments for light background */
.custom-nav.light-bg .navbar-logo {
    opacity: 0.8; /* Misma transparencia que nav-links en fondo claro */
    filter: brightness(0) saturate(100%) invert(15%) sepia(10%) saturate(1822%) hue-rotate(183deg) brightness(93%) contrast(90%);
    /* Este filtro convierte el logo a un color similar al de los textos en fondo claro (rgba(44, 62, 80)) */
}

.custom-nav.light-bg .navbar-logo:hover {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(15%) sepia(10%) saturate(1822%) hue-rotate(183deg) brightness(80%) contrast(95%);
    /* Versión ligeramente más oscura para el hover */
}