<?php
global $zon, $site_url;
foreach (DynamicSection() as $section) { ?>
    <section class="section-wise wow <?php echo $zon['config']['animate_class'] ?> mb-6">
        <div class="heading flex justify-between">
            <div class="heading-style-css">
            <a href="<?php echo $site_url ?>category/?n=<?php echo urlencode(getCategoryNameById($section['section_category'])) ?>"><h2 class="text-2xl font-bold">
                <?= $section['section_name'] ?>
            </h2></a>
            </div>
            
            <div data-target=".slider-container-<?= $section['id'] ?>" class="pagination-container">
                <div class="left-pagination Pagination">
                    <button>
                        <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" fill="none" stroke-width="1.5"
                            viewBox="0 0 24 24" color="#000000">
                            <path style="stroke: var(--zon-common-text-color);" stroke="#000000" stroke-width="1.5"
                                stroke-linecap="round" stroke-linejoin="round" d="m15 6-6 6 6 6"></path>
                        </svg>
                    </button>
                </div>
                <div class="right-pagination Pagination">
                    <button>
                        <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" fill="none" stroke-width="1.5"
                            viewBox="0 0 24 24" color="#000000">
                            <path style="stroke: var(--zon-common-text-color);" stroke="#000000" stroke-width="1.5"
                                stroke-linecap="round" stroke-linejoin="round" d="m9 6 6 6-6 6"></path>
                        </svg>
                    </button>
                </div>
            </div>
            
        </div>

        <div class="m-slider-container relative ">
            <div class="slider-container-<?= $section['id'] ?> relative overflow-x-scroll scroll-none mt-3">
                <div style="width: calc(240px * <?php echo $zon['config']['section_games_limit'] ?>)"
                    class="silders flex gap-6">
                    <?php foreach (GameByCategoryName($section['section_category'], $zon['config']['section_games_limit']) as $game) { ?>
                        <div class="game-card">
                            <a href="<?php echo $site_url . 'game/' . makeSlug($game['game_name']) . '/' . $game['id'] ?>"><img src="<?php echo $game['game_banner_url'] == '' ? $game['game_image_url'] : $game['game_banner_url'] ?>" /></a>
                            <div class="game-details gap-4">
                                <a href="<?php echo $site_url . 'game/' . makeSlug($game['game_name']) . '/' . $game['id'] ?>"
                                    class="text-md line-clamp-2 font-semibold">
                                    <?= $game['game_name'] ?>
                                </a>
                            </div>
                        </div>
                    <?php } ?>
                </div>
            </div>
        </div>
    </section>
<?php } ?>

<?php if (getAd('0,1', 'status') == 0) { ?>
    <div class="p-2 mt-4">
        <div class="ads wow <?php echo $zon['config']['animate_class'] ?> flex justify-center">
            <?php echo getAd('0,1', 'code') ?>
        </div>
    </div>
<?php } ?>