<?php
/**
 * The template part for Top Header
 *
 * @package Anime Stream 
 * @subpackage anime-stream
 * @since anime-stream 1.0
 */
?>

<div class="main-header">
  <div class="top-header d-flex justify-content-between align-items-center flex-wrap mb-5">
    <div class="search-box">
      <?php get_search_form(); ?>
    </div>
    <?php
      echo '<ul class="post-category mb-0 p-0">';
      $anime_stream_current_category = is_category() ? get_queried_object() : null;
      for ($anime_stream_j = 1; $anime_stream_j <= 3; $anime_stream_j++) {
        $anime_stream_cat_slug = get_theme_mod('anime_stream_header_top_category' .$anime_stream_j, 'select');
        if ($anime_stream_cat_slug && $anime_stream_cat_slug !== 'select') {
          $anime_stream_category = get_category_by_slug($anime_stream_cat_slug);
          if ($anime_stream_category) {
            $anime_stream_is_active = $anime_stream_current_category && $anime_stream_current_category->term_id === $anime_stream_category->term_id;
            echo '<li class="drp_dwn_menu">';
            echo '<a class="text-capitalize" href="' . esc_url(get_category_link($anime_stream_category->term_id)) . '">';
            echo esc_html($anime_stream_category->name);
            if ($anime_stream_is_active) {
              echo '<i class="fa-solid fa-comment-dots"></i> ';
            }
            echo '</a></li>';
          }
        }
      }
      echo '</ul>';
    ?>
  </div>
</div>