/**
 * Header Widget - Cyberpunk Style
 * 赛博朋克风格导航栏组件
 * 命名空间: .header-widget
 */

/* ==================== 基础容器 ==================== */
.header-widget {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.98) 0%, rgba(15, 15, 15, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(0, 255, 136, 0.05);
    transition: all 0.3s ease;
}

.header-widget:hover {
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(0, 255, 136, 0.1);
}

/* 全息背景网格 */
.header-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

/* 顶部霓虹光条 */
.header-widget::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary) 20%, 
        var(--primary-light) 50%, 
        var(--primary) 80%, 
        transparent 100%);
    opacity: 0.8;
    box-shadow: 0 0 10px var(--primary);
}

/* ==================== 容器布局 ==================== */
.header-widget-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

.header-widget-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    position: relative;
}

/* ==================== Logo区域 ==================== */
.header-widget-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
}

.header-widget-logo-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--bg-dark);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
}

/* 霓虹边框效果 */
.header-widget-logo-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light), var(--primary));
    z-index: -1;
    opacity: 0.8;
}

/* 光泽扫过动画 */
.header-widget-logo-icon::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: logoShine 3s linear infinite;
}

@keyframes logoShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.header-widget-logo:hover .header-widget-logo-icon {
    transform: scale(1.05);
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.7),
        0 0 60px rgba(0, 255, 136, 0.3),
        inset 0 0 15px rgba(255, 255, 255, 0.3);
}

.header-widget-logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 
        0 0 10px rgba(0, 255, 136, 0.5),
        0 0 20px rgba(0, 255, 136, 0.3);
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    position: relative;
}

/* 文字下划线霓虹效果 */
.header-widget-logo-text::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.header-widget-logo:hover .header-widget-logo-text {
    text-shadow: 
        0 0 15px rgba(0, 255, 136, 0.8),
        0 0 30px rgba(0, 255, 136, 0.5);
}

.header-widget-logo:hover .header-widget-logo-text::after {
    opacity: 1;
}

/* ==================== PC端导航菜单 ==================== */
.header-widget-nav {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 2rem);
    margin: 0 clamp(1rem, 3vw, 3rem);
    flex: 1;
    justify-content: center;
}

.header-widget-nav-link {
    position: relative;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-gray);
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-widget-nav-link:hover,
.header-widget-nav-link.active {
    color: var(--primary);
    background: rgba(0, 255, 136, 0.1);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* 霓虹下划线 */
.header-widget-nav-underline {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--primary-light), var(--primary), transparent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 1px;
    box-shadow: 0 0 8px var(--primary);
}

.header-widget-nav-link:hover .header-widget-nav-underline,
.header-widget-nav-link.active .header-widget-nav-underline {
    width: 80%;
}

/* ==================== PC端按钮组 ==================== */
.header-widget-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-widget-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* 主要按钮 - 霓虹绿 */
.header-widget-btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-dark);
    border: none;
    box-shadow: 
        0 4px 15px rgba(0, 255, 136, 0.4),
        0 0 20px rgba(0, 255, 136, 0.2);
}

.header-widget-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.header-widget-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 25px rgba(0, 255, 136, 0.6),
        0 0 30px rgba(0, 255, 136, 0.3);
}

.header-widget-btn-primary:hover::before {
    left: 100%;
}

/* 次要按钮 - 霓虹边框 */
.header-widget-btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: 
        inset 0 0 10px rgba(0, 255, 136, 0.1),
        0 0 10px rgba(0, 255, 136, 0.1);
    position: relative;
}

/* 霓虹边框发光效果 */
.header-widget-btn-outline::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light), var(--primary));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.header-widget-btn-outline:hover {
    background: rgba(0, 255, 136, 0.1);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 
        inset 0 0 20px rgba(0, 255, 136, 0.2),
        0 4px 20px rgba(0, 255, 136, 0.3),
        0 0 30px rgba(0, 255, 136, 0.2);
}

.header-widget-btn-outline:hover::before {
    opacity: 0.5;
}

/* ==================== 移动端菜单按钮 ==================== */
.header-widget-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 
        0 0 10px rgba(0, 255, 136, 0.2),
        inset 0 0 10px rgba(0, 255, 136, 0.05);
}

.header-widget-menu-toggle:hover {
    background: rgba(0, 255, 136, 0.2);
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.4),
        inset 0 0 15px rgba(0, 255, 136, 0.1);
}

.header-widget-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
    box-shadow: 0 0 5px var(--primary);
}

.header-widget-menu-toggle:hover span {
    box-shadow: 0 0 10px var(--primary);
}

/* 菜单按钮动画状态 */
.header-widget-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.header-widget-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

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

/* ==================== 移动端菜单面板 ==================== */
.header-widget-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: linear-gradient(180deg, rgba(15, 15, 15, 0.98) 0%, rgba(10, 10, 10, 0.99) 100%);
    backdrop-filter: blur(20px);
    border-left: 2px solid var(--primary);
    z-index: 1002;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 
        -10px 0 30px rgba(0, 0, 0, 0.5),
        -5px 0 20px rgba(0, 255, 136, 0.1);
}

.header-widget-mobile-menu.active {
    right: 0;
}

/* 移动端菜单头部 */
.header-widget-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.05), transparent);
}

.header-widget-mobile-menu-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header-widget-mobile-menu-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

.header-widget-mobile-menu-close:hover {
    background: rgba(0, 255, 136, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* 移动端导航链接 */
.header-widget-mobile-nav {
    flex: 1;
    padding: 1rem 0;
}

.header-widget-mobile-nav-link {
    display: block;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-widget-mobile-nav-link:hover,
.header-widget-mobile-nav-link.active {
    color: var(--primary);
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.1), transparent);
    border-left-color: var(--primary);
    padding-left: 1.75rem;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* 移动端按钮区域 */
.header-widget-mobile-buttons {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    background: linear-gradient(0deg, rgba(0, 255, 136, 0.05), transparent);
}

.header-widget-mobile-buttons .header-widget-btn {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
}

/* ==================== 遮罩层 ==================== */
.header-widget-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.header-widget-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==================== 响应式设计 ==================== */

/* 平板端 (768px - 1024px) */
@media (max-width: 1024px) {
    .header-widget-nav {
        gap: 0.5rem;
    }
    
    .header-widget-nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .header-widget-btn {
        padding: 0.5rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* 移动端 (< 768px) */
@media (max-width: 768px) {
    .header-widget-inner {
        height: 60px;
    }
    
    .header-widget-logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .header-widget-logo-text {
        font-size: 1.25rem;
    }
    
    .header-widget-nav,
    .header-widget-buttons {
        display: none;
    }
    
    .header-widget-menu-toggle {
        display: flex;
    }
}

/* 小屏移动端 (< 480px) */
@media (max-width: 480px) {
    .header-widget-container {
        padding: 0 0.75rem;
    }
    
    .header-widget-inner {
        height: 56px;
    }
    
    .header-widget-logo-text {
        font-size: 1.1rem;
    }
    
    .header-widget-mobile-menu {
        width: 90%;
    }
}

/* ==================== 动画关键帧 ==================== */
@keyframes headerGlow {
    0%, 100% {
        box-shadow: 
            0 4px 20px rgba(0, 0, 0, 0.5),
            0 0 30px rgba(0, 255, 136, 0.05);
    }
    50% {
        box-shadow: 
            0 4px 30px rgba(0, 0, 0, 0.6),
            0 0 50px rgba(0, 255, 136, 0.15);
    }
}

/* ==================== 滚动效果 ==================== */
.header-widget.scrolled {
    background: rgba(10, 10, 10, 0.98);
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(0, 255, 136, 0.08);
}

/* ==================== 触摸设备优化 ==================== */
@media (hover: none) and (pointer: coarse) {
    .header-widget-nav-link:hover {
        background: transparent;
    }
    
    .header-widget-btn:hover {
        transform: none;
    }
    
    .header-widget-btn:active {
        transform: scale(0.98);
    }
}

/* ==================== 减少动画偏好 ==================== */
@media (prefers-reduced-motion: reduce) {
    .header-widget,
    .header-widget-logo-icon,
    .header-widget-nav-link,
    .header-widget-btn,
    .header-widget-mobile-menu {
        transition: none;
    }
    
    .header-widget-logo-icon::after {
        animation: none;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .header-widget {
        position: static;
        background: white;
        border-bottom: 1px solid #ccc;
    }
    
    .header-widget-nav,
    .header-widget-buttons,
    .header-widget-menu-toggle {
        display: none;
    }
}
