/* 用户信息组件样式 */

#user-info {
    position: relative;
    z-index: 1050;
}

#user-info .dropdown-menu {
    border: 1px solid #ccc;
    background-color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border-radius: 0.25rem;
    z-index: 1050;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.user-trigger {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    height: 40px;
    padding: 0 .75rem 0 .25rem;
    border-radius: 20px;
    border: 1px solid #e9ecef;
    background: #fff;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    text-decoration: none;
    color: inherit;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
}

.user-trigger:hover,
[aria-expanded="true"].user-trigger {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

/* 使用通用头像样式 */
.user-avatar {
    margin-left: -1px;
    z-index: 1;
    /* 确保通用头像样式不被覆盖 */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 确保头像图片正确显示 */
.user-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.user-trigger svg {
    width: 12px;
    height: 12px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.user-trigger[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* 下拉菜单 */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 8px;
    display: none !important;
    z-index: 1050;
    box-sizing: border-box;
    min-width: 140px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.user-dropdown.show {
    display: block !important;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    text-align: center;
}

.user-item:hover {
    background: #f8f9fa;
    color: #212529;
}

.user-item.admin-item {
    color: #6366f1;
    font-weight: 600;
}

.user-item.admin-item:hover {
    background: #eef2ff;
    color: #4f46e5;
}

.user-item.danger {
    color: #dc3545;
}

.user-item.danger:hover {
    background: #f8d7da;
    color: #721c24;
}

/* 确保下拉菜单不被其他元素遮挡 */
.user-menu {
    z-index: 1050;
}


/* 窄屏回落项：积分中心 / 学习看板 / 收藏列表 / 生词本 在宽屏由顶栏横向导航承载
   （见 topbar.css 的 .topbar-nav），下拉菜单里隐藏；窄屏导航收起后再显示出来。
   同一份入口在两处各渲染一次，纯 CSS 切换，不需要监听视口变化 */
.user-item-fallback {
    display: none;
}

@media (max-width: 991px) {
    .user-item-fallback {
        display: flex;
    }
}
