nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    transition: background 0.3s ease, border-bottom 0.3s ease, box-shadow 0.3s ease; /* Chỉ transition hiệu ứng, KHÔNG transition padding/height */
    backdrop-filter: blur(10px);
    background: transparent;
}

nav.scrolled {
    background: var(--bg-card);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.container-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
}

.logo span {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary-color);
}

.nav-extra {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-main);
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
}

.theme-toggle:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.theme-toggle .fa-sun { display: none; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }
[data-theme="light"] .theme-toggle .fa-sun { display: block; }

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.nav-close {
    display: none;
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        height: 100dvh;
        width: 260px; /* Thân menu nhỏ hơn */
        background: var(--bg-card);
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 5rem 2rem;
        gap: 1.5rem;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .nav-links.active { right: 0; }
    
    .menu-toggle { display: block; }

    .nav-close {
        display: block;
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        font-size: 1.8rem;
        cursor: pointer;
        color: var(--text-main);
    }

    .nav-links a {
        font-size: 1.1rem;
        width: 100%;
        padding: 0.5rem 0;
    }
}
