<?php
/**
 * The main template file
 *
 * @package Theme_An_Phat
 */

get_header(); ?>

<main id="primary" class="site-main py-5 bg-light">
    <div class="container py-4">
        <?php if ( have_posts() ) : ?>
            <header class="page-header mb-5 text-center">
                <h1 class="page-title font-heading text-dark fw-bold"><?php single_post_title(); ?></h1>
            </header>

            <div class="row g-4">
                <?php while ( have_posts() ) : the_post(); ?>
                    <article id="post-<?php the_ID(); ?>" <?php post_class('col-md-8 mx-auto bg-white p-4 rounded shadow-sm'); ?>>
                        <div class="entry-content text-dark">
                            <?php the_content(); ?>
                        </div>
                    </article>
                <?php endwhile; ?>
            </div>

            <?php the_posts_navigation(); ?>
        <?php else : ?>
            <div class="no-results text-center py-5">
                <h2 class="font-heading text-dark"><?php esc_html_e( 'Không tìm thấy nội dung', 'theme-anphat' ); ?></h2>
                <p class="text-muted mt-2"><?php esc_html_e( 'Nội dung bạn yêu cầu hiện không tồn tại hoặc đã được di chuyển.', 'theme-anphat' ); ?></p>
                <a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="btn btn-primary mt-4"><?php esc_html_e( 'Về Trang Chủ', 'theme-anphat' ); ?></a>
            </div>
        <?php endif; ?>
    </div>
</main>

<?php get_footer(); ?>
