<?php
if (! defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}
$notice_switch = get_theme_mod('curamedix_notice_switch','on');
$notice_bg_color = get_theme_mod('curamedix_notice_bg_color', '#0d6efd');
$badge_text = get_theme_mod('curamedix_badge_text', esc_html__('Trusted', 'curamedix'));
$notice_text = get_theme_mod('curamedix_notice_text', esc_html__('Book appointments online — quick, easy, and secure.', 'curamedix'));
$navbar_bg_color = get_theme_mod('curamedix_navbar_bg_color', '#FFFFFF');
$button_switch = get_theme_mod('curamedix_button_switch', 'on');
$button_text = get_theme_mod('curamedix_button_text',  esc_html__('CONTACT NOW', 'curamedix'));
$button_url = get_theme_mod('curamedix_button_url');
?>
<!-- Header start here -->
<header>
    <?php if ($notice_switch): ?>
        <div class="tr-header-area">
            <div style="background-color: <?php echo esc_attr($notice_bg_color); ?>;" class="text-white py-1" role="banner" aria-label="Site notice">
                <div class="container">
                    <div class="d-flex flex-wrap align-items-center gap-3 row-gap-0">
                        <span class="badge rounded-pill text-bg-light text-primary fw-semibold">
                            <?php echo esc_html($badge_text); ?>
                        </span>
                        <p class="mb-0 flex-grow-1">
                            <?php echo esc_html($notice_text); ?>
                        </p>
                    </div>
                </div>
            </div>
        <?php endif; ?>
        <div class="tr-header-container" style="background-color: <?php echo esc_attr($navbar_bg_color); ?>;">
        <div class="container">
            <div class="row align-items-center tr-header-row justify-content-between">
                <div class="col-6 col-sm-6 col-md-4 col-lg-3">
                    <div class="tr-header-logo">
                        <?php if (function_exists('the_custom_logo') && has_custom_logo()) : ?>
                            <div class="site-logo"><?php the_custom_logo(); ?></div>
                        <?php else : ?>
                            <a class="site-title" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
                        <?php endif; ?>
                    </div>
                </div>
                <?php if ($button_switch): ?>
                    <div class="col-lg-6 d-none d-lg-block">
                    <?php else: ?>
                        <div class="col-lg-9 d-none d-lg-block">
                        <?php endif; ?>
                        <div class="tr-header-menu d-flex justify-content-center">
                            <nav>
                                <?php curamedix_main_menu() ?>
                            </nav>
                        </div>
                        </div>
                        <?php if ($button_switch): ?>
                            <div class="col-lg-3 d-none d-lg-block">
                                <div class="tr-header-btn text-lg-end mt-16 mb-16">
                                    <a href="<?php echo esc_url($button_url); ?>" class="tr-btn"><?php echo esc_html($button_text) ?></a>
                                </div>
                            </div>
                        <?php endif; ?>

                        <div class="tr-nav-toogle col-2 d-flex justify-content-center d-lg-none">
                            <button class="tr-nav-toogle-btn" type="button" data-bs-toggle="offcanvas" data-bs-target="#tr-offcanvas" aria-controls="tr-offcanvas" aria-label="<?php echo esc_attr__('Open menu', 'curamedix'); ?>"><i class="fa fa-bars"></i></button>
                        </div>
                    </div>
            </div>
        </div>
</header>
<!-- Header end here -->

<!-- Offcanvas menu start here -->
<div class="offcanvas offcanvas-start" tabindex="-1" id="tr-offcanvas">
    <div class="offcanvas-header tr-offcanvas-menu-header mb-40">
        <div class="tr-offcanvas-logo">
            <?php if (function_exists('the_custom_logo') && has_custom_logo()) : ?>
                <div class="site-logo"><?php the_custom_logo(); ?></div>
            <?php else : ?>
                <a class="site-title" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
            <?php endif; ?>
        </div>
        <div class="tr-offcanvas-close">
            <button type="button" class="tr-offcanvas-close-btn" data-bs-dismiss="offcanvas" aria-label="Close"><i class="fa fa-times"></i></button>
        </div>
    </div>
    <div class="offcanvas-body tr-offcanvas-menu-body">
        <nav>
            <?php curamedix_mobile_menu() ?>
        </nav>
    </div>
</div>
<!-- Offcanvas menu end here  -->

<?php
