<!-- app-Header -->
<div class="app-header header sticky">
    <div class="container-fluid main-container">
        <div class="d-flex">
            <a aria-label="Hide Sidebar" class="app-sidebar__toggle" data-bs-toggle="sidebar"
                href="javascript:void(0)"></a>
            <!-- sidebar-toggle-->
            <a class="logo-horizontal "
                href="<?php echo (isset($_SESSION['role']) && $_SESSION['role'] === 'user') ? base_url('public/user/dashboard.php') : base_url('public/admin/dashboard.php'); ?>">
                <img src="<?php echo asset_url('assets/images/marketing-engine-logo.png'); ?>"
                    class="header-brand-img desktop-logo" alt="logo"
                    style="height: auto; max-width: 150px; width: 100%;">
                <img src="<?php echo asset_url('assets/images/marketing-engine-logo.png'); ?>"
                    class="header-brand-img light-logo1" alt="logo"
                    style="height: auto; max-width: 150px; width: 100%;">
            </a>
            <!-- LOGO -->
            <div class="d-flex order-lg-2 ms-auto header-right-icons">
                <div class="dropdown d-none">
                    <a href="javascript:void(0)" class="nav-link icon" data-bs-toggle="dropdown">
                        <i class="fe fe-search"></i>
                    </a>
                    <div class="dropdown-menu header-search dropdown-menu-start">
                        <div class="input-group w-100 p-2">
                            <input type="text" class="form-control" placeholder="Search....">
                            <div class="input-group-text btn btn-primary">
                                <i class="fe fe-search" aria-hidden="true"></i>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="d-flex country">
                    <a class="nav-link icon theme-layout nav-link-bg layout-setting">
                        <span class="dark-layout"><i class="fe fe-moon"></i></span>
                        <span class="light-layout"><i class="fe fe-sun"></i></span>
                    </a>
                </div>

                <!-- FULL-SCREEN -->
                <div class="dropdown d-flex">
                    <a class="nav-link icon full-screen-link nav-link-bg">
                        <i class="fe fe-minimize fullscreen-button"></i>
                    </a>
                </div>

                <!-- SIDE-MENU -->
                <div class="dropdown d-flex profile-1">
                    <a href="javascript:void(0)" data-bs-toggle="dropdown" class="nav-link leading-none d-flex">
                        <img src="<?php echo !empty($_SESSION['profile_image']) ? asset_url($_SESSION['profile_image']) : asset_url('assets/images/users/21.jpg'); ?>"
                            alt="profile-user" class="avatar  profile-user brround cover-image">
                    </a>
                    <div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
                        <div class="drop-heading">
                            <div class="text-center">
                                <h5 class="text-dark mb-0 fs-14 fw-semibold">
                                    <?php
                                    if (isset($_SESSION['user_username'])) {
                                        echo htmlspecialchars($_SESSION['user_username']);
                                    } elseif (isset($_SESSION['admin_username'])) {
                                        echo htmlspecialchars($_SESSION['admin_username']);
                                    } else {
                                        echo 'Guest';
                                    }
                                    ?>
                                </h5>
                                <small class="text-muted">
                                    <?php echo isset($_SESSION['user_id']) ? 'User' : 'Administrator'; ?>
                                </small>
                            </div>
                        </div>
                        <div class="dropdown-divider m-0"></div>
                        <a class="dropdown-item"
                            href="<?php echo strpos($_SERVER['PHP_SELF'], '/admin/') !== false ? 'profile.php' : '../user/profile.php'; ?>">
                            <i class="dropdown-icon fe fe-user"></i> Profile
                        </a>
                        <a class="dropdown-item" href="api_settings.php">
                            <i class="dropdown-icon fe fe-settings"></i> Settings
                        </a>
                        <a class="dropdown-item" href="../logout.php">
                            <i class="dropdown-icon fe fe-alert-circle"></i> Sign out
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- /app-Header -->