<?php require PATH . '/theme/view/common/head.php'; ?>
<?php require PATH . '/theme/view/common/header.php'; ?>
<div class="py-1">
    <div class="container-fluid">
        <div class="category-btn">
            <a href="<?php echo games();?>"><?php echo $this->translate('Newest');?></a>
            <a href="<?php echo games($this->translate('most-popular'));?>"><?php echo $this->translate('Most popular');?></a>
            <div class="mx-4"></div>
            <?php foreach($Categories as $Category) { ?>
            <a href="<?php echo category($Category['id'],$Category['self']);?>"><?php echo $Category['name'];?></a>
            <?php } ?>
        </div>
    </div>
</div>
<div class="layout-section">
    <div class="container-fluid">
        <div class="card-masonry">
            <?php
            $i = 1;
            foreach ($Newests as $Newest) {
            ?>
            <a href="<?php echo play($Newest['id'],$Newest['self']);?>" class="card <?php if($i == 1 || $i == 16) echo 'large';?>">
                <?php echo picture(GAME_FOLDER,($i == 1 || $i == 16 ? $Newest['image'] : 'thumb-'.$Newest['image']),'img-fluid',$Newest['title'],GAME_X.','.GAME_Y);?>
                <div class="card-body">
                    <h3>
                        <?php echo $Newest['title'];?>
                    </h3>
                </div>
            </a>
            <?php $i++; } ?>
            <?php foreach ($Collections as $Collection) { ?>
            <a href="<?php echo collection($Collection['id'],$Collection['self']);?>" class="card card-collection">
                <div class="card-collection-body" <?php if(isset($Collection['color'])) echo 'style="background-color:' .$Collection['color'].'"';?>>
                    <div class="card-img">
                        <?php echo picture(GAME_FOLDER,'thumb-'.$Collection['image'],'rounded-3 img-fluid',$Collection['name'],GAME_X.','.GAME_Y);?>
                    </div>
                    <div class="card-text">
                        <h3>
                            <?php echo $Collection['name'];?>
                        </h3>
                        <div class="fs-xs text-white-50 mt-2">
                            <?php echo $Collection['total'].' '.$this->translate('game avaible');?>
                        </div>
                    </div>
                </div>
            </a>
            <?php } ?>
        </div>
    </div>
</div>
<?php echo ads($Ads,2,'mx-lg-auto py-3 px-3 mb-3');?>
<div class="layout-section">
    <div class="container-fluid">
        <div class="layout-heading mb-3">
            <h3 class="fs-lg fw-bold">
                <?php echo $this->translate('Most popular');?>
            </h3>
        </div>
        <div class="card-masonry">
            <?php
            $i = 1;
            foreach ($Populars as $Popular) {
            ?>
            <a href="<?php echo play($Popular['id'],$Popular['self']);?>" class="card <?php if($i == 1 || $i == 4) echo 'large';?>">
                <?php echo picture(GAME_FOLDER,($i == 1 || $i == 4 ? $Popular['image'] : 'thumb-'.$Popular['image']),'img-fluid',$Popular['title'],GAME_X.','.GAME_Y);?>
                <div class="card-body">
                    <h3>
                        <?php echo $Popular['title'];?>
                    </h3>
                </div>
            </a>
            <?php $i++; } ?>
        </div>
    </div>
</div>
<?php echo ads($Ads,2,'mx-lg-auto py-3 px-3 mb-3');?>
<div class="layout-section">
    <div class="container-fluid">
        <div class="layout-heading mb-3">
            <h3 class="fs-lg fw-bold">
                <?php echo $this->translate('You may also like');?>
            </h3>
        </div>
        <div class="card-masonry">
            <?php
            $i = 1;
            foreach ($Randoms as $Random) {
            ?>
            <a href="<?php echo play($Random['id'],$Random['self']);?>" class="card <?php if($i == 1 || $i == 4) echo 'large';?>">
                <?php echo picture(GAME_FOLDER,($i == 1 || $i == 4 ? $Random['image'] : 'thumb-'.$Random['image']),'img-fluid',$Random['title'],GAME_X.','.GAME_Y);?>
                <div class="card-body">
                    <h3>
                        <?php echo $Random['title'];?>
                    </h3>
                </div>
            </a>
            <?php $i++; } ?>
        </div>
    </div>
</div>
<?php if(get($Settings,'data.footer_text','general')) { ?>
<div class="layout-section layout-text">
    <div class="container-fluid">
        <?php echo htmlspecialchars_decode(get($Settings,'data.footer_text','general'));?>
    </div>
</div>
<?php } ?>
<?php require PATH . '/theme/view/common/javascript.php'; ?>
<?php require PATH . '/theme/view/common/footer.php'; ?>