/* ==========================================================
   NeuralEdge Header — Pure CSS (no framework)
   Enqueue in functions.php:
   wp_enqueue_style('ne-header', get_template_directory_uri() . '/css/ne-header.css');
   ========================================================== */

/* ---------- CSS Variables ---------- */
:root {
    --ne-white:        #ffffff;
    --ne-gray-50:      #f9fafb;
    --ne-gray-100:     #f3f4f6;
    --ne-gray-600:     #4b5563;
    --ne-gray-700:     #374151;
    --ne-gray-900:     #111827;
    --ne-blue-600:     #2563eb;
    --ne-purple-600:   #9333ea;

    --ne-header-height: 68px;
    --ne-max-width:     1440px;
    --ne-px:            64px;   /* px-16 = 4rem = 64px */
    --ne-transition:    0.2s ease;
    --ne-radius:        8px;

    /* gradient shorthand */
    --ne-gradient: linear-gradient(to right, var(--ne-blue-600), var(--ne-purple-600));
}

/* ---------- Base Reset for header scope ---------- */
.ne-header *,
.ne-header *::before,
.ne-header *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* =====================================================
   HEADER — sticky + glassmorphism
   ===================================================== */
.ne-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: rgba(255, 255, 255, 0.80);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--ne-gray-100);
    /* smooth shadow on scroll (JS adds .ne-header--scrolled) */
    transition: box-shadow var(--ne-transition);
}

.ne-header--scrolled {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

/* ---------- Inner wrapper ---------- */
.ne-header__inner {
    max-width: var(--ne-max-width);
    margin: 0 auto;
    padding: 0 var(--ne-px);
    height: var(--ne-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* =====================================================
   LOGO
   ===================================================== */
.ne-header__logo {
    flex-shrink: 0;
}

/* WP custom logo img */
.ne-header__logo .custom-logo {
    height: 36px;
    width: auto;
    display: block;
}

/* Text logo fallback */
.ne-logo-text {
    font-size: 1.5rem;        /* text-2xl */
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--ne-gray-900);
    text-decoration: none;
    line-height: 1;
}

.ne-logo-gradient {
    background: var(--ne-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* =====================================================
   DESKTOP NAVIGATION
   ===================================================== */
.ne-header__nav {
    display: flex;
    align-items: center;
    gap: 32px;         /* gap-8 = 2rem = 32px */
}

.ne-header__nav a {
    font-size: 0.875rem;   /* text-sm */
    color: var(--ne-gray-600);
    text-decoration: none;
    transition: color var(--ne-transition);
    white-space: nowrap;
}

.ne-header__nav a:hover,
.ne-header__nav a:focus-visible {
    color: var(--ne-gray-900);
    outline: none;
}

/* active state (add class "ne-active" via JS or WP menu walker) */
.ne-header__nav a.ne-active {
    color: var(--ne-gray-900);
    font-weight: 500;
}

/* =====================================================
   RIGHT ACTIONS
   ===================================================== */
.ne-header__actions {
    display: flex;
    align-items: center;
    gap: 24px;     /* gap-6 = 1.5rem = 24px */
    flex-shrink: 0;
}

/* ---------- Language Switcher — Custom Dropdown ---------- */
.ne-lang-switcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    background: var(--ne-gray-50);
    border: 1px solid var(--ne-gray-100);
    border-radius: var(--ne-radius);
    color: var(--ne-gray-700);
    cursor: pointer;
    user-select: none;
    transition: background var(--ne-transition), border-color var(--ne-transition);
}

.ne-lang-switcher:hover {
    background: var(--ne-gray-100);
    border-color: #d1d5db;
}

/* Globe icon */
.ne-lang-globe {
    font-size: 0.85rem;
    color: #6b7280;
    flex-shrink: 0;
}

/* Selected text label */
.ne-lang-selected {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ne-gray-700);
    line-height: 1;
    min-width: 20px;
}

/* Chevron arrow */
.ne-lang-arrow {
    font-size: 0.65rem;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    margin-left: 2px;
}

/* Rotate arrow when open */
.ne-lang-switcher.is-open .ne-lang-arrow {
    transform: rotate(180deg);
}

/* Dropdown list */
.ne-lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 120px;
    background: var(--ne-white);
    border: 1px solid var(--ne-gray-100);
    border-radius: var(--ne-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
    list-style: none;
    padding: 4px;
    z-index: 200;
    /* entrance animation */
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.ne-lang-switcher.is-open .ne-lang-dropdown {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Each option */
.ne-lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--ne-gray-700);
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--ne-transition), color var(--ne-transition);
}

.ne-lang-option:hover {
    background: var(--ne-gray-50);
    color: var(--ne-gray-900);
}

.ne-lang-option.is-active {
    color: var(--ne-blue-600);
    font-weight: 600;
    background: #eff6ff;
}

.ne-lang-flag {
    font-size: 1rem;
    line-height: 1;
}

/* ---------- CTA Button ---------- */
.ne-btn-cta {
    display: inline-block;
    padding: 10px 24px;
    background: var(--ne-gradient);
    color: var(--ne-white) !important;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--ne-radius);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.20);
    transition: box-shadow var(--ne-transition), transform var(--ne-transition);
    white-space: nowrap;
}

.ne-btn-cta:hover,
.ne-btn-cta:focus-visible {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.30);
    transform: translateY(-1px);
    outline: none;
}

.ne-btn-cta:active {
    transform: translateY(0);
}

/* =====================================================
   HAMBURGER BUTTON (hidden on desktop)
   ===================================================== */
.ne-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--ne-radius);
    transition: background var(--ne-transition);
    -webkit-tap-highlight-color: transparent;
}

.ne-hamburger:hover {
    background: var(--ne-gray-100);
}

.ne-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ne-gray-900);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
    transform-origin: center;
}

/* Hamburger → X animation */
.ne-hamburger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.ne-hamburger.is-active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.ne-hamburger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =====================================================
   MOBILE MENU (drawer from top)
   ===================================================== */
.ne-mobile-menu {
    display: none;            /* shown via JS below breakpoint */
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease, padding 0.35s ease;
    background: var(--ne-white);
    border-top: 1px solid var(--ne-gray-100);
}

.ne-mobile-menu.is-open {
    max-height: 480px;
    padding-bottom: 16px;
}

.ne-mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 24px 0;
    gap: 4px;
}

.ne-mobile-nav a {
    display: block;
    font-size: 1rem;
    color: var(--ne-gray-700);
    text-decoration: none;
    padding: 12px 0;
    border-bottom: 1px solid var(--ne-gray-100);
    transition: color var(--ne-transition);
}

.ne-mobile-nav a:last-of-type {
    border-bottom: none;
}

.ne-mobile-nav a:hover {
    color: var(--ne-gray-900);
}

.ne-btn-cta--mobile {
    display: block;
    margin-top: 16px;
    text-align: center;
    width: 100%;
}

/* =====================================================
   OVERLAY (behind mobile menu)
   ===================================================== */
.ne-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.30);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ne-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* =====================================================
   RESPONSIVE BREAKPOINTS
   ===================================================== */

/* Tablet: 1024px */
@media (max-width: 1024px) {
    :root {
        --ne-px: 32px;
    }
    .ne-header__nav {
        gap: 20px;
    }
}

/* Mobile: 768px — switch to hamburger */
@media (max-width: 768px) {
    :root {
        --ne-px: 20px;
        --ne-header-height: 60px;
    }

    /* Hide desktop nav + lang switcher */
    .ne-header__nav,

    .ne-btn-cta:not(.ne-btn-cta--mobile) {
        display: none;
    }

    /* Show hamburger */
    .ne-hamburger {
        display: flex;
    }

    /* Show mobile menu container */
    .ne-mobile-menu {
        display: block;
    }
}

/* ==========================================================
   STICKY HEADER — Xuất hiện khi scroll 150px
   ========================================================== */

/* Ban đầu: không sticky, nằm bình thường trong flow */
.ne-header {
    position: relative;
    top: auto;
}

/* Khi JS thêm .ne-header--sticky: chuyển fixed + chạy keyframe */
.ne-header--sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    animation: ne-slide-down 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes ne-slide-down {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}