/* 用户按钮样式 */
.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--glass-bg-strong);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: none;
    font-family: inherit;
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    overflow: hidden;
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .user-panel {
        width: 160px;
        right: -160px;
        /* 超小屏幕高度优化 */
        height: 65vh;
        max-height: 450px;
        top: 15vh;
        border-radius: 10px 0 0 10px;
    }

    .user-panel-content {
        padding: 0.6rem;
        /* 超小屏幕内容区域进一步优化 */
        max-height: calc(65vh - 50px);
    }

    .user-panel-header {
        padding: 0.6rem 0.8rem;
    }

    .user-panel-header h3 {
        font-size: 0.9rem;
    }

    .user-info {
        padding: 0.6rem;
        gap: 0.5rem;
    }

    .user-avatar-large img {
        width: 28px;
        height: 28px;
    }

    .user-display-name {
        font-size: 0.8rem;
    }

    .user-email {
        font-size: 0.6rem;
    }

    .menu-item,
    .action-btn {
        min-height: 40px;
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }
}

.user-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-shimmer);
    transition: left 0.6s ease;
    pointer-events: none;
}

.user-btn:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transform: translateY(-3px) scale(1.05);
    background: var(--card-bg-hover);
    filter: brightness(1.02);
}

.user-btn:hover::before {
    left: 100%;
}

.user-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.user-btn:active {
    transform: scale(0.98);
    background: rgba(0, 122, 255, 0.1);
}

.user-btn img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    pointer-events: none;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    pointer-events: none;
    color: var(--text-primary);
}

/* 移动端优化 */
@media (max-width: 768px) {
    .user-btn {
        padding: 0.4rem 0.8rem;
        min-height: 44px;
        /* iOS 推荐的最小触摸目标尺寸 */
        gap: 0.4rem;
    }

    .user-name {
        max-width: 60px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .user-btn {
        padding: 0.3rem 0.6rem;
        gap: 0.3rem;
    }

    .user-name {
        max-width: 50px;
        font-size: 0.8rem;
    }

    .user-btn img {
        width: 20px;
        height: 20px;
    }
}

/* 用户面板遮罩层 */
.user-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1098;
    opacity: 0;
    visibility: hidden;
    transition: all 0.1s ease;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.user-panel-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 用户面板主体 */
.user-panel {
    position: fixed;
    top: 0;
    right: -220px;
    width: 220px;
    height: 100vh;
    background: var(--glass-bg-ultra);
    backdrop-filter: var(--glass-backdrop-strong);
    -webkit-backdrop-filter: var(--glass-backdrop-strong);
    z-index: 1099;
    transition: right 0.1s ease;
    box-shadow: var(--shadow-2xl), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    border-left: 1px solid var(--border-medium);
    display: flex;
    flex-direction: column;
    /* 滚动优化 */
    overflow: hidden;
}

.user-panel.active {
    right: 0;
}

/* 用户面板头部 */
.user-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--gradient-surface);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.user-panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    outline: none;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.close-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.close-btn:active {
    transform: scale(0.95);
}

/* 用户面板内容区域 - 支持滚动 */
.user-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    /* 滚动优化 */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
}



/* 用户信息区域 */
.user-info {
    background: var(--gradient-primary);
    border-radius: 20px;
    padding: 1.2rem;
    color: white;
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.user-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
    border-radius: 20px 20px 0 0;
}

.user-avatar-large img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.user-info:hover .user-avatar-large img {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.6);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-display-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 菜单分组 */
.user-menu-section {
    margin-bottom: 1.5rem;
}

.menu-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.8rem 0;
    padding: 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* 菜单列表 */
.user-menu-list {
    margin-bottom: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-xs);
}

.menu-item:hover {
    background: var(--hover-accent);
    border-color: var(--border-accent);
    color: var(--accent-color);
    transform: translateX(-4px) scale(1.03);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 122, 255, 0.05), transparent);
    transition: left 0.5s;
}

.menu-item:hover::before {
    left: 100%;
}

.menu-item:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.menu-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.menu-text {
    flex: 1;
    font-weight: 500;
}

/* 操作按钮区域 */
.user-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 0.85rem;
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 500;
    outline: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-shimmer);
    transition: left 0.6s ease;
    pointer-events: none;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-accent);
    color: var(--accent-color);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.action-btn:active {
    transform: scale(0.98);
}

/* 退出登录按钮特殊样式 */
.logout-btn {
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #dc2626 !important;
}

.logout-btn:focus {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-panel {
        width: 200px;
        right: -200px;
        /* 移动端高度优化 - 与左侧侧边栏保持一致 */
        height: 75vh;
        max-height: 600px;
        top: 10vh;
        border-radius: 16px 0 0 16px;
    }

    .user-panel-content {
        padding: 0.8rem;
        /* 移动端内容区域高度调整 */
        max-height: calc(75vh - 70px);
    }



    .user-info {
        padding: 0.8rem;
        gap: 0.6rem;
    }

    .user-avatar-large img {
        width: 36px;
        height: 36px;
    }

    .user-display-name {
        font-size: 0.9rem;
    }

    .user-email {
        font-size: 0.7rem;
    }

    .menu-item,
    .action-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
        min-height: 40px;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .user-panel {
        width: 180px;
        right: -180px;
        /* 小屏幕进一步优化高度 */
        height: 70vh;
        max-height: 500px;
        top: 12vh;
        border-radius: 12px 0 0 12px;
    }

    .user-panel-header {
        padding: 0.8rem 1rem;
    }

    .user-panel-content {
        /* 小屏幕内容区域进一步优化 */
        max-height: calc(70vh - 60px);
    }

    .user-panel-header h3 {
        font-size: 1rem;
    }

    .user-info {
        padding: 0.8rem;
        gap: 0.6rem;
    }

    .user-avatar-large img {
        width: 32px;
        height: 32px;
    }

    .user-display-name {
        font-size: 0.85rem;
    }

    .user-email {
        font-size: 0.65rem;
    }

    .menu-item,
    .action-btn {
        min-height: 44px;
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        gap: 0.4rem;
    }
}