<?php
/**
 * The template for displaying search results pages
 *
 * @package Rosea
 *
 * This file is part of the Rosea WordPress theme.
 *
 * Rosea WordPress Theme, Copyright 2026 nopStation
 * Rosea is distributed under the terms of the GNU General Public License v2 or later.
 *
 * @license GPL-2.0-or-later
 * @license URI: https://www.gnu.org/licenses/gpl-2.0.html
 */

get_header();
?>

<main id="main" role="main">
<!--blog main content-->
<div class="blog-page-container">
	<h1 class="blog-title">
		<?php
		/* translators: %s: search query. */
		printf( esc_html__( 'Search Results for: %s', 'rosea' ), '<span>' . esc_html( get_search_query() ) . '</span>' );
		?>
	</h1>
	
	<div class="blog-content-wrapper">
		<?php get_sidebar(); ?>
		
		<!-- Blog Posts -->
		<div class="blog-posts">
			<?php
			if ( have_posts() ) :
				while ( have_posts() ) :
					the_post();
					?>
					<article class="blog-post">
						<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
						<div class="post-date">— <?php echo esc_html( get_the_date() ); ?></div>
						<div class="post-content">
							<?php the_excerpt(); ?>
						</div>
						<div class="post-meta">
							<a href="<?php comments_link(); ?>"><?php comments_number( 'Comments (0)', 'Comments (1)', 'Comments (%)' ); ?></a>
							<a href="<?php the_permalink(); ?>">Details</a>
						</div>
					</article>
					<?php
				endwhile;
				?>
				
				<!-- Pagination -->
				<div class="blog-pagination">
					<?php
					the_posts_pagination( array(
						'mid_size'  => 2,
						'prev_text' => __( '&laquo; Previous', 'rosea' ),
						'next_text' => __( 'Next &raquo;', 'rosea' ),
					) );
					?>
				</div>
				<?php
			else :
				?>
				<div class="no-posts-found">
					<p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'rosea' ); ?></p>
					<?php get_search_form(); ?>
				</div>
				<?php
			endif;
			?>
		</div>
	</div>
</div>
<!--blog main content-->
</main>

<?php
get_footer();
