/* 头部导航样式 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-white);
    box-shadow: var(--shadow-light);
    z-index: 10000;
    border-bottom: 1px solid var(--border-light);
}

.header-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 左侧区域 */
.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--primary-color);
}

.logo img {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: scale(1.1);
}

.city-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 8px 12px;
    border-radius: var(--radius-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-regular);
}

.city-selector:hover {
    background-color: var(--bg-gray);
    color: var(--primary-color);
}

.current-city {
    font-weight: 500;
}

/* 城市选择侧栏 */
.city-drawer { position: fixed; top: var(--header-height); left: 0; bottom: 0; width: min(420px, 86vw); background: #fff; box-shadow: var(--shadow-large); border-right: 1px solid var(--border-light); transform: translateX(-100%); transition: transform .25s ease; z-index: 1001; display: flex; flex-direction: column; }
.city-drawer.show { transform: translateX(0); }
.city-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.city-drawer-body { flex: 1; overflow-y: auto; padding: 12px 0; }
.city-drawer-close { background: none; border: none; font-size: 20px; cursor: pointer; }
.city-hot { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
.city-hot .hot-item { padding: 6px 10px; border: 1px solid var(--border-light); border-radius: 999px; cursor: pointer; font-size: 13px; }
.city-list .group { margin-top: 8px; }
.city-list .group-title { font-weight: 700; padding: 10px 16px; border-bottom: 1px solid var(--border-light); background: var(--bg-gray); }
.city-list .city-item { padding: 12px 24px; border-bottom: 1px solid var(--border-light); cursor: pointer; }
.city-list .city-item:hover { background: var(--bg-gray); }

/* 中间搜索区域 */
.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 var(--spacing-xl);
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 48px 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-large);
    font-size: var(--font-size-sm);
    background-color: var(--bg-gray);
    transition: all 0.3s ease;
}

.search-box input:focus {
    background-color: var(--bg-white);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-round);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background-color: var(--primary-dark);
}

/* 右侧区域 */
.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.mobile-menu-btn {
    display: none;
    width: 36px; height: 36px;
    border-radius: var(--radius-round);
    background: var(--bg-gray);
    border: 1px solid var(--border-light);
    align-items: center; justify-content: center;
}

.mobile-menu-icon {
    position: relative; display: inline-block; width: 18px; height: 2px; background: var(--text-primary);
}
.mobile-menu-icon::before, .mobile-menu-icon::after {
    content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--text-primary);
}
.mobile-menu-icon::before { top: -6px; }
.mobile-menu-icon::after { top: 6px; }

.language-switch {
    position: relative;
    display: flex;
    align-items: center;
}

.lang-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-small);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid transparent;
}

.lang-icon {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.lang-text {
    white-space: nowrap;
}

.lang-trigger:hover {
    background-color: var(--primary-color);
    color: white;
}

.lang-trigger:hover .lang-icon {
    opacity: 1;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-medium);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9997;
    min-width: 80px;
}

.language-switch:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-btn {
    display: block;
    padding: 8px 12px;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.lang-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* 消息按钮 */
.message-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-medium);
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: var(--spacing-sm);
}

.message-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.message-icon {
    transition: transform 0.3s ease;
}

.message-btn:hover .message-icon {
    transform: scale(1.1);
}

.message-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background-color: #ff4757;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.message-badge:empty {
    display: none;
}

/* Tooltip样式 */
.message-btn[data-tooltip] {
    position: relative;
}

.message-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 9996;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease forwards;
}

.message-btn[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
    z-index: 9996;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease forwards;
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
    }
}

/* 用户菜单 */
.user-menu {
    position: relative;
    cursor: pointer;
}
.user-menu .user-name{font-weight:600;color:var(--text-primary);max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-dropdown .dropdown-header{padding:10px 16px;border-bottom:1px solid var(--border-light);}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-round);
    overflow: hidden;
    border: 2px solid var(--border-light);
    transition: all 0.3s ease;
}
.user-avatar{position:relative}
.user-avatar .badge{position:absolute;right:-2px;top:-2px;min-width:16px;height:16px;line-height:16px;padding:0 4px;border-radius:999px;background:#ff4d4f;color:#fff;font-size:10px}

.user-avatar:hover {
    border-color: var(--primary-color);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.user-avatar:hover img {
    transform: scale(1.05);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--spacing-sm);
    min-width: 160px;
    background-color: var(--bg-white);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-medium);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9997;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 12px 16px;
    color: var(--text-regular);
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--bg-gray);
    color: var(--primary-color);
}

.dropdown-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color 0.3s ease;
}

.dropdown-item:hover .dropdown-icon {
    color: var(--primary-color);
}

/* 主导航菜单 */
.main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: 80px;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    z-index: 9998;
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-menu {
    display: flex;
    align-items: center;
    height: 100%;
    gap: var(--spacing-xl);
}

.nav-app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow-light);
    transition: all .2s ease;
}
.nav-app-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.nav-item {
    position: relative;
    height: 100%;
}

.nav-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    padding: 0 var(--spacing-md);
    color: var(--text-regular);
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item a:hover,
.nav-item.active a {
    color: var(--primary-color);
}

.nav-item.active a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

.nav-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-round);
    box-shadow: var(--shadow-light);
    border: 2px solid rgba(255,255,255,0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.nav-circle img {
    width: 28px;
    height: 28px;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.nav-item a:hover .nav-circle,
.nav-item.active a .nav-circle {
    transform: scale(1.06);
    box-shadow: var(--shadow-medium);
    border-color: rgba(255,255,255,0.85);
}

.nav-item a span:last-child {
    color: var(--text-primary);
}

.nav-item a:hover span:last-child,
.nav-item.active a span:last-child {
    color: var(--primary-color);
}

/* 移动端菜单弹窗 */
.mobile-nav-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none; z-index: 9995; }
.mobile-nav-modal.show { display: block; }
.mobile-nav-content { position: absolute; right: 0; top: 0; bottom: 0; width: min(86vw, 360px); background: #fff; box-shadow: var(--shadow-large); display: flex; flex-direction: column; }
.mobile-nav-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border-light); }
.mobile-nav-title { font-weight: 700; }
.mobile-nav-close { background: none; border: none; font-size: 22px; cursor: pointer; }
.mobile-lang-switch { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.mobile-nav-list { list-style: none; padding: 8px 0; margin: 0; }
.mobile-nav-list li a { display: block; padding: 12px 16px; color: var(--text-primary); }

@media (max-width: 768px) {
    .nav-circle { width: 40px; height: 40px; }
    .nav-circle img { width: 24px; height: 24px; }
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background-color: var(--error-color);
    color: white;
    border-radius: var(--radius-round);
    font-size: var(--font-size-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-container {
        padding: 0 var(--spacing-sm);
    }
    
    .header-center {
        margin: 0 var(--spacing-md);
    }
    
    .city-selector {
        display: none;
    }
    
    .language-switch { display: none; }
    .mobile-menu-btn { display: inline-flex; }
    
    /* 隐藏原有横向菜单，改用弹窗菜单 */
    .main-nav { display: none; }
    .nav-container { overflow-x: initial; }
    .nav-menu { gap: var(--spacing-sm); flex-wrap: nowrap; min-width: initial; }
    
    .nav-item a {
        padding: 0 10px;
    }
    
    .nav-item span {
        display: inline;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .header-center { display: none; }
    .main-nav { height: 56px; }
    .nav-container { overflow-x: auto; padding: 0 8px; }
    .nav-menu { gap: 8px; }
    .nav-item a { padding: 0 8px; }
    .nav-item span { font-size: 12px; }
}
