/**
 * 移动端 Header 美化和修复
 * 优化顶部导航栏样式
 */

/* ========== Header 基础优化 ========== */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0.75rem 0;
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
}

/* ========== Logo 优化 ========== */
.header .logo,
.header .custom-logo-link {
    display: flex;
    align-items: center;
    z-index: 10;
}

.header .logo img {
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

/* ========== 移动端菜单按钮优化 ========== */
.mobile-menu-button {
    display: none;
    position: relative;
    width: 30px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
    background: transparent;
    border: none;
    padding: 0;
}

.mobile-menu-button span {
    position: absolute;
    left: 0;
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-button span:nth-child(1) {
    top: 0;
}

.mobile-menu-button span:nth-child(2) {
    top: 10px;
}

.mobile-menu-button span:nth-child(3) {
    top: 20px;
}

/* 菜单打开时的动画 */
.mobile-menu-button.active span:nth-child(1) {
    top: 10px;
    transform: rotate(45deg);
}

.mobile-menu-button.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-button.active span:nth-child(3) {
    top: 10px;
    transform: rotate(-45deg);
}

/* ========== 桌面端导航 ========== */
.main-nav {
    display: flex;
    align-items: center;
}

.main-nav__list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
    align-items: center;
}

.main-nav__list li {
    margin: 0;
}

.main-nav__list a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: block;
}

.main-nav__list a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* ========== 移动端响应式 ========== */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem 0;
    }
    
    .header .container {
        padding: 0 1rem;
    }
    
    .header .logo img {
        height: 35px;
        max-width: 100px;
    }
    
    /* 显示移动端菜单按钮 */
    .mobile-menu-button {
        display: block !important;
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    /* 隐藏桌面端导航 */
    .main-nav {
        display: none !important;
    }
    
    /* Header 容器调整 */
    .header__container {
        padding-right: 40px;
    }
}

@media (max-width: 480px) {
    .header .logo img {
        height: 30px;
        max-width: 90px;
    }
    
    .mobile-menu-button {
        width: 26px;
        height: 20px;
    }
    
    .mobile-menu-button span {
        height: 2px;
    }
    
    .mobile-menu-button span:nth-child(2) {
        top: 9px;
    }
    
    .mobile-menu-button span:nth-child(3) {
        top: 18px;
    }
}

/* ========== 确保元素可见性 ========== */
.header,
.header__container,
.logo,
.mobile-menu-button {
    visibility: visible !important;
    opacity: 1 !important;
}

/* ========== 修复可能的冲突 ========== */
.header * {
    box-sizing: border-box;
}

.header a {
    outline: none;
}

/* ========== 平滑滚动时的 Header ========== */
.header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* ========== 加载状态 ========== */
.header.loading {
    pointer-events: none;
    opacity: 0.7;
}
