/* 统一导航组件样式 */
.game-navigation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    user-select: none; /* 禁用文本选择 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* 优化触摸交互 */
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    height: 70px;
    gap: 1rem; /* 减少默认间距以适应更多内容 */
    justify-content: space-between; /* 确保左右两端对齐 */
}

/* 品牌区域 */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 1; /* 允许适度压缩 */
    min-width: 0; /* 允许内容收缩 */
    max-width: 300px; /* 限制最大宽度 */
    overflow: hidden; /* 防止溢出 */
}

.nav-logo {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.nav-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    white-space: nowrap; /* 防止换行 */
    overflow: hidden;
    text-overflow: ellipsis; /* 文本省略 */
}

.nav-subtitle {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap; /* 防止换行 */
    overflow: hidden;
    text-overflow: ellipsis; /* 文本省略 */
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    gap: 0.5rem; /* 减少间距以节省空间 */
    flex: 1; /* 占据剩余空间 */
    justify-content: center; /* 居中对齐 */
    align-items: center;
    min-width: 0; /* 允许收缩 */
    overflow: hidden; /* 防止溢出 */
}

.nav-menu-item {
    display: flex;
    align-items: center;
    gap: 0.3rem; /* 减少内部间距 */
    padding: 0.4rem 0.8rem; /* 减少内边距 */
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    white-space: nowrap; /* 防止文字换行 */
    flex-shrink: 1; /* 允许收缩 */
    min-width: 0; /* 允许收缩到内容最小宽度 */
}

.nav-menu-item:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-menu-item.active {
    background: rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

/* 操作区域 */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0; /* 防止操作区域被压缩 */
}

/* 搜索框 */
.nav-search {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-search-icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    opacity: 0.7;
}

.nav-search-input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: none;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    backdrop-filter: blur(10px);
    width: 200px;
    transition: all 0.3s ease;
}

.nav-search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.nav-search-input:focus {
    outline: none;
    background: rgba(255,255,255,0.3);
    width: 250px;
}

/* 通知 */
.nav-notification {
    position: relative;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.nav-notification:hover {
    background: rgba(255,255,255,0.2);
}

.nav-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 用户菜单 */
.nav-user-menu {
    position: relative;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    flex-shrink: 1; /* 允许收缩 */
    min-width: 0; /* 允许收缩 */
    max-width: 280px; /* 限制最大宽度 */
}

.nav-user-menu:hover {
    background: rgba(255,255,255,0.2);
}

.nav-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0; /* 允许收缩 */
    overflow: hidden; /* 防止溢出 */
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0; /* 允许收缩 */
    overflow: hidden; /* 防止溢出 */
    flex-shrink: 1; /* 允许收缩 */
}

.nav-user-name {
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-role {
    font-size: 0.7rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-points-info {
    font-size: 0.6rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* 下拉菜单 */
.nav-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

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

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background 0.2s ease;
    cursor: pointer;
}

.nav-dropdown-item:hover {
    background: #f8f9fa;
}

.nav-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.nav-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* 当只有一个菜单项时（如游客状态的Login），应用完整圆角 */
.nav-dropdown-item:only-child {
    border-radius: 8px;
}

/* 响应式设计 */

/* 大屏幕优化 */
@media (max-width: 1200px) {
    .nav-container {
        gap: 1.5rem; /* 减少间距 */
    }
    
    .nav-menu {
        gap: 0.3rem; /* 进一步减少菜单项间距 */
    }
    
    .nav-menu-item {
        padding: 0.3rem 0.6rem; /* 减少内边距 */
        font-size: 0.9rem; /* 减小字体 */
    }
}

/* 中等屏幕优化 */
@media (max-width: 992px) {
    .nav-container {
        gap: 1rem; /* 进一步减少间距 */
        padding: 0 0.8rem;
    }
    
    .nav-title {
        font-size: 1.3rem;
    }
    
    .nav-subtitle {
        font-size: 0.8rem;
    }
    
    .nav-user-menu {
        max-width: 200px; /* 进一步限制用户菜单宽度 */
    }
    
    .nav-search-input {
        width: 160px;
    }
    
    .nav-search-input:focus {
        width: 200px;
    }
}

/* 小屏幕优化 */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 0.5rem;
        height: 60px;
        gap: 0.8rem; /* 减少间距 */
    }
    
    .nav-title {
        font-size: 1.2rem;
    }
    
    .nav-subtitle {
        display: none;
    }
    
    .nav-menu {
        display: none;
    }
    
    .nav-search-input {
        width: 120px;
    }
    
    .nav-search-input:focus {
        width: 150px;
    }
    
    .nav-user-details {
        display: none;
    }
    
    .nav-user-menu {
        max-width: 60px; /* 只显示头像 */
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .nav-container {
        gap: 0.5rem;
        padding: 0 0.3rem;
    }
    
    .nav-brand {
        max-width: 150px; /* 进一步限制品牌区域 */
    }
    
    .nav-title {
        font-size: 1.0rem; /* 进一步减小字体 */
    }
    
    .nav-logo {
        font-size: 1.5rem; /* 减小logo尺寸 */
    }
    
    .nav-search {
        display: none;
    }
    
    .nav-notification {
        display: none;
    }
    
    .nav-user-menu {
        max-width: 45px;
        padding: 0.2rem;
    }
    
    .nav-user-avatar {
        width: 28px; /* 减小头像尺寸 */
        height: 28px;
        font-size: 1rem;
    }
}

/* 极小屏幕优化 */
@media (max-width: 360px) {
    .nav-container {
        gap: 0.3rem;
        padding: 0 0.2rem;
        height: 55px; /* 减小导航栏高度 */
    }
    
    .nav-brand {
        max-width: 120px;
        gap: 0.5rem;
    }
    
    .nav-title {
        font-size: 0.9rem;
    }
    
    .nav-logo {
        font-size: 1.3rem;
    }
    
    .nav-user-menu {
        max-width: 40px;
        padding: 0.15rem;
    }
    
    .nav-user-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
}

/* 主题支持 */
.game-navigation[data-theme="dark"] {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.game-navigation[data-theme="light"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-dropdown.show {
    animation: fadeIn 0.3s ease;
} 