/* =============================================
   Account Menu — 1:1 复刻 workspace-menu.html
   ============================================= */

/* ── 外层定位包装 ── */
#amMenuWrap {
    position: fixed;
    left: 0; top: 0;
    min-width: max-content;
    z-index: 1050;
    display: none;
    pointer-events: none;
}
#amMenuWrap.visible {
    display: block;
    pointer-events: auto;
}

/* ── 菜单容器 ── */
.am-menu {
    width: var(--am-anchor-w, 240px);
    min-width: 14rem;
    max-height: var(--am-available-h, 400px);
    padding: 0.25rem;
    border-radius: 0.5rem;
    background-color: rgba(26, 26, 26, 0.9);
    border: 0.5px solid rgba(64, 64, 64, 0.5);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    outline: none;
    transform-origin: var(--am-transform-origin, left top);
}

/* ── 入场/退场动画 ── */
.am-menu[data-state="open"] {
    animation: amFadeIn 0.15s ease-out, amZoomIn 0.15s ease-out;
}
.am-menu[data-side="right"][data-state="open"] {
    animation: amFadeIn 0.15s ease-out, amZoomIn 0.15s ease-out, amSlideRight 0.15s ease-out;
}
@keyframes amFadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes amZoomIn    { from { transform: scale(0.95); } to { transform: scale(1); } }
@keyframes amSlideRight { from { transform: translateX(-8px); } to { transform: translateX(0); } }

/* ── 子元素间距 ── */
.am-menu > * + * { margin-top: 0.125rem; }

/* ── 标签（Workspaces） ── */
.am-label {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 350;
    color: #a1a1aa;
}

/* ── 菜单项共用 ── */
.am-item,
.am-menu-item {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 0.125rem;
    font-size: 0.875rem;
    color: #fff;
    background-color: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    user-select: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 0.15s;
}
.am-item:hover,
.am-menu-item:hover { background-color: #2D2D2D !important; color: #fff !important; }
.am-item:hover svg,
.am-menu-item:hover svg { color: #fff !important; }

.am-item svg,
.am-menu-item svg {
    width: 0.875rem; height: 0.875rem;
    color: #a1a1aa;
    flex-shrink: 0;
    pointer-events: none;
}

/* ── Workspace 项（紧凑 padding） ── */
.am-item {
    gap: 0.5rem;
    padding: 0.5rem;
}
.am-item--active {
    background-color: var(--sidebar-accent, #272727);
}
.am-item--active:hover { background-color: #2e2e2e; }

/* ── 头像 ── */
.am-avatar {
    position: relative;
    display: flex;
    align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem;
    flex-shrink: 0;
    border-radius: 0.375rem;
    overflow: hidden;
    font-size: 0.75rem;
}
.am-avatar-fallback {
    display: flex;
    align-items: center; justify-content: center;
    width: 100%; height: 100%;
    border-radius: 0.375rem;
    background-color: #1f1f1f;
    border: 0.5px solid rgba(64, 64, 64, 0.5);
}

.am-user-info {
    display: grid;
    flex: 1;
    text-align: left;
    line-height: 1.25;
}
.am-username {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.am-plan {
    font-size: 0.75rem;
    color: #a1a1aa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Add workspace 图标 ── */
.am-add-icon {
    display: flex;
    align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem;
    border-radius: 0.375rem;
    border: 0.5px solid rgba(64, 64, 64, 0.5);
}
.am-add-icon svg { width: 1rem; height: 1rem; color: #a1a1aa; }
.am-add-label {
    font-size: 0.875rem;
    color: #a1a1aa;
    font-weight: 350;
}

/* ── 分隔线 ── */
.am-sep {
    height: 1px;
    margin: 0.25rem -0.25rem;
    background-color: rgba(64, 64, 64, 0.5);
}

/* ── 积分卡片 ── */
.am-credit-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.125rem;
    border: 0.5px solid rgba(64, 64, 64, 0.5);
    background-color: transparent;
    cursor: pointer;
    transition: background-color 0.15s;
    text-decoration: none;
    color: inherit;
}
.am-credit-card:hover { background-color: #2D2D2D; }
.am-credit-card:active { transform: scale(0.98); }

.am-ring { position: relative; width: 18px; height: 18px; flex-shrink: 0; }
.am-ring svg { transform: rotate(-90deg); }

.am-credit-info {
    display: grid;
    flex: 1;
    text-align: left;
    line-height: 1.25;
}
.am-credit-amount {
    font-size: 0.875rem;
    font-weight: 600;
}
.am-credit-sub {
    font-size: 0.75rem;
    color: #a1a1aa;
}

/* ── 通用菜单项（Upgrade/Buy/Settings/Stats/Logout） ── */
.am-menu-item {
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
}

/* ── AM wrapper 内的 AM menu 直接子元素 bottom margin ── */
.am-item--active { margin-bottom: 0.125rem; }

[data-placeholder] {
    opacity: 0.35;
    pointer-events: none;
}
