<?php
/**
 * Template Name: Contact Luxury
 *
 * Template pour la page Contact avec design luxury
 *
 * @package ChaletMontagne
 * @since 1.0.0
 */

get_header();
?>

<main id="primary" class="site-main luxury-contact" tabindex="-1">

    <?php while (have_posts()) : the_post(); ?>

        <!-- Page Hero -->
        <section class="luxury-page-hero luxury-page-hero-small">
            <?php if (has_post_thumbnail()) : ?>
                <div class="luxury-page-hero-background" style="background-image: url(<?php echo esc_url(get_the_post_thumbnail_url(null, 'full')); ?>);"></div>
                <div class="luxury-page-hero-overlay"></div>
            <?php endif; ?>
            <div class="luxury-container">
                <div class="luxury-page-hero-content">
                    <?php if (function_exists('chaletmontagne_breadcrumbs') && get_theme_mod('chaletmontagne_show_breadcrumbs', true)) : ?>
                        <div class="luxury-breadcrumbs">
                            <?php chaletmontagne_breadcrumbs(); ?>
                        </div>
                    <?php endif; ?>
                    <h1 class="luxury-page-title"><?php the_title(); ?></h1>
                    <p class="luxury-page-subtitle">
                        <?php esc_html_e('Notre équipe est à votre écoute pour répondre à toutes vos questions', 'chalet-montagne'); ?>
                    </p>
                </div>
            </div>
        </section>

        <!-- Contact Info Cards -->
        <section class="luxury-section">
            <div class="luxury-container">
                <?php
                $phone = get_theme_mod('chaletmontagne_phone');
                $email = get_theme_mod('chaletmontagne_email');
                $address = get_theme_mod('chaletmontagne_address');
                $hours = get_theme_mod('chaletmontagne_hours');

                if ($phone || $email || $address || $hours) :
                ?>
                <div class="luxury-contact-cards">
                    <?php if ($phone) : ?>
                        <div class="luxury-card luxury-card-centered luxury-card-contact">
                            <div class="luxury-card-icon luxury-card-icon-large">📞</div>
                            <div class="luxury-card-content">
                                <h3 class="luxury-card-title"><?php esc_html_e('Téléphone', 'chalet-montagne'); ?></h3>
                                <p class="luxury-card-text">
                                    <a href="tel:<?php echo esc_attr(str_replace(' ', '', $phone)); ?>" class="luxury-contact-link">
                                        <?php echo esc_html($phone); ?>
                                    </a>
                                </p>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if ($email) : ?>
                        <div class="luxury-card luxury-card-centered luxury-card-contact">
                            <div class="luxury-card-icon luxury-card-icon-large">✉️</div>
                            <div class="luxury-card-content">
                                <h3 class="luxury-card-title"><?php esc_html_e('Email', 'chalet-montagne'); ?></h3>
                                <p class="luxury-card-text">
                                    <a href="mailto:<?php echo esc_attr($email); ?>" class="luxury-contact-link">
                                        <?php echo esc_html($email); ?>
                                    </a>
                                </p>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if ($address) : ?>
                        <div class="luxury-card luxury-card-centered luxury-card-contact">
                            <div class="luxury-card-icon luxury-card-icon-large">📍</div>
                            <div class="luxury-card-content">
                                <h3 class="luxury-card-title"><?php esc_html_e('Adresse', 'chalet-montagne'); ?></h3>
                                <p class="luxury-card-text"><?php echo nl2br(esc_html($address)); ?></p>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if ($hours) : ?>
                        <div class="luxury-card luxury-card-centered luxury-card-contact">
                            <div class="luxury-card-icon luxury-card-icon-large">🕐</div>
                            <div class="luxury-card-content">
                                <h3 class="luxury-card-title"><?php esc_html_e('Horaires', 'chalet-montagne'); ?></h3>
                                <p class="luxury-card-text"><?php echo nl2br(esc_html($hours)); ?></p>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
                <?php endif; ?>
            </div>
        </section>

        <!-- Formulaire de contact -->
        <section class="luxury-section luxury-section-alt">
            <div class="luxury-container luxury-container-narrow">
                <div class="luxury-section-header">
                    <div class="luxury-section-subtitle"><?php esc_html_e('Envoyez-nous un message', 'chalet-montagne'); ?></div>
                    <h2 class="luxury-section-title"><?php esc_html_e('Nous Contacter', 'chalet-montagne'); ?></h2>
                </div>

                <div class="luxury-contact-form">
                    <?php
                    // Afficher le contenu de la page (shortcode de formulaire du plugin ou contenu éditeur)
                    the_content();
                    ?>
                </div>
            </div>
        </section>

        <!-- Réseaux sociaux -->
        <?php
        $social_networks = array('facebook', 'instagram', 'twitter', 'youtube', 'chalet-montagne', 'airbnb', 'booking');
        $has_social = false;
        foreach ($social_networks as $network) {
            if (get_theme_mod("chaletmontagne_social_{$network}")) {
                $has_social = true;
                break;
            }
        }

        if ($has_social) :
        ?>
        <section class="luxury-section luxury-social-section">
            <div class="luxury-container">
                <div class="luxury-section-header">
                    <div class="luxury-section-subtitle"><?php esc_html_e('Suivez-nous', 'chalet-montagne'); ?></div>
                    <h2 class="luxury-section-title"><?php esc_html_e('Restez Connectés', 'chalet-montagne'); ?></h2>
                    <p class="luxury-section-description">
                        <?php esc_html_e('Retrouvez-nous sur les réseaux sociaux pour découvrir nos actualités et inspirations montagne', 'chalet-montagne'); ?>
                    </p>
                </div>

                <div class="luxury-social-links-large">
                    <?php chaletmontagne_social_links(); ?>
                </div>
            </div>
        </section>
        <?php endif; ?>

    <?php endwhile; ?>

</main>

<?php
get_footer();
