<?php
/**
 * The footer template file.
 *
 * Displays the footer and closing HTML tags.
 *
 * @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
 */
?>

<!--footer-->
<footer> 
	<div class="footer-container">
		<div class="advantages-box">
			<div class="container">
				<div class="row">
					<div class="col-md-4 mb-4"> 
						<i class="fas fa-sync-alt float-left pr-2 advantages-icon"></i> 
						<strong class="text-uppercase pt-1 d-block">Daily Updates</strong>  
						<p class="m-0">Fresh content every day</p>
					</div>
					
					<div class="col-md-4 mb-4"> 
						<i class="fas fa-user-tie float-left pr-2 advantages-icon"></i> 
						<strong class="text-uppercase pt-1 d-block">Expert Writers</strong>  
						<p class="m-0">Quality content from experts</p>
					</div>
					
					<div class="col-md-4">
						<i class="fas fa-gift float-left pr-2 advantages-icon"></i> 
						<strong class="text-uppercase pt-1 d-block">Free Resources</strong>  
						<p class="m-0">Access all content for free</p>
					</div>
				</div>
			</div>
		</div>
		
		<div class="footer-link">
			<div class="footer-nav-content">
				<div class="container">
					<div class="row">
						<?php if ( is_active_sidebar( 'footer-1' ) || is_active_sidebar( 'footer-2' ) || is_active_sidebar( 'footer-3' ) ) : ?>
							<?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
								<div class="col-md-4">
									<?php dynamic_sidebar( 'footer-1' ); ?>
								</div>
							<?php endif; ?>
							
							<?php if ( is_active_sidebar( 'footer-2' ) ) : ?>
								<div class="col-md-4">
									<?php dynamic_sidebar( 'footer-2' ); ?>
								</div>
							<?php endif; ?>
							
							<?php if ( is_active_sidebar( 'footer-3' ) ) : ?>
								<div class="col-md-4">
									<?php dynamic_sidebar( 'footer-3' ); ?>
								</div>
							<?php endif; ?>
						<?php else : ?>
							<!-- Default Footer Content -->
							<div class="col-md-4">
								<div class="footer-nav-header">
									<h5 class="text-uppercase font-weight-bold">Information</h5>
									<?php
									wp_nav_menu( array(
										'theme_location' => 'footer',
										'menu_class'     => 'list-unstyled',
										'container'      => false,
										'fallback_cb'    => false,
									) );
									?>
								</div>
							</div>
							
							<div class="col-md-4">
								<div class="footer-nav-header">
									<h5 class="text-uppercase font-weight-bold">Blog Categories</h5>
									<ul>
										<?php
										$categories = get_categories( array( 'number' => 5 ) );
										foreach ( $categories as $category ) {
											echo '<li><a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</a></li>';
										}
										?>
									</ul>
								</div>
							</div>
							
							<div class="col-md-4">
								<div class="footer-nav-header">
									<h5 class="text-uppercase font-weight-bold">Quick Links</h5>
									<ul>
										<li><a href="<?php echo esc_url( home_url( '/' ) ); ?>">All Posts</a></li>
										<li><a href="<?php echo esc_url( get_permalink( get_option( 'page_for_posts' ) ) ); ?>">Blog</a></li>
										<li><a href="<?php echo esc_url( home_url( '/?s=' ) ); ?>">Search</a></li>
									</ul>
								</div>
							</div>
						<?php endif; ?>
					</div>
				</div>
			</div>
		</div>
		
		<div class="copyright-container p-3">
    <div class="container">
        <div class="row">
            <div class="col-12">
             <div class="copyright-text text-center">
    &copy; <?php echo esc_html( current_time( 'Y' ) ); ?> 
    <?php
	/* Removed external credit link per theme customization request */
	echo esc_html__( 'Rosea WordPress Theme', 'rosea' );
    ?>
</div>
            </div>
        </div>
    </div>
</div>
	</div>
</footer>
<!--footer-->

</div>

<a href="#" class="scrollup border-0"><i class="fas fa-angle-up" aria-hidden="true"></i><span class="screen-reader-text"><?php esc_html_e( 'Scroll to top', 'rosea' ); ?></span></a>

<?php wp_footer(); ?>

</body>
</html>
