/* 通用导航栏样式 - 支持主题切换 */

.nav-header {
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    height: 80px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    padding: 0 80px;
}

.nav-header-container{
    display: flex;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
}

/* Logo 区域 */
.nav-logo {
    display: flex;
    height: 100%;
    align-items: center;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-secondary-inverse);
    min-width: 0;
}

.nav-logo-icon {
    height: 44px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo-icon img {
    display: block;
    max-width: none;
    width: auto;
    height: 100%;
    object-fit: contain;
}

.nav-logo-text {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-logo-title {
    color: var(--text-secondary-inverse);
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.nav-logo-wl {
    height: 30px;
    width: 54px;
}

.nav-logo-goods {
    height: 30px;
    width: 90px;
}

/* 搜索区域 */
.nav-search-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.nav-searchbox {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    height: 44px;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    border-radius: 81px;
    /* width: 526.5px; */
    width: 100%;
}

.nav-searchbox-content {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.nav-searchbox-camera {
    width: 16px;
    height: 16px;
}

.nav-searchbox-camera svg {
    display: block;
    width: 100%;
    height: 100%;
}

.nav-searchbox-divider {
    background-color: var(--text-tertiary);
    height: 13px;
    width: 1px;
}

.nav-searchbox-input {
    color: var(--text-primary);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    text-transform: capitalize;
    border: none;
    background: none;
    flex: 1;
    min-width: 0;
    outline: none;
}

.nav-searchbox-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 8px;
    border-radius: 10px;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-searchbox-button:hover {
    background-color: var(--bg-hover);
}

.nav-searchbox-icon {
    width: 20px;
    height: 20px;
}

/* 功能区 */
.nav-actions-wrapper {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 1px;
    /* min-width: 1px; */
}

.nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--text-secondary-inverse);
    cursor: pointer;
}

.nav-mobile-toggle:hover {
    background-color: var(--bg-hover);
}

.nav-mobile-toggle-bar {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background-color: currentColor;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-header.mobile-menu-open .nav-mobile-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-header.mobile-menu-open .nav-mobile-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-header.mobile-menu-open .nav-mobile-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* 语言切换 */
.nav-language {
    display: flex;
    gap: 4px;
    height: 100%;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary-inverse);
    position: relative;
}

.nav-language:hover {
    background-color: var(--bg-hover);
}

.nav-language-icon,
.nav-language-arrow {
    width: 20px;
    height: 20px;
}

.nav-language-text {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
    text-transform: capitalize;
}

/* 货币切换 */
.nav-currency {
    display: flex;
    gap: 4px;
    height: 100%;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary-inverse);
    position: relative;
}

.nav-currency:hover {
    background-color: var(--bg-hover);
}

.nav-currency-icon,
.nav-currency-arrow {
    width: 20px;
    height: 20px;
}

.nav-currency-text {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
    text-transform: uppercase;
}

/* 语言和货币下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    padding: 8px;
    display: none;
    z-index: 1000;
    animation: dropdownFadeIn 0.2s ease;
}

[data-theme="dark"] .dropdown-menu {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dropdown-menu.show {
    display: block;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--bg-hover);
}

.dropdown-item.active {
    /* background-color: var(--primary-green-light); */
    color: var(--primary-green);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(33, 189, 98, 0.1);
}

.dropdown-item-check {
    width: 20px;
    height: 20px;
    color: var(--primary-green);
    display: none;
}

.dropdown-item.active .dropdown-item-check {
    display: block;
}

/* language-switcher.js 动态渲染的语言选项（使用 nav-dropdown__item 类名） */
.nav-dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.nav-dropdown__item:hover {
    background-color: var(--bg-hover);
}

.nav-dropdown__item--active {
    color: var(--primary-green);
}

[data-theme="dark"] .nav-dropdown__item:hover {
    background-color: rgba(33, 189, 98, 0.1);
}

.nav-dropdown__check {
    width: 16px;
    height: 16px;
    color: var(--primary-green);
    display: none;
}

.nav-dropdown__item--active .nav-dropdown__check {
    display: block;
}

/* 按钮样式 */
.nav-action-btn {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary-inverse);
}

.nav-action-btn:hover {
    background-color: var(--bg-hover);
}

.nav-action-btn-icon {
    width: 20px;
    height: 20px;
}

.nav-action-btn-text {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 20px;
    text-transform: capitalize;
}

/* 注册登录组 */
.nav-auth-group {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-btn-register {
    background-color: var(--primary-green);
    color: white;
    height: 100%;
    padding: 12px 12px;
    border-radius: 50px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.nav-btn-register:hover {
    background-color: var(--primary-green-hover);
}

.nav-btn-login {
    height: 100%;
    padding: 0 12px;
    border-radius: 50px;
    color: var(--primary-green);
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
    text-transform: capitalize;
    background: none;
    border: none;
    cursor: pointer;
    position: relative; /* 为 tooltip 提供定位参考 */
}

.nav-btn-login:hover {
    background-color: var(--bg-hover);
}

/* 用户名提示框 */
.user-name-tooltip {
    visibility: hidden;
    position: absolute;
    top: 100%; /* 按钮底部 */
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px; /* 与按钮的间距 */
    background-color: rgba(33, 36, 44, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-name-tooltip::before {
    content: '';
    position: absolute;
    top: -6px; /* 小三角在 tooltip 顶部 */
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(33, 36, 44, 0.95); /* 指向上方 */
}

#header-user-btn:hover .user-name-tooltip {
    visibility: visible;
    opacity: 1;
}

/* 主题切换按钮 */
.nav-profile {
    border-left: 1px solid var(--border-color);
    display: flex;
    height: 28px;
    align-items: center;
    justify-content: center;
    width: 44px;
    background: none;
    border-top: none;
    border-right: none;
    border-bottom: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.nav-profile-icon {
    width: 20px;
    height: 20px;
    overflow: hidden;
    position: relative;
    color: var(--text-secondary-inverse);
}

.nav-profile-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s, transform 0.3s;
}

/* 主题图标基础样式 */
.theme-icon {
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

/* 默认状态（亮色模式）：显示太阳，隐藏月亮 */
.theme-icon-light {
    display: block;
}

.theme-icon-dark {
    display: none;
}

/* 暗色模式：隐藏太阳，显示月亮 */
[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: block;
}

/* 悬停动画效果 */
#themeToggle:hover .theme-icon-light {
    transform: rotate(180deg) scale(1.1);
}
#themeToggle:hover .theme-icon-dark {
    transform: scale(1.1);
}

/* 主题图标切换效果 */
[data-theme="dark"] .theme-icon-light {
    display: none !important;
}

[data-theme="dark"] .theme-icon-dark {
    display: block !important;
}

:root:not([data-theme]) .theme-icon-light,
[data-theme="light"] .theme-icon-light {
    display: block;
}

:root:not([data-theme]) .theme-icon-dark,
[data-theme="light"] .theme-icon-dark {
    display: none;
}

@media (max-width: 1024px) {
    .nav-header {
        padding: 0 24px;
        gap: 12px;
    }

    .nav-language-text,
    .nav-action-btn-text {
        display: none;
    }
}

@media (max-width: 768px) {
    .nav-header {
        padding: 0 16px;
    }

    .nav-header {
        overflow: visible;
    }

    .nav-searchbox {
        width: 100%;
        max-width: 300px;
    }

    .nav-logo-text {
        display: none;
    }

    .nav-auth-group {
        display: none;
    }

    .nav-header-container{
        justify-content: space-between;
        position: relative;
    }

    .nav-actions-wrapper {
        position: relative;
        flex-shrink: 0;
    }

    .nav-mobile-toggle {
        display: inline-flex;
    }

    .nav-actions {
        position: absolute;
        top: calc(100% + 12px);
        right: 0;
        width: min(320px, calc(100vw - 32px));
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 0;
        background-color: var(--bg-dark);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transform: translateY(-12px);
        pointer-events: none;
        transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease, padding 0.25s ease;
        z-index: 20;
    }

    .nav-header.mobile-menu-open .nav-actions {
        padding: 12px;
        opacity: 1;
        max-height: 80vh;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-language,
    .nav-currency,
    .nav-action-btn,
    .nav-btn-login,
    .nav-btn-register {
        width: 100%;
        min-height: 48px;
        justify-content: flex-start;
    }

    .nav-language,
    .nav-currency,
    .nav-action-btn {
        padding: 12px 14px;
        border-radius: 12px;
    }

    .nav-language,
    .nav-currency {
        height: auto;
        flex-wrap: wrap;
    }

    .nav-language-text,
    .nav-action-btn-text {
        display: block;
    }

    .nav-language-arrow,
    .nav-currency-arrow {
        margin-left: auto;
    }

    .nav-auth-group {
        display: flex;
        height: auto;
        gap: 8px;
        width: 100%;
    }

    .nav-btn-login,
    .nav-btn-register {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-btn-register {
        justify-content: center;
    }

    .nav-profile {
        border-left: none;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        justify-content: center;
    }

    .nav-profile-icon {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        min-width: 0;
        margin-top: 8px;
        box-shadow: none;
        max-height: 200px;
        overflow-y: auto;
    }
}

@media (max-width: 576px) {
    .nav-search-wrapper {
        display: none;
    }
}

@media (max-width: 480px) {
}