Styling a category link

I am still learning but I wasnt able to style a category link. I was able to create the following so only 1 category link is displayed. But I was unsure how I can modify this so I can add a class and style it. Is anyone able to help?

            <?php               // category link    $  categories = get_the_category();         if ( ! empty( $  categories ) ) { echo '<a href="' . esc_url( get_category_link( $  categories[0]->term_id )        ) . '">' . esc_html( $  categories[0]->name ) . '</a>';       }     // category link          ?>