/* ============================================================
 * 用户菜单组件样式 — 匹配 index-page 玻璃态视觉风格
 * ============================================================ */

/* ---- 容器 ---- */
.index-user-area {
    position: fixed;
    top: 5%;
    right: 4%;
    z-index: 998;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---- 未登录：登录链接（沿用 .top-link-btn 的样式） ---- */
#index-login-link {
    opacity: 1;
    pointer-events: auto;
}

#index-login-link.hidden {
    display: none;
}

/* ---- 已登录：用户菜单整体容器 ---- */
.index-user-menu {
    position: relative;
    display: inline-flex;
}

.index-user-menu.hidden {
    display: none;
}

/* ---- 头像按钮 ---- */
.index-user-avatar-btn {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: none;
    padding: 0;
    background: linear-gradient(135deg, #40B5AD 0%, #2C8F87 100%);
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Alibaba PuHuiTi', 'Alibaba PuHuiTi Subset', 'Noto Sans SC', sans-serif;
    line-height: 42px;
    text-align: center;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 190, 167, 0.35);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.index-user-avatar-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 190, 167, 0.5);
}

.index-user-avatar-btn:focus-visible {
    outline: 2px solid #00bea7;
    outline-offset: 3px;
}

.index-user-avatar-btn #index-user-avatar-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ---- 下拉菜单面板 ---- */
.index-user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    background: rgba(15, 25, 40, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    padding: 10px 14px;
    z-index: 999;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

.index-user-dropdown:not(.hidden) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 完全隐藏（display:none 模式，由 JS 切换） */
.index-user-dropdown.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
}

/* ---- 下拉内容行 ---- */
.index-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: 'Alibaba PuHuiTi', 'Alibaba PuHuiTi Subset', 'Noto Sans SC', sans-serif;
}

.index-user-row:last-of-type {
    border-bottom: none;
}

.index-user-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.50);
    flex-shrink: 0;
}

.index-user-value {
    font-size: 13px;
    color: #ffffff;
    text-align: right;
    word-break: break-all;
}

.index-user-balance {
    color: #00bea7;
    font-weight: 600;
}

/* ---- 退出登录按钮 ---- */
.index-user-actions {
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 2px;
}

.index-user-logout-btn {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.65);
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Alibaba PuHuiTi', 'Alibaba PuHuiTi Subset', 'Noto Sans SC', sans-serif;
    padding: 8px 0;
    cursor: pointer;
    transition:
        color 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.index-user-logout-btn:hover {
    color: #00bea7;
    border-color: rgba(0, 190, 167, 0.5);
    background: rgba(0, 190, 167, 0.10);
}

.index-user-logout-btn:focus-visible {
    outline: 2px solid #00bea7;
    outline-offset: 2px;
}

/* ---- 与 story-page 的层级协调 ---- */
/* story-page z-index=1500，.top-link-btn 在 story 模式下 z-index=1520 */
body.story-active .index-user-area {
    z-index: 1520;
}

body.story-active #index-login-link {
    opacity: 0;
    pointer-events: all;
    animation: top-link-btn-reveal 0.45s ease forwards;
}

/* ---- 响应式：小屏幕 ---- */
@media (max-width: 640px) {
    .index-user-area {
        top: 12px;
        right: 4%;
    }

    .index-user-avatar-btn {
        width: 34px;
        height: 34px;
        font-size: 15px;
        line-height: 34px;
    }

    .index-user-dropdown {
        width: 210px;
        right: -4px;
        border-radius: 14px;
    }
}
