/* =============================================
   LAYOUT: NAVBAR
   ============================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar.glass {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar .container {
    max-width: 1390px;
    margin: 0 auto;
    padding: 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-family: var(--font-code);
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 2rem;
}

.code-symbol {
    color: var(--accent-primary);
}

.logo .highlight {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    /* CLS Fix: Reserve space to prevent layout shifts */
    min-height: 44px;
    contain: layout style;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.95rem;
    white-space: nowrap;
    /* CLS Fix: Prevent text reflow when fonts load */
    min-height: 1.5em;
    display: inline-flex;
    align-items: center;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
}

.nav-links .active {
    color: #fff;
    position: relative;
}

.nav-links .active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 0.5rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 2px;
    background-color: #fff;
    margin: 6px 0;
    transition: all 0.3s ease;
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-dark);
        flex-direction: column;
        align-items: flex-start;
        padding: 2rem;
        gap: 1.5rem;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        /* CLS Fix: Contain layout to prevent shifts from affecting visible content */
        contain: layout style;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-links a {
        font-size: 1.1rem;
        white-space: normal;
    }

    .nav-buttons {
        flex-direction: column;
        width: 100%;
        margin-left: 0;
        margin-top: 1rem;
    }

    .nav-buttons .btn-primary-neon,
    .nav-buttons .btn-secondary-glass {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Navigation Dropdowns Fix */
.nav-item-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0 5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.dropdown-trigger:hover,
.nav-item-dropdown:hover .dropdown-trigger {
    color: #fff;
}

.dropdown-trigger svg {
    margin-top: 1px;
    transition: transform 0.3s ease;
}

.nav-item-dropdown:hover .dropdown-trigger svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px;
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 40px -4px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    margin-top: 10px;
}

/* Invisible bridge */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.nav-item-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu li {
    display: block;
    width: 100%;
    margin: 0;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: #94a3b8;
    font-size: 0.9rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.2s;
    text-decoration: none;
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.dropdown-menu a svg {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.dropdown-menu a:hover svg,
.dropdown-menu a.active svg {
    opacity: 1;
    color: var(--primary-color);
}

.dropdown-header {
    padding: 12px 14px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 700;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 6px 0;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .nav-item-dropdown {
        flex-direction: column;
        height: auto;
        align-items: stretch;
        width: 100%;
    }

    .dropdown-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 1.2rem 2rem;
        color: #f8fafc;
        /* Brighter white to match Inicio */
        font-size: 1rem;
        font-weight: 500;
        cursor: pointer;
        gap: 1rem;
    }

    /* Text inside dropdown trigger */
    .dropdown-trigger>a,
    .dropdown-trigger>span {
        color: inherit;
        padding: 0 !important;
        margin: 0 !important;
        flex: 1;
        font-size: inherit;
        font-weight: inherit;
        display: block;
    }

    /* Text without link wrapper */
    .dropdown-trigger {
        font-size: 1rem;
    }

    .dropdown-trigger a::before,
    .dropdown-trigger a::after {
        display: none !important;
    }

    .dropdown-trigger:hover {
        background: rgba(0, 210, 255, 0.05);
        color: var(--accent-primary);
    }

    /* Arrow icon styling - ALWAYS VISIBLE */
    .dropdown-trigger svg {
        flex-shrink: 0;
        width: 18px !important;
        height: 18px !important;
        min-width: 18px;
        color: var(--accent-primary) !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        transition: transform 0.3s ease;
    }

    .nav-item-dropdown.active .dropdown-trigger svg {
        transform: rotate(180deg);
    }

    .dropdown-menu {
        position: static !important;
        transform: none !important;
        background: rgba(0, 0, 0, 0.2) !important;
        /* Slightly darker than menu bg */
        border: none !important;
        width: 100% !important;
        margin: 0 !important;
        box-shadow: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: none;
        padding: 0 !important;
        border-radius: 0 !important;
        inset: auto !important;
        /* Reset any top/left/right/bottom */
    }

    .dropdown-menu li {
        border-bottom: none !important;
        margin: 0 !important;
        width: 100% !important;
    }

    /* Submenu links styling */
    .dropdown-menu a {
        padding: 0.8rem 1rem 0.8rem 3rem !important;
        /* Less horizontal padding, keep indent */
        color: #94a3b8 !important;
        font-size: 0.9rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        background: transparent !important;
        border-radius: 0 !important;
    }

    .dropdown-menu a:hover,
    .dropdown-menu a.active {
        background: rgba(255, 255, 255, 0.03) !important;
        color: #f8fafc !important;
        padding-left: 3rem !important;
        /* Keep same indent on hover */
    }

    /* Ensure Icon spacing */
    .dropdown-menu a svg {
        margin-right: 10px !important;
        flex-shrink: 0 !important;
    }

    .nav-item-dropdown.active .dropdown-menu {
        display: block;
    }

    .dropdown-menu::before {
        display: none;
    }
}