/* ==================== CX用户菜单样式 ==================== */

/* ==================== 基础样式 ==================== */

.cx-user-menu {
    position: absolute;
    right: 54px;
    top: 0;
    height: 48px;
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cx-user-logged-in {
    padding: 0 20px;
    border-right: 1px solid rgba(0,0,0,.1);
    box-shadow: 1px 0 0 rgba(255,255,255,.12);
}

.cx-user-icon {
    margin-right: 8px;
    flex-shrink: 0;
}

.cx-user-text {
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

.cx-user-menu:hover {
    background: rgba(0, 0, 0, 0.03);
    text-decoration: none;
}

/* ==================== 未登录状态 - PC端按钮 ==================== */

.cx-auth-btn {
    position: absolute;
    top: 0;
    height: 48px;
    line-height: 48px;
    padding: 0 20px;
    color: #fff !important;
    background: none;
    border: none;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.cx-login-btn-pc {
    right: 102px;
    /* 【修正 1】：去除登录按钮右侧分隔线 */
    border-right: none !important;
    box-shadow: none !important;
}

.cx-register-btn-pc {
    right: 54px;
}

.cx-auth-btn:hover {
    background: rgba(0, 0, 0, 0.03);
    text-decoration: none;
}

/* ==================== 移动端图标按钮（默认隐藏） ==================== */

.cx-mobile-only {
    display: none !important;
}

/* ==================== 下拉菜单容器 ==================== */

.mainmenu {
    position: relative;  /* 为下拉菜单提供定位基准 */
}

.cx-dropdown {
    display: none;
    position: absolute;
    top: 48px;           /* mainmenu的topnav高度 */
    right: 54px;         /* 对齐用户图标 */
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    z-index: 9999;
    animation: slideDown 0.3s ease;
}

.cx-dropdown.cx-active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 已登录下拉菜单 ==================== */

.cx-dropdown-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    border-radius: 8px 8px 0 0;
}

.cx-dropdown-icon {
    margin-right: 10px;
    color: #0289cb;
}

.cx-dropdown-header span {
    font-size: 15px;
    font-weight: bold;
    color: #363636;
}

/* 优化区域：会员信息显示 */
.cx-dropdown-info {
    padding: 12px 20px; /* 调整垂直填充 */
    border-bottom: 1px solid #f0f0f0;
}

.cx-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0; /* 增加行间距 */
    font-size: 14px; /* 字体略微增大 */
}

.cx-info-label {
    color: #999;
    font-weight: normal;
    /* 新增：确保标签字体清晰 */
    text-shadow: none !important;
}

.cx-info-value {
    /* 优化：使用强调色并加粗 */
    color: #0289cb; 
    font-weight: bold;
    text-align: right;
    /* 新增：清除文本阴影，修复不清晰问题 */
    text-shadow: none !important; 
}
/* 优化区域结束 */

.cx-dropdown-links {
    padding: 8px 0;
}

.cx-dropdown-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #363636 !important;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
}

.cx-dropdown-link:hover {
    background: #f5f5f5;
}

.cx-dropdown-link svg {
    margin-right: 10px;
    color: #0289cb;
}

.cx-logout-link:hover {
    background: #fff5f5;
}

.cx-logout-link svg {
    color: #ff4d4f;
}

/* ==================== 移动端下拉菜单 - 未登录 ==================== */

.cx-mobile-auth-dropdown {
    display: none;
    position: absolute;
    top: 48px;
    right: 54px;
    background: #65859B;
    border-radius: 6px;
    padding: 0;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideDown 0.3s ease;
}

.cx-mobile-auth-dropdown.cx-active {
    display: block;
}

.cx-mobile-auth-link {
    display: block;
    padding: 14px 20px;
    color: #fff !important;
    font-size: 14px;
    font-weight: normal;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transition: background 0.3s ease;
}

.cx-mobile-auth-link:last-child {
    border-bottom: none;
}

.cx-mobile-auth-link:hover,
.cx-mobile-auth-link:active {
    background: rgba(0, 0, 0, 0.15);
    color: #fff !important;
}

/* ==================== 移动端样式 (≤782px) ==================== */

@media (max-width: 782px) {
    
    /* 调整menu-button位置 */
    .topnav .menu-button {
        right: 102px !important;
    }
    
    /* 用户菜单保持中间 */
    .cx-user-menu {
        right: 54px;
        width: 48px;
        padding: 0;
        justify-content: center;
    }
    
    /* 已登录：隐藏文字 */
    .cx-user-logged-in .cx-user-text {
        display: none !important;
    }
    
    .cx-user-logged-in {
        border-right: none;
        box-shadow: none;
    }
    
    .cx-user-logged-in .cx-user-icon {
        width: 20px;
        height: 20px;
        margin-right: 0;
    }
    
    /* 未登录：隐藏PC端按钮 */
    .cx-auth-btn {
        display: none !important;
    }
    
    /* 未登录：显示移动端图标 */
    .cx-mobile-only {
        display: flex !important;
        width: 48px;
        padding: 0;
        border: none;
        box-shadow: none;
    }
    
    .cx-mobile-only .cx-user-icon {
        width: 20px;
        height: 20px;
    }
    
    /* 移动端下拉菜单位置调整 */
    .cx-dropdown,
    .cx-mobile-auth-dropdown {
        right: 54px;
    }
}

/* ==================== PC端（>782px） ==================== */

@media (min-width: 783px) {
    
    /* PC端hover效果 - 已登录 */
    .cx-user-logged-in:hover {
        background: rgba(0, 0, 0, 0.03);
    }
    
    /* 【修正 2】：使用父元素 .mainmenu 悬停来触发下拉菜单的显示 */
    .mainmenu:hover .cx-user-dropdown, 
    .cx-user-dropdown:hover {
        display: block;
    }
}

/* ==================== 打印样式 ==================== */

@media print {
    .cx-user-menu,
    .cx-auth-btn,
    .cx-dropdown {
        display: none !important;
    }
}