<?php
/**
 * Simple & Clean Footer Template
 *
 * @package Hello_Elementor_Child
 * @version 2.2.0
 */

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

$phone         = function_exists( 'dab_get_phone' ) ? dab_get_phone() : '09121390683';
$phone_display = function_exists( 'dab_get_phone_display' ) ? dab_get_phone_display() : '۰۹۱۲-۱۳۹-۰۶۸۳';
$email         = function_exists( 'dab_get_email' ) ? dab_get_email() : 'info@dashtabady.ir';
$hours         = function_exists( 'dab_get_hours' ) ? dab_get_hours() : 'شنبه تا پنجشنبه ۸ الی ۱۸';
$instagram     = function_exists( 'dab_get_social' ) ? dab_get_social( 'instagram' ) : '';
$telegram      = function_exists( 'dab_get_social' ) ? dab_get_social( 'telegram' ) : '';
$whatsapp      = function_exists( 'dab_get_social' ) ? dab_get_social( 'whatsapp' ) : '';
$logo_url      = function_exists( 'dab_get_logo_url' ) ? dab_get_logo_url() : '';
$site_name     = get_bloginfo( 'name' );
$home          = esc_url( home_url( '/' ) );
$persian_year  = wp_date( 'Y' );
?>

<footer class="ftr" role="contentinfo">

    <div class="ftr-container">

        <div class="ftr-grid">

            <!-- About -->
            <div class="ftr-col ftr-col-about">
                <a href="<?php echo $home; ?>" class="ftr-logo">
                    <?php if ( $logo_url ) : ?>
                    <div class="ftr-logo-img">
                        <img src="<?php echo esc_url( $logo_url ); ?>" alt="<?php echo esc_attr( $site_name ); ?>">
                    </div>
                    <?php endif; ?>
                    <span class="ftr-logo-name"><?php echo esc_html( $site_name ); ?></span>
                </a>

                <p class="ftr-about"><?php echo esc_html( dab_footer_get_about() ); ?></p>

                <div class="ftr-socials">
                    <?php if ( $instagram ) : ?>
                    <a href="<?php echo esc_url( $instagram ); ?>" target="_blank" rel="noopener" aria-label="Instagram">
                        <svg viewBox="0 0 24 24" fill="currentColor"><path d="M7 2h10a5 5 0 015 5v10a5 5 0 01-5 5H7a5 5 0 01-5-5V7a5 5 0 015-5zm0 2.2A2.8 2.8 0 004.2 7v10A2.8 2.8 0 007 19.8h10a2.8 2.8 0 002.8-2.8V7A2.8 2.8 0 0017 4.2H7zm10.25 1.45a1.05 1.05 0 110 2.1 1.05 1.05 0 010-2.1zM12 7a5 5 0 110 10 5 5 0 010-10zm0 2.2A2.8 2.8 0 1012 14.8 2.8 2.8 0 0012 9.2z"/></svg>
                    </a>
                    <?php endif; ?>
                    <?php if ( $telegram ) : ?>
                    <a href="<?php echo esc_url( $telegram ); ?>" target="_blank" rel="noopener" aria-label="Telegram">
                        <svg viewBox="0 0 24 24" fill="currentColor"><path d="M21.9 4.6L18.8 19c-.2 1-.8 1.2-1.6.8l-4.6-3.4-2.2 2.1c-.2.2-.4.4-.8.4l.3-4.8 8.8-8c.4-.3-.1-.5-.5-.2l-10.9 6.9-4.7-1.5c-1-.3-1-1 .2-1.4L20 3.3c.8-.3 1.5.2 1.2 1.3z"/></svg>
                    </a>
                    <?php endif; ?>
                    <?php if ( $whatsapp ) : ?>
                    <a href="<?php echo esc_url( $whatsapp ); ?>" target="_blank" rel="noopener" aria-label="WhatsApp">
                        <svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.5 3.5A11.4 11.4 0 002.9 17.2L1.5 22.5l5.4-1.4a11.4 11.4 0 005.4 1.4h.1A11.4 11.4 0 0020.5 3.5zM12.4 20.4h-.1a9.2 9.2 0 01-4.7-1.3l-.3-.2-3.2.8.9-3.1-.2-.3a9.2 9.2 0 117.6 4.1z"/></svg>
                    </a>
                    <?php endif; ?>
                </div>
            </div>

            <!-- Menu 1 -->
            <?php dab_render_footer_menu( 'footer-menu-1', 'دسترسی سریع' ); ?>

            <!-- Menu 2 -->
            <?php dab_render_footer_menu( 'footer-menu-2', 'محصولات' ); ?>

            <!-- Contact -->
            <div class="ftr-col ftr-col-contact">
                <h4 class="ftr-title">تماس با ما</h4>

                <ul class="ftr-contacts">
                    <li>
                        <span class="ftr-contact-icon">
                            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0122 16.92z"/></svg>
                        </span>
                        <a href="tel:+98<?php echo esc_attr( $phone ); ?>"><?php echo esc_html( $phone_display ); ?></a>
                    </li>
                    <li>
                        <span class="ftr-contact-icon">
                            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>
                        </span>
                        <a href="mailto:<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></a>
                    </li>
                    <li>
                        <span class="ftr-contact-icon">
                            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg>
                        </span>
                        <span><?php echo esc_html( dab_footer_get_address() ); ?></span>
                    </li>
                    <li>
                        <span class="ftr-contact-icon">
                            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
                        </span>
                        <span><?php echo esc_html( $hours ); ?></span>
                    </li>
                </ul>
            </div>

        </div>

        <!-- ─── Bottom Bar ─── -->
        <div class="ftr-bottom">
            <div class="ftr-copyright">
                <span>© <?php echo esc_html( $persian_year ); ?> - <?php echo esc_html( dab_footer_get_copyright() ); ?></span>
            </div>
            <?php dab_render_footer_bottom_menu(); ?>
        </div>

    </div>

    <!-- Scroll to top -->
    <button class="ftr-top" id="ftrScrollTop" aria-label="بازگشت به بالا">
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
            <polyline points="18 15 12 9 6 15"/>
        </svg>
    </button>

</footer>

<?php 
// رندر دکمه شناور (5 آیتم)
dab_render_float_button();
?>

<?php wp_footer(); ?>
</body>
</html>