<?php get_header(); ?>
<?php include get_template_directory() . '/inc/menus/menu.php'; ?>

<main role="main">
    <section class="breadcrumb-section" style="background-image: url('<?php echo get_theme_file_uri('/images/search-background.jpg'); ?>'); background-size: cover;">
        <div class="overlay"></div>
        <div class="container">
            <div class="row">
                <div class="col-md-12 col-sm-12">
                    <h1 class="entry-title">Search Results for: <?php echo esc_html(get_search_query()); ?></h1>
                </div><!-- Title -->
            </div><!-- row -->
        </div><!-- container -->
    </section><!-- Breadcrumb Section -->

    <section class="content-area search-results">
        <div class="container">
            <div class="row">
                <!-- Main Content Column -->
                <div class="col-lg-8 col-md-8 col-sm-8">
                    <?php if (have_posts()): ?>
                        <div class="search-results-list">
                            <?php while (have_posts()): the_post(); ?>
                                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                                    <!-- Post Thumbnail -->
                                    <div class="post-thumbnail">
                                        <?php if (has_post_thumbnail()): ?>
                                            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
                                        <?php endif; ?>
                                    </div>
                                    <!-- Post Thumbnail -->
                                    
                                    <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                                    <div class="excerpt"><?php the_excerpt(); ?></div>
                                </article>
                            <?php endwhile; ?>

                            <!-- Pagination -->
                            <div class="pagination">
                                <?php the_posts_pagination(array(
                                    'mid_size' => 2,
                                    'prev_text' => __('« Previous', 'kipya'),
                                    'next_text' => __('Next »', 'kipya'),
                                )); ?>
                            </div>
                        </div>
                    <?php else: ?>
                        <article>
                            <h2><?php _e('Sorry, no results found.', 'kipya'); ?></h2>
                        </article>
                    <?php endif; ?>
                </div>

                <!-- Sidebar Column -->
                <div class="col-lg-4 col-md-4 col-sm-4">
                    <div class="sidebar">
                        <h2>Recent Posts</h2>
                        <?php include get_template_directory() . '/inc/recent-posts.php'; ?>
                    </div>
                </div>
            </div><!-- row -->
        </div><!-- container -->
    </section><!-- section -->
</main>

<?php get_footer(); ?>
