<?php
/**
 * Contact section.
 *
 * @package ALFASMART
 */

$is_contact_page = alfasmart_is_translated_page('contact');
$field_getter = is_front_page() ? 'alfasmart_get_home_field' : 'alfasmart_get_field';
?>
<section class="as-contact-section<?php echo $is_contact_page ? ' as-contact-page-section' : ''; ?>" id="contact" aria-labelledby="<?php echo $is_contact_page ? 'as-contact-page-title' : 'as-contact-title'; ?>">
    <?php if ($is_contact_page) : ?>
        <div class="video-shape" aria-hidden="true">
            <video class="as-inner-hero-video" src="<?php echo esc_url(alfasmart_img('breadcrumb.mp4')); ?>" autoplay muted loop playsinline></video>
        </div>
    <?php endif; ?>
    <div class="container as-section-container">
        <div class="row as-layout-row as-contact-grid">
            <div class="col-12 col-lg-6 as-contact-info as-reveal">
                <p class="as-section-kicker"><?php echo esc_html($field_getter('contact_kicker', 'Contact Us')); ?></p>
                <?php if ($is_contact_page) : ?>
                    <h1 class="as-section-heading" id="as-contact-page-title"><?php echo esc_html($field_getter('contact_title', 'Let\'s start the conversation.')); ?></h1>
                <?php else : ?>
                    <h2 class="as-section-heading" id="as-contact-title"><?php echo esc_html($field_getter('contact_title', 'Let\'s start the conversation.')); ?></h2>
                <?php endif; ?>
                <p><?php echo esc_html($field_getter('contact_description', 'Connect with ALPHA Smart to discuss partnerships, trading opportunities, or business inquiries.')); ?></p>
                <h3><?php echo esc_html(alfasmart_text('Contact Information', 'معلومات التواصل')); ?></h3>
                <dl>
                    <dt><?php echo esc_html(alfasmart_text('Location', 'الموقع')); ?></dt>
                    <dd><?php echo esc_html(alfasmart_text(alfasmart_get_option('address', 'Dubai, United Arab Emirates'), 'دبي، الإمارات العربية المتحدة')); ?></dd>
                    <dt><?php echo esc_html(alfasmart_text('Phone', 'الهاتف')); ?></dt>
                    <dd><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></dd>
                    <dt><?php echo esc_html(alfasmart_text('Email', 'البريد الإلكتروني')); ?></dt>
                    <dd><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></dd>
                </dl>
            </div>
            <div class="col-12 col-lg-6">
                <?php $shortcode = $field_getter('contact_form_shortcode'); ?>
                <?php if ($shortcode) : ?>
                    <?php echo do_shortcode($shortcode); ?>
                <?php else : ?>
                    <form class="as-contact-form as-reveal" action="#" method="post" autocomplete="on">
                        <div class="row as-form-row">
                            <label class="col-12 col-md-6">Full Name *<input type="text" name="name" autocomplete="name" required></label>
                            <label class="col-12 col-md-6">Email Address *<input type="email" name="email" autocomplete="email" required></label>
                        </div>
                        <div class="row as-form-row">
                            <label class="col-12 col-md-6">Phone Number<input type="tel" name="phone" autocomplete="tel"></label>
                            <label class="col-12 col-md-6">Company Name<input type="text" name="company" autocomplete="organization"></label>
                        </div>
                        <label>Message *<textarea name="message" autocomplete="off" required></textarea></label>
                        <button class="as-primary-button as-form-button as-magnetic" type="submit">Send Message</button>
                    </form>
                <?php endif; ?>
            </div>
        </div>
    </div>
</section>
