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

/* 字体抗锯齿 - 使字体更清晰 */
.cx-user-menu,
.cx-auth-btn,
.cx-dropdown,
.cx-dropdown * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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

.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;
}

.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: 600;
    color: #363636;
}

.cx-dropdown-info {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.cx-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.6;
}

.cx-info-label {
    color: #666;
    font-weight: 500;
}

.cx-info-value {
    color: #363636;
    font-weight: 600;
}

.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;
    font-weight: 500;
    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;
        border-radius: 4px;  /* 添加圆角 */
    }
    
    /* 移动端点击反馈效果 - 与菜单按钮一致 */
    .cx-user-menu:active,
    .cx-user-menu.cx-active {
        background: rgba(0, 0, 0, 0.1) !important;
        border-radius: 4px;
    }
    
    /* 已登录：隐藏文字 */
    .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;
        border-radius: 4px;
    }
    
    .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端使用JS控制hover，不使用CSS */
    
}

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

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