/*!
 * Enhanced Sticky Menu
 * Menu cố định với hiệu ứng chạy theo nội dung
 */

/* Enhanced Fixed Header */
.header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    z-index: 1000 !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.3) !important;
    transform: translateY(0);
}

/* Header khi scroll xuống */
.header.scrolled {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5) !important;
}

/* Header ẩn khi scroll xuống nhanh */
.header.hidden {
    transform: translateY(-100%);
}

/* Header hiện khi scroll lên */
.header.visible {
    transform: translateY(0);
}

/* Compact header khi scroll */
.header.compact {
    padding: 5px 0;
}

.header.compact .nav-container {
    height: 60px;
}

.header.compact .logo-main {
    font-size: 1.3rem;
}

.header.compact .logo-slogan {
    font-size: 0.65rem !important;
}

.header.compact .nav-menu a {
    padding: 6px 10px;
    font-size: 0.9rem;
}

.header.compact .lang-btn {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
}

/* Progress bar cho scroll */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
    z-index: 1001;
    transition: width 0.1s ease-out;
    opacity: 0;
}

.scroll-progress.visible {
    opacity: 1;
}

/* Body padding để tránh content bị che */
body {
    padding-top: 70px !important;
}

.header.compact ~ * {
    padding-top: 60px !important;
}

/* Active menu item highlight */
.nav-menu a.active {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb !important;
    border-radius: 6px;
}

/* Smooth scroll cho các anchor links */
html {
    scroll-behavior: smooth;
}

/* Section highlighting */
.section-highlight {
    position: relative;
}

.section-highlight::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #2563eb, #3b82f6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.section-highlight.active::before {
    opacity: 1;
}

/* Menu dropdown cho mobile */
@media (max-width: 768px) {
    body {
        padding-top: 60px !important;
    }
    
    .header.compact {
        padding: 3px 0;
    }
    
    .header.compact .nav-container {
        height: 50px;
    }
    
    .nav-menu {
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    }
    
    .nav-menu.active {
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Hiệu ứng hover cho menu items */
.nav-menu a {
    position: relative;
    overflow: hidden;
}

.nav-menu a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-menu a:hover::before,
.nav-menu a.active::before {
    width: 80%;
}

/* Language switcher enhancements */
.language-switcher {
    position: relative;
}

.lang-btn {
    position: relative;
    overflow: hidden;
}

.lang-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.lang-btn:hover::before {
    left: 100%;
}

/* Scroll to top button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}

.scroll-to-top.visible {
    transform: translateY(0);
    opacity: 1;
}

.scroll-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(37, 99, 235, 0.4);
}

.scroll-to-top:active {
    transform: translateY(-1px);
}

/* Loading animation cho menu */
.nav-loading {
    position: relative;
}

.nav-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa, #3b82f6, #2563eb);
    background-size: 200% 100%;
    animation: navLoading 2s linear infinite;
    opacity: 0;
}

.nav-loading.active::after {
    opacity: 1;
}

@keyframes navLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .header {
        background: rgba(255, 255, 255, 1) !important;
        border-bottom: 2px solid #000 !important;
    }
    
    .scroll-progress {
        background: #000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .header,
    .scroll-progress,
    .scroll-to-top,
    .nav-menu a::before,
    .lang-btn::before {
        transition: none !important;
        animation: none !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}