<?php
global $k, $courses, $cartcount, $user_ID, $user_identity;
$current_user = wp_get_current_user();
$user_instructor = get_field('user_membership', 'user_' . $current_user->ID) == 'instructor';
$user_member = get_field('user_membership', 'user_' . $current_user->ID) == 'member';
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>
        prefix="og: http://ogp.me/ns#">
    <head>
        <?php wp_head(); ?>
    </head>
<body <?php body_class(''); ?> >






<?php   if (is_home()) :    ?>


    <!-- Start of Manus Pro Loader Code -->
    <div id="manus-pro-loader-wrapper">
        <div class="manus-pro-loader-glow"></div>
        <div class="manus-pro-loader-container">
            <div class="manus-pro-loader-circles">
                <div class="manus-pro-loader-circle"></div>
                <div class="manus-pro-loader-circle"></div>
                <div class="manus-pro-loader-circle"></div>
                <div class="manus-pro-loader-book-icon">📚</div>
            </div>

            <div class="manus-pro-loader-text">
                <?php _e("<!--:en-->Loading<span class=\"manus-pro-loader-dots\"><span>.</span><span>.</span><span>.</span></span><!--:--><!--:ar-->جاري التحميل<span class=\"manus-pro-loader-dots\"><span>.</span><span>.</span><span>.</span></span><!--:-->"); ?>
            </div>

            <div class="manus-pro-loader-subtext">
                <?php _e("<!--:en-->Please wait a moment<!--:--><!--:ar-->يرجى الانتظار قليلاً<!--:-->"); ?>
            </div>

            <div class="manus-pro-loader-progress-bar">
                <div class="manus-pro-loader-progress-fill"></div>
            </div>
        </div>

        <!-- Particles (No text content, no changes needed) -->
        <div class="manus-pro-loader-particle" style="top: 20%; left: 10%; animation-delay: 0s;"></div>
        <div class="manus-pro-loader-particle" style="top: 40%; left: 80%; animation-delay: 0.5s;"></div>
        <div class="manus-pro-loader-particle" style="top: 60%; left: 20%; animation-delay: 1s;"></div>
        <div class="manus-pro-loader-particle" style="top: 80%; left: 70%; animation-delay: 1.5s;"></div>
        <div class="manus-pro-loader-particle" style="top: 30%; left: 50%; animation-delay: 2s;"></div>
        <div class="manus-pro-loader-particle" style="top: 70%; left: 40%; animation-delay: 2.5s;"></div>
    </div>
    <!-- End of Manus Pro Loader Code -->
<?php   endif; ?>








<div class="fixed-icons">
    <a href="https://wa.me/<?php the_field("whatsapp","option") ?>" target="_blank"><svg width="52" height="52" viewBox="0 0 52 52" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M25.7755 51.5501C21.2639 51.5501 16.8388 50.3568 12.9195 48.0906L2.87708 51.5501L4.94128 40.9163C1.7056 36.482 0 31.2659 0 25.7755C0 11.5626 11.5631 0 25.7755 0C39.9898 0 51.5515 11.5626 51.5515 25.7755C51.5515 39.9875 39.9898 51.5501 25.7755 51.5501Z" fill="#32BA46"/>
            <path d="M25.7753 42.6143C22.8283 42.6143 19.9372 41.8341 17.3771 40.3535L10.8165 42.6143L12.1642 35.6666C10.051 32.7695 8.93652 29.3624 8.93652 25.7748C8.93652 16.4899 16.4904 8.93604 25.7753 8.93604C35.061 8.93604 42.6148 16.4899 42.6148 25.7748C42.6148 35.0603 35.061 42.6143 25.7753 42.6143ZM17.6793 37.5997L18.1868 37.9173C20.4734 39.351 23.0979 40.1087 25.7751 40.1087C33.6797 40.1087 40.1097 33.6788 40.1097 25.7748C40.1097 17.8716 33.6797 11.4416 25.7751 11.4416C17.8719 11.4416 11.4419 17.8716 11.4419 25.7748C11.4419 28.9905 12.4954 32.0376 14.4864 34.5857L14.8386 35.0359L14.1016 38.8321L17.6793 37.5997Z" fill="white"/>
            <path d="M17.2747 19.3053C17.2747 19.3053 18.2633 17.5783 19.0684 17.4796C19.8739 17.3805 20.9111 17.3805 21.1903 17.907C21.4702 18.4331 22.7197 21.4932 22.7197 21.4932C22.7197 21.4932 22.9343 22.0195 22.6054 22.5297C22.2765 23.0394 21.5363 23.7794 21.5363 23.7794C21.5363 23.7794 21.125 24.3057 21.5363 24.8653C21.9475 25.424 22.5854 26.4525 23.9052 27.7707C25.2228 29.0899 27.7535 30.0304 27.7535 30.0304C27.7535 30.0304 28.1157 30.0794 28.3465 29.8494C28.576 29.6191 29.8268 28.0564 29.8268 28.0564C29.8268 28.0564 30.228 27.5386 30.8953 27.8427C31.5612 28.1468 34.4479 29.5862 34.4479 29.5862C34.4479 29.5862 34.7856 29.7093 34.7856 30.2193C34.7856 30.729 34.5793 31.9768 34.1574 32.3985C33.7353 32.8208 32.5022 34.1211 30.6483 34.1211C28.7948 34.1211 24.3807 32.6126 22.0285 30.2609C19.6763 27.9083 17.5877 25.5227 17.0948 23.3523C16.601 21.1809 16.6672 20.1996 17.2747 19.3053Z" fill="white"/>
        </svg>
    </a>
</div>
<!-- Start Search Popup -->
<div class="search-popup">
    <button class="close-search style-two">
        <span class="flaticon-multiply"></span>
    </button>
    <button class="close-search">
        <i class="fa-solid fa-xmark"></i>
    </button>

        <?php get_search_form(); ?>

</div>
<!-- End Search Popup -->

<!-- side menu -->
<div class="d-lg-none">
    <nav id="side_menu">
        <?php
        wp_nav_menu(array(
            'theme_location' => 'primary',
            'container' => '',
            'container_id' => '',
            'container_class' => '',
            'menu_id' => false,
            'menu_class' => 'nav-list',
            'depth' => 4,
            'fallback_cb' => 'navwalker::fallback',
            'walker' => new navwalker()
        ));
        ?>

    </nav>
</div>
<section class="menu-overlay d-lg-none">
    <div id="X-icon">
        <span></span>
        <span></span>
    </div>
</section>
<!-- End Side Menu -->

<!-- header -->
<header class="<?php echo(is_home() ? 'head-home' : 'head-inside') ?>">
    <div class="hold_header animated fadeInDown">
        <div class="container">
            <div class="header-style d-flex justify-content-between align-items-center">
                <div class="menu-logo text-center">
                    <a href="<?php echo home_url(); ?>"
                       title="<?php echo get_field('logo', 'option')['title']; ?>">
                        <img class="img-fluid logo"
                             src="<?php echo get_field('logo', 'option')['url']; ?>"
                             alt="<?php echo get_field('logo', 'option')['alt']; ?>">
                    </a>
                </div>
                <div class="header-links  ">
                    <div class="d-flex justify-content-center align-items-center">
                        <nav>
                            <?php
                            wp_nav_menu(array(
                                'theme_location' => 'primary',
                                'container' => '',
                                'container_id' => '',
                                'container_class' => '',
                                'menu_id' => false,
                                'menu_class' => 'nav-list',
                                'depth' => 4,
                                'fallback_cb' => 'navwalker::fallback',
                                'walker' => new navwalker()
                            ));
                            ?>
                        </nav>
                    </div>
                </div>
                <div class="search_lang">
                    <div class="menu-icons">
                        <div id="nav-icon">
                            <span></span>
                            <span></span>
                            <span></span>
                        </div>
                    </div>
                    <?php if (!is_user_logged_in()) : ?>



                        <button class="join btn btn-secondary dropdown-toggle"
                                type="button"
                                data-toggle="dropdown"
                                aria-expanded="false">
                            <?php _e('تسجيل', 'm7md') ?>
                        </button>

                        <div class="dropdown-menu">
<!--
                            <a class="dropdown-item"
                               href="<?php echo get_page_link(74); ?>"><?php _e('تسجيل مدرب', 'm7md') ?></a>-->
                            <a class="dropdown-item"
                               href="<?php echo get_page_link(71); ?>"><?php _e('تسجيل  جديد', 'm7md') ?></a>
                            <a class="dropdown-item"
                               href="<?php echo get_page_link(84); ?>"><?php _e('تسجيل دخول', 'm7md') ?></a>

                        </div>

                    <?php else: ?>
                        <button class="join btn btn-secondary dropdown-toggle"
                                type="button"
                                data-toggle="dropdown"
                                aria-expanded="false">
                            <?php _e('مرحبا', 'm7md') ?>
                            <?php echo $current_user->nickname; ?>
                        </button>
                        <div class="dropdown-menu">
                              <a class="dropdown-item"
                                   href="<?php echo get_page_link(76) ?>"><?php _e('الملف الشخصى', 'm7md') ?></a>

                                <a class="dropdown-item"
                                   href="<?php echo get_page_link(90); ?>"><?php _e('تعديل الملف الشخصى', 'm7md') ?></a>
<?php if ($user_member): ?> 
                                <a class="dropdown-item"
                                   href="<?php echo get_page_link(140); ?>"><?php _e('الدروس المشترك بها', 'm7md') ?></a>
<?php endif; ?>
                           <!--     <a class="dropdown-item"
                                   href="<?php echo get_page_link(395); ?>"><?php _e('المفضلة', 'm7md') ?></a>

                                <a class="dropdown-item"
                                   href="<?php echo get_page_link(398); ?>"><?php _e('السلة', 'm7md') ?></a>-->

                                <a class="dropdown-item"
                                   href="<?php echo wp_logout_url(site_url()); ?>"><?php _e('تسجيل خروج', 'm7md') ?></a>
                                   
                            <?php if ($user_instructor): ?>
                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(76) ?>"><?php _e('الملف الشخصى', 'm7md') ?></a>-->
                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(90); ?>"><?php _e('تعديل الملف الشخصى', 'm7md') ?></a>-->
                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(92); ?>"><?php _e('إضافة درس', 'm7md') ?></a>-->
                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(120); ?>"><?php _e('الدروس التى أقدمها', 'm7md') ?></a>-->
                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(395); ?>"><?php _e('المفضلة', 'm7md') ?></a>-->
                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(398); ?>"><?php _e('السلة', 'm7md') ?></a>-->
                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo wp_logout_url(site_url()); ?>"><?php _e('تسجيل خروج', 'm7md') ?></a>-->
                           <?php elseif ($user_member): ?> 

                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(76) ?>"><?php _e('الملف الشخصى', 'm7md') ?></a>-->

                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(90); ?>"><?php _e('تعديل الملف الشخصى', 'm7md') ?></a>-->

                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(140); ?>"><?php _e('الدروس المشترك بها', 'm7md') ?></a>-->

                           <!--     <a class="dropdown-item"
                           <!--        href="<?php echo get_page_link(395); ?>"><?php _e('المفضلة', 'm7md') ?></a>-->

                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo get_page_link(398); ?>"><?php _e('السلة', 'm7md') ?></a>-->

                           <!--     <a class="dropdown-item"-->
                           <!--        href="<?php echo wp_logout_url(site_url()); ?>"><?php _e('تسجيل خروج', 'm7md') ?></a>-->

                            <?php endif; ?> 
                        </div>
                    <?php endif; ?>
                    <a href="javascript:void(0)"
                       class="search-box-outer main_search">
                        <i class="fa-solid fa-magnifying-glass"></i>
                    </a>
                    <!--

                    <a class="header-cart wow fadeInDown"
                       href="<?php echo get_page_link(398); ?>">
                        <i class="fas fa-shopping-cart "></i>
                        <span class="counter"><?php echo $cartcount ?></span>
                    </a>
                    <a href="<?php echo get_page_link(395); ?>"
                       class="header-wishlist wow fadeInDown">
                        <i class="fas fa-heart"></i>
                    </a>  
                    -->
                    <div class="lang">
		                <?php the_switch_language('<a href="?lang=en"> En </a>',
			                '<a href="?lang=ar"> ع </a>') ?>
                    </div>

                </div>
            </div>
        </div>
    </div>
</header>
<!-- /header -->
<div class="socialfixedicon">
    <div class="social text-center">
        <?php while (has_sub_field('social_media', 'option')): ?>
            <a target="_blank"
               href="<?php the_sub_field('sLink', 'option'); ?>">
                <i class="<?php the_sub_field('sIcon', 'option'); ?>"></i>
            </a>
        <?php endwhile; ?>
    </div>
</div>

<?php // if (!is_home()) : get_template_part('template-parts/breadcrumb'); endif; ?>
