/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700;800&family=Poppins:wght@300;400;500;600;700&display=swap');

/* Base header styles */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

/* Logo bar - full width black */
.nia-logo-bar {
    width: 100%;
    height: 60px;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nia-logo-bar svg {
    width: 249px;
    height: 32px;
}

.nia-logo-link {
    display: block;
    text-decoration: none;
}

/* Nav bar - full width white */
.nia-nav-bar {
    width: 100%;
    height: 55px;
    background: #ffffff;
    position: relative;
}

.nia-nav-bar::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 100vw;
    height: 1px;
    background: var(--listing-stroke, #E3E4E5);
    transform: translateX(-50%);
}

/* Inner container 1280px centered */
.nia-nav-inner {
    width: 1280px;
    max-width: 100%;
    margin: 0 auto;
    height: 55px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 40px 8px;
}

/* Navigation tabs */
.nia-navigation {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 40px;
    height: 26px;
}

.nia-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 26px;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.nia-tab-text {
    height: 18px;
    font-family: 'Pretendard', 'Noto Sans VI', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 130%;
    color: #000000;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.nia-tab:hover .nia-tab-text {
    color: var(--primary-color, #00AF73);
}

.nia-tab-indicator {
    height: 2px;
    width: 100%;
    background: #00AF73;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nia-tab:hover .nia-tab-indicator {
    opacity: 1;
}

.nia-tab.active .nia-tab-text {
    font-weight: 700;
    color: var(--primary-color, #00AF73);
}

.nia-tab.active .nia-tab-indicator {
    opacity: 0;
}

.nia-tab.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -13px;
    height: 2px;
    background: var(--primary-color, #00AF73);
}

/* Language selector dropdown */
.nia-lang-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    height: 20px;
}

.nia-lang-current {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.nia-flag {
    width: 21px;
    height: 15px;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nia-flag img,
.nia-flag svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nia-flag-vi {
    background: #DA251D;
}

.nia-flag-en {
    background: #012169;
}

.nia-lang-code {
    font-family: 'Pretendard', 'Noto Sans VI', sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 130%;
    color: #000000;
    transition: color 0.3s ease;
}

.nia-lang-dropdown-item:hover .nia-lang-code:not(.active) {
    color: var(--primary-color, #00AF73);
}

.nia-arrow-down {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nia-lang-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 8px 0;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.nia-lang-dropdown:hover .nia-lang-dropdown-menu,
.nia-lang-dropdown.open .nia-lang-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nia-lang-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    text-decoration: none;
    color: #000000;
    font-family: 'Pretendard', 'Noto Sans VI', sans-serif;
    font-size: 13px;
    transition: background 0.2s ease;
}

.nia-lang-dropdown-item:hover {
    background: #f5f5f5;
}

.nia-lang-dropdown-item.active {
    font-weight: 700;
    color: var(--primary-color, #00AF73);
}

.nia-lang-code.active {
    font-weight: 700;
    color: var(--primary-color, #00AF73);
}

.nia-lang-dropdown-item .nia-lang-code {
    margin-top: 2px;
}

/* Mobile Menu Toggle */
.nia-header-menu-mobile {
    display: flex;
    align-items: center;
    gap: 30px;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 2px;
    background-color: #0F0F0F;
    transition: all 0.3s ease;
    border-radius: 1.5px;
}

/* Hide mobile menu toggle on larger screens */
@media (min-width: 1200px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    .nia-header-menu-mobile {
        display: none !important;
    }
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Mobile Menu Overlay - covers entire page */
.mobile-menu::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    opacity: 0;
    z-index: 9999;
}

.mobile-menu.active::before {
    opacity: 1;
}

.mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-container {
    position: fixed;
    top: 0;
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-width: 100%;
    background-color: #FFFFFF;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 16px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    pointer-events: auto;
}

.mobile-menu.active .mobile-menu-container {
    transform: translateX(0);
}

.mobile-menu-home {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 88px;
    padding: 0 0 0 20px;
    cursor: pointer;
    font-size: 19px;
    line-height: 1.5em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

/* Mobile menu close button */
.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close img {
    width: 24px;
    height: 24px;
}

.mobile-menu-section-icon {
    background-image: url('/wp-content/themes/rootslab/assets/images/arrow-menu-down.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 24px;
    height: 24px;
    margin-right: 20px;
}

.mobile-menu-close:hover {
    background-color: rgba(83, 185, 144, 0.1);
    opacity: 1;
    transform: scale(1.1);
}

.mobile-menu-section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.mobile-menu-section:last-child {
    border-bottom: none;
}

.mobile-menu-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
    padding: 10px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.mobile-menu-section-header:hover {
    background-color: rgba(83, 185, 144, 0.05);
}

.mobile-menu-section-link {
    color: inherit;
    text-decoration: none;
}

.mobile-menu-section:has(.active) .mobile-menu-section-header {
    background-color: var(--primary-color);
}

.mobile-menu-section:has(.active) .mobile-menu-section-header .mobile-menu-section-icon {
    background-image: url('/wp-content/themes/rootslab/assets/images/arrow-menu-up.png');
}

.mobile-menu-section:has(.active) .mobile-menu-section-title {
    color: #FFFFFF;
}

.mobile-menu-section-content.active > .mobile-menu-item {
    background-color: #F5F5F5;
    border-bottom: 1px solid #DEDFE0;
}

.mobile-menu-section-content.active > .mobile-menu-item:last-child {
    border-bottom: none;
}

.mobile-menu-section-title {
    line-height: 1.5em;
    letter-spacing: 0;
    font-weight: 700;
    font-size: 19px;
    color: #242424;
    padding-left: 20px;
}

.mobile-menu-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu-section-content.active {
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu-item {
    display: block;
    padding: 12px 0;
    padding-left: 20px;
    padding-right: 20px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5em;
    color: #454545;
    text-decoration: none;
    transition: all 0.3s ease;
    overflow-wrap: anywhere;
    word-break: normal;
}

.mobile-menu-item:hover {
    color: var(--primary-color);
    background-color: rgba(83, 185, 144, 0.05);
}

.mobile-menu-item.active {
    color: var(--primary-color);
    font-weight: 600;
    background-color: rgba(83, 185, 144, 0.1);
}

/* Responsive */
@media (max-width: 1200px) {
    .nia-navigation {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 1023px) {
    .nia-nav-inner {
        padding: 16px 30px 8px;
    }
}

@media (max-width: 767px) {
    .nia-logo-bar {
        height: 50px;
    }

    .nia-logo-bar svg {
        width: 120px;
        height: 16px;
    }

    .nia-nav-inner {
        padding: 12px 16px 8px;
    }

    .mobile-menu-container {
        width: min(300px, calc(100vw - 16px));
        padding-top: 12px;
    }

    .mobile-menu-home {
        height: 55px;
    }

    .mobile-menu-close {
        width: 20px;
        height: 20px;
    }

    .mobile-menu-close img {
        width: 20px;
        height: 20px;
    }

    .mobile-menu-section-title {
        padding-left: 20px;
        font-size: 19px;
    }
    
    .mobile-menu-item {
        padding-left: 20px;
        padding-right: 20px;
        font-size: 16px;
    }

    .mobile-menu-container {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
    height: 100vh;
}

html {
    scroll-behavior: smooth;
}

html.mobile-menu-active,
html.mobile-menu-active *,
body.mobile-menu-open,
body.mobile-menu-open *,
body.mobile-menu-open html,
body.mobile-menu-open html * {
    scroll-behavior: auto !important;
    transition: none !important;
}

.mobile-menu-active {
    scroll-behavior: auto !important;
}

.mobile-menu-active * {
    scroll-behavior: auto !important;
    transition: none !important;
}
