<?php
/**
 * HVAC Public Page Template
 * 
 * Template for public pages without navigation (login, find trainer)
 * 
 * @package HVAC_Community_Events
 * @since 2.0.0
 */

// Define constant to indicate we are in a page template
define('HVAC_IN_PAGE_TEMPLATE', true);

// Security check
if (!defined('ABSPATH')) {
    exit;
}

get_header();

// Determine page type from slug
$page_slug = get_post_field('post_name', get_queried_object_id());
$page_type = 'default';

if (strpos($page_slug, 'community-login') !== false || strpos($page_slug, 'training-login') !== false) {
    $page_type = 'login';
} elseif (strpos($page_slug, 'find-a-trainer') !== false) {
    $page_type = 'find_trainer';
}
?>

<div class="hvac-page-wrapper hvac-public-page hvac-public-<?php echo esc_attr($page_type); ?>">
    <!-- No navigation for public pages -->
    
    <div class="container">
        <?php
        // Load status messages
        get_template_part('templates/parts/hvac-status-messages');
        
        // Load content based on page type
        switch ($page_type) {
            case 'login':
                echo do_shortcode('[hvac_community_login]');
                break;
                
            case 'find_trainer':
                echo do_shortcode('[hvac_find_trainer]');
                break;
                
            default:
                // Auto-generate shortcode from page slug
                $shortcode = '[hvac_' . str_replace(['/', '-'], '_', $page_slug) . ']';
                echo do_shortcode($shortcode);
                break;
        }
        ?>
    </div>
</div>

<style>
.hvac-public-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.hvac-public-login .container {
    max-width: 500px;
    margin: 60px auto;
}
</style>

<?php get_footer(); ?>