/* ========================================
   Navigation Styles - 优雅极简
   ======================================== */

/* 导航栏变量 */
.nav-main {
    --nav-bg-base: rgba(15, 15, 15, 0.85);
    --nav-bg-scrolled: rgba(15, 15, 15, 0.95);
    --nav-bg-mobile: rgba(15, 15, 15, 0.98);
}

/* 暗色主题导航栏 */
.theme-dark .nav-main {
    --nav-bg-base: rgba(15, 15, 15, 0.85);
    --nav-bg-scrolled: rgba(15, 15, 15, 0.95);
    --nav-bg-mobile: rgba(15, 15, 15, 0.98);
}

/* 亮色主题导航栏 */
.theme-light .nav-main {
    --nav-bg-base: rgba(232, 229, 222, 0.85);
    --nav-bg-scrolled: rgba(232, 229, 222, 0.95);
    --nav-bg-mobile: rgba(232, 229, 222, 0.98);
}

   .nav-main {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: var(--nav-bg-base);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-bottom: var(--border-thin);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    z-index: 1000;
    transition: background var(--transition-normal);
    box-sizing: border-box;
    overflow: visible;
}

.nav-main.scrolled {
    background: var(--nav-bg-scrolled);
}

/* ========================================
   语言切换按钮 - 简洁优雅设计
   ======================================== */

/* 桌面端控制按钮组 */
.nav-controls-desktop {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* 桌面端语言切换按钮 */
.lang-toggle-btn-desktop {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.lang-toggle-btn-desktop::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.15) 0%, transparent 70%);
    border-radius: var(--radius-sm);
    transition: transform var(--transition-fast);
    z-index: 0;
}

.lang-toggle-btn-desktop:hover {
    border-color: rgba(201, 169, 97, 0.4);
    color: var(--color-text-primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lang-toggle-btn-desktop:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

.lang-toggle-btn-desktop:active {
    transform: scale(0.98);
}

.lang-toggle-btn-desktop:focus {
    outline: none;
}

.lang-toggle-btn-desktop:focus-visible {
    box-shadow: 0 0 0 2px var(--color-accent-gold);
}

.lang-icon {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: transform var(--transition-fast);
    position: relative;
    z-index: 1;
}

.lang-toggle-btn-desktop:hover .lang-icon {
    transform: scale(1.1);
}

/* 亮色主题下的按钮样式 */
.theme-light .lang-toggle-btn-desktop {
    background: var(--color-bg-elevated);
    border-color: var(--color-line);
}

.theme-light .lang-toggle-btn-desktop:hover {
    border-color: rgba(166, 124, 61, 0.5);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

/* 移动端控制按钮组 - 语言和主题合并 */
.nav-controls-item {
    width: 100%;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--color-line);
    position: relative;
}

.nav-controls-mobile {
    display: flex;
    width: 100%;
    gap: 0;
    background: var(--color-bg-elevated);
}

.lang-toggle-mobile {
    flex: 1;
    display: flex;
    gap: 0;
    border-right: 1px solid var(--color-line);
}

.theme-toggle-mobile {
    flex: 1;
    display: flex;
    gap: 0;
}

.lang-btn-mobile,
.theme-btn-mobile {
    flex: 1;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-normal);
    padding: 0;
    position: relative;
    border-right: 1px solid var(--color-line);
}

.lang-btn-mobile {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.theme-btn-mobile {
    font-size: 1.25rem;
}

.lang-btn-mobile:last-child,
.theme-btn-mobile:last-child {
    border-right: none;
}

.lang-btn-mobile:hover,
.theme-btn-mobile:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
}

.lang-btn-mobile.active,
.theme-btn-mobile.active {
    color: var(--color-accent-gold);
    background: rgba(201, 169, 97, 0.08);
    position: relative;
}

.lang-btn-mobile span,
.theme-btn-mobile span {
    position: relative;
    z-index: 1;
    transition: transform var(--transition-fast);
}

.lang-btn-mobile:hover span,
.theme-btn-mobile:hover span {
    transform: scale(1.15);
}

.lang-btn-mobile.active span,
.theme-btn-mobile.active span {
    transform: scale(1.2);
}

/* 亮色主题下的移动端按钮 */
.theme-light .lang-btn-mobile.active,
.theme-light .theme-btn-mobile.active {
    background: rgba(166, 124, 61, 0.12);
}

.theme-light .lang-btn-mobile:hover,
.theme-light .theme-btn-mobile:hover {
    background: var(--color-bg-secondary);
}

/* 移动端隐藏桌面端按钮 */
@media (max-width: 768px) {
    .nav-controls-desktop {
        display: none;
    }
    
    .nav-controls-item {
        opacity: 0;
        transform: translateX(30px);
        transition: 
            opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-menu.active .nav-controls-item {
        opacity: 1;
        transform: translateX(0);
        transition-delay: 0s; /* 最先出现 */
    }
}

/* 桌面端隐藏移动端控制按钮组 */
@media (min-width: 769px) {
    .nav-controls-item {
        display: none;
    }
}

/* ========================================
   主题切换按钮 - 简洁优雅设计
   ======================================== */

/* 桌面端主题切换按钮 */
.theme-toggle-btn-desktop {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn-desktop::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.15) 0%, transparent 70%);
    border-radius: var(--radius-sm);
    transition: transform var(--transition-fast);
    z-index: 0;
}

.theme-toggle-btn-desktop:hover {
    border-color: rgba(201, 169, 97, 0.4);
    color: var(--color-text-primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn-desktop:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

.theme-toggle-btn-desktop:active {
    transform: scale(0.98);
}

.theme-toggle-btn-desktop:focus {
    outline: none;
}

.theme-toggle-btn-desktop:focus-visible {
    box-shadow: 0 0 0 2px var(--color-accent-gold);
}

.theme-icon {
    font-size: 1.125rem;
    transition: transform var(--transition-fast);
    position: relative;
    z-index: 1;
}

.theme-toggle-btn-desktop:hover .theme-icon {
    transform: rotate(15deg) scale(1.1);
}

/* 亮色主题下的按钮样式 */
.theme-light .theme-toggle-btn-desktop {
    background: var(--color-bg-elevated);
    border-color: var(--color-line);
}

.theme-light .theme-toggle-btn-desktop:hover {
    border-color: rgba(166, 124, 61, 0.5);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

/* 移动端隐藏桌面端按钮 */
@media (max-width: 768px) {
    .theme-toggle-btn-desktop {
        display: none;
    }
}

/* Logo - 衬线字体 */
.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1;
}

.logo-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: block;
    transition: opacity var(--transition-fast);
    object-fit: contain;
    vertical-align: middle;
    align-self: center;
}

.nav-logo:hover .logo-icon {
    opacity: 0.85;
}

.logo-text {
    font-family: var(--font-serif);
    color: var(--color-text-primary);
    font-weight: 400;
    letter-spacing: 0.2em;
    position: relative;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

.logo-text::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 30%;
    height: 1px;
    background: var(--color-accent-gold);
}

/* Menu */
.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin: 0;
    padding: 0;
}

.nav-link {
    position: relative;
    padding: var(--spacing-xs) 0;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color var(--transition-fast);
    font-family: var(--font-sans);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-accent-gold);
    transition: width var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-text-primary);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.active {
    color: var(--color-accent-gold);
}

.nav-link.active::after {
    width: 100%;
}

.nav-icon {
    font-size: 1rem;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    color: var(--color-accent-gold);
}

.nav-label {
    display: inline-block;
}

/* Mobile Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: var(--spacing-xs);
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 1001;
    background: transparent;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 1.5px;
    background: var(--color-text-primary);
    transition: all var(--transition-normal);
    transform-origin: center;
    border-radius: var(--radius-none);
}

.nav-toggle:hover span {
    background: var(--color-accent-gold);
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.nav-toggle.active span {
    background: var(--color-accent-gold);
}

/* ========================================
   Responsive Navigation
   ======================================== */

/* 中等屏幕优化 (900px - 1200px) */
@media (max-width: 1200px) and (min-width: 769px) {
    .nav-main {
        padding: 0 var(--spacing-md);
    }

    .nav-menu {
        gap: var(--spacing-md);
    }

    .nav-link {
        font-size: 0.8rem;
        gap: 0.35rem;
    }

    .nav-icon {
        font-size: 0.9rem;
    }
}

/* 小屏幕优化 (769px - 900px) */
@media (max-width: 900px) and (min-width: 769px) {
    .nav-menu {
        gap: var(--spacing-sm);
    }

    .nav-link {
        font-size: 0.75rem;
        letter-spacing: 0.08em;
        gap: 0.3rem;
    }

    .nav-icon {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .nav-main {
        padding: 0 var(--spacing-md);
    }

    .nav-menu {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        width: 100%;
        height: calc(100vh - var(--nav-height));
        background: var(--nav-bg-mobile);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        gap: 0;
        padding: 0 0 var(--spacing-xl) 0;
        opacity: 0;
        visibility: hidden;
        transform: translateX(100%);
        transition: 
            transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: var(--border-thin);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 999;
    }

    .nav-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateX(30px);
        transition: 
            opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-menu.active li {
        opacity: 1;
        transform: translateX(0);
    }

    /* 菜单项依次出现动画 - 主题切换器最先出现 */
    .nav-menu.active li:nth-child(1) { transition-delay: 0.04s; } /* 主题切换器 */
    .nav-menu.active li:nth-child(2) { transition-delay: 0.08s; }
    .nav-menu.active li:nth-child(3) { transition-delay: 0.12s; }
    .nav-menu.active li:nth-child(4) { transition-delay: 0.16s; }
    .nav-menu.active li:nth-child(5) { transition-delay: 0.2s; }
    .nav-menu.active li:nth-child(6) { transition-delay: 0.24s; }
    .nav-menu.active li:nth-child(7) { transition-delay: 0.28s; }

    /* 菜单关闭时快速隐藏 */
    .nav-menu:not(.active) li {
        transition-delay: 0s;
    }

    .nav-link {
        font-size: 1.125rem;
        letter-spacing: 0.15em;
        padding: var(--spacing-md) var(--spacing-lg);
        width: 100%;
        justify-content: center;
        transition: all var(--transition-normal);
    }

    .nav-link:hover {
        background: rgba(201, 169, 97, 0.05);
        transform: translateX(-4px);
    }

    .nav-icon {
        font-size: 1.25rem;
    }

    .nav-toggle {
        display: flex;
    }

    .logo-text::after {
        display: none;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
    }

    /* 防止菜单打开时背景滚动 */
    body.menu-open {
        overflow: hidden;
    }
}
