<?php
/**
 * Site footer.
 *
 * @package ALFASMART
 */

if (! defined('ABSPATH')) {
    exit;
}

$footer_logo = alfasmart_get_option_image_url('footer_logo', 'logo-footer.webp');
$companies   = alfasmart_query_posts_or_fallback('companies', alfasmart_company_items());
$privacy_url = alfasmart_get_option('footer_privacy_page', get_privacy_policy_url() ?: home_url('/privacy/'));
$terms_url   = alfasmart_get_option('footer_terms_page', home_url('/terms/'));
?>
    </main>

    <footer class="as-footer-section">
        <div class="container as-section-container">
            <div class="as-footer-word" aria-hidden="true"><?php echo esc_html(alfasmart_get_option('footer_word', alfasmart_text('EXPERIENCE YOU CAN TRUST', 'خبرة نثق بها'))); ?></div>
            <div class="row as-layout-row as-footer-grid">
                <div class="col-12 col-lg-3 as-footer-brand as-reveal">
                    <img src="<?php echo esc_url($footer_logo); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>">
                    <p><?php echo esc_html(alfasmart_get_option('footer_description', alfasmart_text('A modern corporate presence with premium credibility, strategic depth, and a strong sense of trust.', 'حضور مؤسسي حديث يتمتع بمصداقية عالية وعمق استراتيجي وشعور قوي بالثقة.'))); ?></p>
                </div>

                <nav class="col-12 col-sm-6 col-lg-3 as-footer-nav as-reveal" aria-label="<?php echo esc_attr(alfasmart_text('Main screens', 'الشاشات الرئيسية')); ?>">
                    <h2><?php echo esc_html(alfasmart_get_option('footer_main_title', alfasmart_text('Main screens', 'الشاشات الرئيسية'))); ?></h2>
                    <?php foreach (alfasmart_footer_links() as $link) : ?>
                        <a href="<?php echo esc_url($link['url']); ?>"><?php echo esc_html($link['label']); ?></a>
                    <?php endforeach; ?>
                </nav>

                <nav class="col-12 col-sm-6 col-lg-3 as-footer-nav as-reveal" aria-label="<?php echo esc_attr(alfasmart_text('Our companies', 'شركاتنا')); ?>">
                    <h2><?php echo esc_html(alfasmart_get_option('footer_companies_title', alfasmart_text('Our companies', 'شركاتنا'))); ?></h2>
                    <?php foreach ($companies as $company) : ?>
                        <a href="<?php echo esc_url($company['url']); ?>"><?php echo esc_html($company['title']); ?></a>
                    <?php endforeach; ?>
                </nav>

                <address class="col-12 col-lg-3 as-footer-contact as-reveal">
                    <h2><?php echo esc_html(alfasmart_get_option('footer_contact_title', alfasmart_text('Contact informations', 'معلومات التواصل'))); ?></h2>
                    <a href="tel:<?php echo esc_attr(preg_replace('/\D+/', '', alfasmart_get_option('phone_number', '+971 50 266 3628'))); ?>"><?php echo esc_html(alfasmart_get_option('phone_number', '+971 50 266 3628')); ?></a>
                    <a href="mailto:<?php echo esc_attr(alfasmart_get_option('email_address', 'alphasmart2012@gmail.com')); ?>"><?php echo esc_html(alfasmart_get_option('email_address', 'alphasmart2012@gmail.com')); ?></a>
                    <span><?php echo esc_html(alfasmart_get_option('address', alfasmart_text('Dubai, United Arab Emirates', 'دبي، الإمارات العربية المتحدة'))); ?></span>
                </address>
            </div>
            <div class="as-footer-bottom">
                <p><?php echo esc_html(alfasmart_get_option('copyright_text', alfasmart_text('Copyright © 2026 All Rights Reserved.', 'حقوق النشر © 2026 جميع الحقوق محفوظة.'))); ?></p>
                <div>
                    <a href="<?php echo esc_url($privacy_url); ?>"><?php echo esc_html(alfasmart_get_option('footer_privacy_text', alfasmart_text('Privacy Policy', 'سياسة الخصوصية'))); ?></a>
                    <span>/</span>
                    <a href="<?php echo esc_url($terms_url); ?>"><?php echo esc_html(alfasmart_get_option('footer_terms_text', alfasmart_text('Term & Condition', 'الشروط والأحكام'))); ?></a>
                </div>
            </div>
        </div>
    </footer>
</div>
<?php wp_footer(); ?>
</body>
</html>
