<?php
function isActive($paths, $exact = false) {
    $current = $_SERVER['REQUEST_URI'] ?? '';
    if ($exact) {
        return ($current == $paths || $current == $paths . '/') ? 'active' : '';
    }
    foreach ((array)$paths as $path) {
        if (strpos($current, $path) !== false) {
            return 'active';
        }
    }
    return '';
}
?>

<!-- ====== HEADER ====== -->
<header class="app-header">
    <div class="header-container">
        <div class="logo">
            <i class="fas fa-trophy"></i>
            <span>EST Concours</span>
        </div>
        <nav class="header-nav">
            <ul>
                <li><a href="/est-concours/app/view/employee/dashboard/main" class="<?php echo isActive('employee/dashboard', true); ?>"><i class="fas fa-home"></i> Accueil</a></li>
                <li><a href="/est-concours/app/view/employee/espace-avancement/avancement/list" class="<?php echo isActive('employee/espace-avancement'); ?>"><i class="fas fa-chart-pie"></i> Avancement</a></li>
                <li><a href="/est-concours/app/view/employee/espace-concours/concours/list" class="<?php echo isActive('employee/espace-concours'); ?>"><i class="fas fa-list-ul"></i> Concours</a></li>
                <li><a href="/est-concours/app/view/employee/espace-demande-doc/demande_document/list" class="<?php echo isActive('employee/espace-demande-doc'); ?>"><i class="fas fa-calendar-alt"></i> Demande Doc</a></li>
            </ul>
        </nav>
        <div class="user-profile">
            <i class="fas fa-user-circle"></i>
            <span>Admin</span>
        </div>
    </div>
</header>
