</main>
<?php
global $ref_link;
$ref_link = get_field('referral_link', 'option');
$footer = get_field('footer', 'option');
$footer_logo = $footer['footer_logo'];
$copyright = $footer['copyright'];
$accepted_currencies = $footer['accepted_currencies'];
$accepted_currencies_title = $accepted_currencies['title'];
$accepted_currencies_items = $accepted_currencies['items'];
$licenses = $footer['licenses'];
$licenses_title = $licenses['title'];
$licenses_items = $licenses['items'];
$responsible_gambling = $footer['responsible_gambling'];
$responsible_gambling_title = $responsible_gambling['title'];
$responsible_gambling_items = $responsible_gambling['items'];
$awards = $footer['awards'];
$awards_title = $awards['title'];
$awards_items = $awards['items'];
$partners = $footer['partners'];
$partners_title = $partners['title'];
$partners_items = $partners['items'];

?>
<footer class="footer">
    <div class="top">
        <a class="scroll-to-top" href="">
            <?php $up_icon = get_field('up_icon', "option"); ?>
            <img
                src="<?php echo esc_url($up_icon['url']); ?>"
                alt="<?php echo esc_attr($up_icon['alt']); ?>"
                title="<?php echo esc_attr($up_icon['title']); ?>" />
        </a>
    </div>
    <div class="footer__content">
        <div class="footer-content__links">
            <nav class="menu footer__menu">
                <div class="footer-menu__block">
                    <?php
                    $link_responsible   = get_permalink(pll_get_post(833, pll_current_language()));
                    $title_responsible  = get_the_title(pll_get_post(833, pll_current_language()));
                    $link_bonus   = get_permalink(pll_get_post(1460, pll_current_language()));
                    $title_bonus  = get_the_title(pll_get_post(1460, pll_current_language()));
                    $link_free   = get_permalink(pll_get_post(1390, pll_current_language()));
                    $title_free  = get_the_title(pll_get_post(1390, pll_current_language()));
                    $link_app   = get_permalink(pll_get_post(1440, pll_current_language()));
                    $title_app  = get_the_title(pll_get_post(1440, pll_current_language()));
                    $link_games   = get_permalink(pll_get_post(717, pll_current_language()));
                    $title_games  = get_the_title(pll_get_post(717, pll_current_language()));
                    $link_login   = get_permalink(pll_get_post(1533, pll_current_language()));
                    $title_login  = get_the_title(pll_get_post(1533, pll_current_language()));
                    $link_deposit   = get_permalink(pll_get_post(1560, pll_current_language()));
                    $title_deposit  = get_the_title(pll_get_post(1560, pll_current_language()));
                    $link_codes   = get_permalink(pll_get_post(1475, pll_current_language()));
                    $title_codes  = get_the_title(pll_get_post(1475, pll_current_language()));
                    ?>
                    <ul>
                        <li>
                            <a href="<?= $link_bonus ?>">
                                <?= $title_bonus ?>
                            </a>
                        </li>
                        <li>
                            <a href="<?= $link_app ?>">
                                <?= $title_app ?>
                            </a>
                        </li>
                        <li>
                            <a href="<?= $link_deposit ?>">
                                <span><?= $title_deposit ?></span>
                            </a>
                        </li>
                        <li>
                            <a href="<?= $link_free ?>">
                                <span><?= $title_free ?></span>
                            </a>
                        </li>
                        <li>
                            <a href="<?= $link_codes ?>">
                                <span><?= $title_codes ?></span>
                            </a>
                        </li>
                        <li>
                            <a href="<?= $link_responsible ?>">
                                <?= $title_responsible ?>
                            </a>
                        </li>
                        <li>
                            <a href="<?= $link_login ?>">
                                <?= $title_login ?>
                            </a>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
        <div class="footer__information">
            <div class="footer__currencies">
                <p class="footer-currencies__title"><?php echo $accepted_currencies_title; ?></p>
                <div class="footer-currencies__blocks">
                    <?php
                    foreach ($accepted_currencies_items as $row) :
                        $icon = $row['icon'];
                        $text_1 = $row['text_1'];
                        $text_2 = $row['text_2'];
                    ?>
                        <div class="footer-currencies__block">
                            <img
                                src="<?php echo esc_url($icon['url']); ?>"
                                alt="<?php echo esc_attr($icon['alt']); ?>"
                                title="<?php echo esc_attr($icon['title']); ?>" />
                            <p class="footer-currencies-block__title"><?php echo $text_1; ?></p>
                            <span class="footer-currencies-block__currency"><?php echo $text_2; ?></span>
                        </div>
                    <?php endforeach; ?>
                </div>
            </div>
            <div class="footer-information__blocks">
                <div class="footer-information__block">
                    <p class="footer-information-block__title"><?php echo $licenses_title; ?></p>
                    <div class="footer-information-block__info">
                        <?php
                        foreach ($licenses_items as $row) :
                            $icon = $row['icon'];
                        ?>
                            <div class="image footer-information-block__image">
                                <img
                                    src="<?php echo esc_url($icon['url']); ?>"
                                    alt="<?php echo esc_attr($icon['alt']); ?>"
                                    title="<?php echo esc_attr($icon['title']); ?>" />
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
                <div class="footer-information__block">
                    <p class="footer-information-block__title">
                        <?php echo $responsible_gambling_title; ?>
                    </p>
                    <div class="footer-information-block__info">
                        <?php
                        foreach ($responsible_gambling_items as $row) :
                            $icon = $row['icon'];
                        ?>
                            <div class="image footer-information-block__image">
                                <img
                                    src="<?php echo esc_url($icon['url']); ?>"
                                    alt="<?php echo esc_attr($icon['alt']); ?>"
                                    title="<?php echo esc_attr($icon['title']); ?>" />
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
                <div class="footer-information__block">
                    <p class="footer-information-block__title"><?php echo $awards_title; ?></p>
                    <div class="footer-information-block__info">
                        <?php
                        foreach ($awards_items as $row) :
                            $icon = $row['icon'];
                            
                        ?>
                            <div class="image footer-information-block__image">
                                <img
                                    src="<?php echo esc_url($icon['url']); ?>"
                                    alt="<?php echo esc_attr($icon['alt']); ?>"
                                    title="<?php echo esc_attr($icon['title']); ?>" />
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>

            </div>
            <div class="footer-information__block ">
                <p class="footer-information-block__title"><?php echo $partners_title; ?></p>
                <div class="footer-information-block__info footer-information-block__info--wrap">
                    <?php
                    foreach ($partners_items as $row) :
                        $icon = $row['icon'];
                    ?>
                        <div class="image footer-information-block__image">
                            <img
                                src="<?php echo esc_url($icon['url']); ?>"
                                alt="<?php echo esc_attr($icon['alt']); ?>"
                                title="<?php echo esc_attr($icon['title']); ?>" />
                        </div>
                    <?php endforeach; ?>
                </div>
            </div>
            <div class="footer__block">
                <div class="image footer-block__image">
                    <img src="<?php echo esc_url($footer_logo['url']); ?>" alt="<?php echo esc_attr($footer_logo['alt']); ?>" title="<?php echo esc_attr($footer_logo['title']); ?>">
                </div>
            </div>
            <div class="footer-information__text">
                <?php echo $copyright; ?>
            </div>
        </div>
        <div class="footer-buttons">
            <a href="<?php echo esc_url($ref_link); ?>" class="button footer__button-login"><?php pll_e('Log in'); ?></a>
            <a href="<?php echo esc_url($ref_link); ?>" class="button footer__button-signup"><?php pll_e('Sign Up'); ?></a>
        </div>
    </div>
</footer>

<script src="<?php echo get_template_directory_uri(); ?>/assets/js/header.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/assets/js/faq.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/assets/js/scroll.js"></script>
<?php wp_footer(); ?>
</body>

</html>