<?php
/**
 * Site footer for the Trial home design and clean inner pages.
 *
 * @package Shabnam_MuchWOW
 */

defined( 'ABSPATH' ) || exit;

$shabnam_footer_title       = function_exists( 'shabnam_get_setting' ) ? shabnam_get_setting( 'footer_title', 'به جامعه پرانرژی ما بپیوندید! 🌟' ) : 'به جامعه پرانرژی ما بپیوندید! 🌟';
$shabnam_footer_cta_url     = function_exists( 'shabnam_get_setting' ) ? shabnam_get_setting( 'header_cta_url', shabnam_contact_url() ) : shabnam_contact_url();
$shabnam_footer_cta_text    = function_exists( 'shabnam_get_setting' ) ? shabnam_get_setting( 'header_cta_text', 'به ما بپیوندید' ) : 'به ما بپیوندید';
$shabnam_footer_description = function_exists( 'shabnam_get_setting' ) ? shabnam_get_setting( 'footer_description', '' ) : '';
$shabnam_copyright_text     = function_exists( 'shabnam_get_setting' ) ? shabnam_get_setting( 'copyright_text', '' ) : '';
$shabnam_footer_demo        = function_exists( 'shabnam_muchwow_selected_demo' ) ? shabnam_muchwow_selected_demo() : 'one';
// The original sign-in/contact/legal pages use the clean ft-tertiary footer regardless of the selected home demo.
if ( function_exists( 'shabnam_muchwow_get_page_id' ) ) {
	foreach ( array( 'sign-in', 'sign-up', 'reset-password', 'contact', 'privacy', 'terms' ) as $shabnam_inner_key ) {
		$shabnam_inner_id = shabnam_muchwow_get_page_id( $shabnam_inner_key );
		if ( $shabnam_inner_id && is_page( $shabnam_inner_id ) ) {
			$shabnam_footer_demo = 'three';
			break;
		}
	}
}
$shabnam_copyright          = $shabnam_copyright_text ? $shabnam_copyright_text : sprintf( '%1$s © %2$s', get_bloginfo( 'name' ), wp_date( 'Y' ) );

$shabnam_socials = array(
	array( 'instagram_url', 'instagram.svg', 'اینستاگرام' ),
	array( 'bale_url', 'bale.svg', 'بله' ),
	array( 'eitaa_url', 'eitaa.svg', 'ایتا' ),
	array( 'aparat_url', 'aparat.svg', 'آپارات' ),
	array( 'facebook_url', 'facebook.svg', 'فیسبوک' ),
	array( 'twitter_url', 'twitter.svg', 'ایکس' ),
	array( 'youtube_url', 'youtube.svg', 'یوتیوب' ),
	array( 'medium_url', 'medium.svg', 'مدیوم' ),
);
$shabnam_enabled_socials = array();
foreach ( $shabnam_socials as $shabnam_social ) {
	$shabnam_social_url = function_exists( 'shabnam_get_setting' ) ? shabnam_get_setting( $shabnam_social[0], '' ) : '';
	if ( $shabnam_social_url ) {
		$shabnam_social[3]       = $shabnam_social_url;
		$shabnam_enabled_socials[] = $shabnam_social;
	}
}

/* Clean light footer used by authentication, contact and legal inner pages. */
if ( 'three' === $shabnam_footer_demo ) :
	?>
	<footer class="uc-footer panel overflow-hidden text-black ft-tertiary shabnam-footer-demo-three" id="uc-footer">
		<div class="footer-outer py-4 lg:py-6 xl:pt-10 xl:pb-9 bg-white"><div class="uc-footer-content"><div class="container"><div class="uc-footer-inner vstack gap-4 lg:gap-6 xl:gap-8">
			<div class="uc-footer-widgets panel"><div class="row g-6 lg:g-8 xl:g-10">
				<div class="col-12 lg:col-4"><div class="panel vstack items-start gap-3 xl:gap-4"><div><a class="shabnam-site-logo" href="<?php echo esc_url( home_url( '/' ) ); ?>" style="width:140px"><?php $shabnam_logo = function_exists( 'shabnam_framework_logo_url' ) ? shabnam_framework_logo_url() : ''; ?><?php if ( $shabnam_logo ) : ?><img alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" src="<?php echo esc_url( $shabnam_logo ); ?>"><?php else : ?><img alt="MuchWOW" src="<?php echo esc_url( shabnam_asset_uri( 'images/logo-light.svg' ) ); ?>"><?php endif; ?></a><?php if ( $shabnam_footer_description ) : ?><p class="fs-6 mt-2 fw-medium"><?php echo esc_html( $shabnam_footer_description ); ?></p><?php endif; ?><?php if ( $shabnam_enabled_socials ) : ?><ul class="nav-x gap-2 mt-4 flex-wrap"><?php foreach ( $shabnam_enabled_socials as $shabnam_social ) : ?><li><a class="shabnam-social-link shabnam-social-<?php echo esc_attr( sanitize_html_class( str_replace( '_url', '', $shabnam_social[0] ) ) ); ?> w-40px hover:-rotate-3" href="<?php echo esc_url( $shabnam_social[3] ); ?>" rel="me noopener" target="_blank"><img alt="<?php echo esc_attr( $shabnam_social[2] ); ?>" src="<?php echo esc_url( shabnam_asset_uri( 'images/common/' . $shabnam_social[1] ) ); ?>"></a></li><?php endforeach; ?></ul><?php endif; ?></div></div></div>
				<div class="lg:col"><div class="panel"><div class="row child-cols-6 lg:child-cols-3 g-4">
					<div><ul class="nav-y gap-2 fw-bold fs-6"><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( home_url( '/#about' ) ); ?>">درباره ما</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( home_url( '/#features' ) ); ?>">ویژگی‌ها</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( home_url( '/#roadmap' ) ); ?>">نقشه راه</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( home_url( '/#tokenomics' ) ); ?>">اقتصاد توکن</a></li></ul></div>
					<div><ul class="nav-y gap-2 fw-bold fs-6"><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( function_exists( 'wc_get_page_permalink' ) ? wc_get_page_permalink( 'shop' ) : home_url( '/' ) ); ?>">فروشگاه</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( shabnam_muchwow_page_url( 'contact' ) ); ?>">تماس با ما</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( shabnam_blog_url() ); ?>">وبلاگ</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( shabnam_muchwow_page_url( 'sign-in' ) ); ?>">ورود</a></li></ul></div>
					<div><ul class="nav-y gap-2 fw-bold fs-6"><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( shabnam_muchwow_page_url( 'sign-up' ) ); ?>">ثبت‌نام</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( shabnam_muchwow_page_url( 'privacy' ) ); ?>">حریم خصوصی</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="<?php echo esc_url( shabnam_muchwow_page_url( 'terms' ) ); ?>">شرایط استفاده</a></li><li><a class="pb-narrow border-bottom border-gray-200" href="https://shabnam.dev/" rel="noopener" target="_blank">توسعه‌دهنده</a></li></ul></div>
				</div></div></div>
			</div></div>
			<div class="uc-footer-bottom panel vstack sm:hstack gap-2 justify-between items-center text-center pt-4 border-top"><p><?php echo esc_html( $shabnam_copyright ); ?> — <a href="https://shabnam.dev/" rel="author noopener" target="_blank"><?php esc_html_e( 'توسعه ارتباطات شبنم', 'shabnam-muchwow' ); ?></a></p><ul class="nav-x gap-1"><li><a href="<?php echo esc_url( shabnam_muchwow_page_url( 'privacy' ) ); ?>">سیاست حریم خصوصی</a></li><li class="mx-2 lg:mx-3"><a href="<?php echo esc_url( shabnam_muchwow_page_url( 'terms' ) ); ?>">شرایط استفاده</a></li></ul></div>
		</div></div></div></div>
	</footer>
	<?php
/* Demo one: preserve the original card-based community footer, with dynamic social networks. */
else :
	?>
	<footer class="uc-footer panel overflow-hidden shabnam-footer-demo-one" id="uc-footer">
		<div class="footer-outer pt-6 lg:pt-9 xl:pt-10"><img alt="" class="position-absolute top-0 start-0 w-full" src="<?php echo esc_url( shabnam_asset_uri( 'images/common/star.svg' ) ); ?>"><div class="container sm:max-w-md xl:max-w-lg"><div class="footer-inner vstack items-center gap-4 sm:gap-6 xl:gap-8 text-center" data-anime="onview: -300; targets: >*; translateY: [24, 0]; opacity: [0, 1]; delay: anime.stagger(100, {start: 200});">
			<div class="footer-title"><div class="category"><div class="-rotate-2"><span class="fs-5 xl:fs-4 text-secondary fw-bold"><?php esc_html_e( 'ما را دنبال کنید!', 'shabnam-muchwow' ); ?></span></div></div><h2 class="title h4 sm:h3 xl:h2 mb-0 mt-2 text-white text-uppercase ls-0 rotate-1"><?php echo esc_html( $shabnam_footer_title ); ?></h2><?php if ( $shabnam_footer_description ) : ?><p class="fs-5 mt-2 text-white text-opacity-70 sm:max-w-700px mx-auto"><?php echo esc_html( $shabnam_footer_description ); ?></p><?php endif; ?></div>
			<div class="footer-button"><a class="btn btn-md sm:btn-xl xl:btn-2xl px-4 xl:px-6 border border-3 border-black bg-gradient-45n from-secondary to-tertiary contrast-shadow -rotate-2 hover:rotate-0" href="<?php echo esc_url( $shabnam_footer_cta_url ); ?>" style="--shadowColor:var(--color-secondary)"><span class="text-black"><?php echo esc_html( $shabnam_footer_cta_text ); ?></span><span class="fs-4 mb-narrow">🚀</span></a></div>
			<?php if ( $shabnam_enabled_socials ) : ?><div class="footer-media w-full"><ul class="shabnam-social-grid"><?php foreach ( $shabnam_enabled_socials as $shabnam_index => $shabnam_social ) : $shabnam_rotation = 0 === $shabnam_index % 2 ? 'rotate-1' : '-rotate-1'; ?><li><div class="shabnam-social-card shabnam-social-<?php echo esc_attr( sanitize_html_class( str_replace( '_url', '', $shabnam_social[0] ) ) ); ?> vstack gap-2 p-4 sm:p-5 border border-1 border-gray-100 border-opacity-40 rounded-3 <?php echo esc_attr( $shabnam_rotation ); ?>"><a class="shabnam-social-link hover:-rotate-3" href="<?php echo esc_url( $shabnam_social[3] ); ?>" rel="me noopener" target="_blank"><img alt="<?php echo esc_attr( $shabnam_social[2] ); ?>" src="<?php echo esc_url( shabnam_asset_uri( 'images/common/' . $shabnam_social[1] ) ); ?>"></a><span><?php echo esc_html( $shabnam_social[2] ); ?></span></div></li><?php endforeach; ?></ul></div><?php endif; ?>
			<div class="footer-menu"><?php wp_nav_menu( array( 'theme_location' => 'footer', 'container' => false, 'menu_class' => 'nav-x gap-0 row child-cols-auto justify-center gx-4 gy-2 lg:g-4 fs-5 xl:fs-4', 'fallback_cb' => 'shabnam_footer_menu_fallback', 'depth' => 1 ) ); ?></div>
			<div class="footer-copyright"><p><?php echo esc_html( $shabnam_copyright ); ?> — <a href="https://shabnam.dev/" rel="author noopener" target="_blank"><?php esc_html_e( 'توسعه ارتباطات شبنم', 'shabnam-muchwow' ); ?></a></p></div><div class="footer-image"><img alt="" src="<?php echo esc_url( shabnam_asset_uri( 'images/home-one/03.svg' ) ); ?>"></div>
		</div></div></div>
	</footer>
	<?php
endif;
?>
</div><!-- #shabnam-spa-content -->
<?php
wp_footer();
?>
</body>
</html>
