<?php
/**
 * templates/header.php — Top navigation bar
 * Requires: user is logged in (call require_login() before including)
 */
?>
<div class="header-container fixed-top">
    <header class="header navbar navbar-expand-lg nxl-header">
        <div class="header-wrapper">

            <!-- Sidebar / menu toggle -->
            <div class="header-left d-flex align-items-center gap-4">
                <a href="#" class="header-menu-btn" id="headerMenuBtn">
                    <i class="feather-menu"></i>
                </a>

                <!-- Logo -->
                <a class="logo-horizontal" href="<?= base_url('pages/dashboard.php') ?>">
                    <img src="<?= base_url('assets/img/logo_dark.png') ?>" alt="<?= e(APP_NAME) ?>" class="light-logo" style="max-height:40px;">
                    <img src="<?= base_url('assets/img/logo_white.png') ?>" alt="<?= e(APP_NAME) ?>" class="dark-logo" style="max-height:40px;">
                </a>
            </div>

            <!-- Right side -->
            <div class="header-right ms-auto d-flex align-items-center gap-3">

                <!-- Role badge -->
                <span class="badge bg-primary d-none d-sm-inline-flex">
                    <?= e(current_user_role() === 'super_admin' ? 'Super Admin' : 'Agency User') ?>
                </span>

                <!-- User dropdown -->
                <div class="dropdown">
                    <a href="#" class="d-flex align-items-center gap-2 text-dark text-decoration-none dropdown-toggle"
                       data-toggle="dropdown" aria-expanded="false">
                        <img src="<?= base_url('assets/img/author/profile.png') ?>"
                             alt="avatar" class="rounded-circle" width="36" height="36">
                        <span class="d-none d-md-inline fw-semibold"><?= e(current_user_name()) ?></span>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-right shadow-sm">
                        <li>
                            <a class="dropdown-item" href="<?= base_url('pages/profile.php') ?>">
                                <i class="feather-user me-2"></i> My Profile
                            </a>
                        </li>
                        <li><hr class="dropdown-divider"></li>
                        <li>
                            <a class="dropdown-item text-danger" href="<?= base_url('logout.php') ?>">
                                <i class="feather-log-out me-2"></i> Sign Out
                            </a>
                        </li>
                    </ul>
                </div>

            </div><!-- /.header-right -->
        </div><!-- /.header-wrapper -->
    </header>
</div><!-- /.header-container -->
