Hi,
You want to edit the file "quantity" of the view "product" via the menu Display>Views.
There, you'll find these lines:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'), 'add', $this->params,$url, $this->ajax, '', $max, $min);
You can add a parameter like that to these lines to add a custom class:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'), 'add', $this->params,$url, $this->ajax, '', $max, $min,' custom_css_class');
where custom_css_class is your custom CSS class.
To know if a user is logged in or not, you can use such code:
$user = JFactory::getUser();
if($user->guest){
// user is not logged in
}