<?php
// File: admin-header.php
// Clean unified header untuk semua halaman admin

$currentPage = basename($_SERVER['PHP_SELF'], '.php');
$pageTitle = '';

switch($currentPage) {
    case 'dashboard':
        $pageTitle = 'Dashboard Admin';
        break;
    case 'markets':
        $pageTitle = 'Kelola Market';
        break;
    case 'livedraw':
        $pageTitle = 'Live Draw';
        break;
    case 'settings':
        $pageTitle = 'Website Settings';
        break;
    case 'banners':
        $pageTitle = 'Kelola Banner';
        break;
    case 'buku-mimpi':
        $pageTitle = 'Kelola Buku Mimpi';
        break;
    case 'bukti-jackpot':
        $pageTitle = 'Kelola Bukti Jackpot';
        break;
    case 'support':
        $pageTitle = 'Kelola Support Tickets';
        break;
    case 'sites':
        $pageTitle = 'Site Management';
        break;
    case 'site-markets':
        $pageTitle = 'Site Markets Management';
        break;
    case 'multi-result-input':
        $pageTitle = 'Multi Result Input';
        break;
    case 'master-buku-mimpi':
        $pageTitle = 'Master Buku Mimpi';
        break;
    case 'master-multi-result-input':
        $pageTitle = 'Master Multi Result Input';
        break;
    case 'master-view-all-results':
        $pageTitle = 'Master View All Results';
        break;
    case 'master-support':
        $pageTitle = 'Master Support';
        break;
    default:
        $pageTitle = 'Admin Panel';
}
?>
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $pageTitle; ?> - <?php echo ADMIN_TITLE; ?></title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <link href="../shared/css/admin-styles-fixed.css" rel="stylesheet">
</head>
<body>
    <!-- Admin Header -->
    <header class="admin-header">
        <div class="admin-logo">
            <i class="fas fa-shield-alt"></i>
            <div class="admin-title"><?php echo defined('ADMIN_TITLE') ? str_replace(' Admin Panel', '', ADMIN_TITLE) : 'ADMIN'; ?></div>
        </div>
        
        <nav class="nav-links">
            <a href="dashboard.php" class="<?php echo $currentPage === 'dashboard' ? 'active' : ''; ?>">
                <i class="fas fa-home"></i> Dashboard
            </a>
            
            <?php if (isset($_SESSION['integrated_admin_data']['is_master']) && $_SESSION['integrated_admin_data']['is_master']): ?>
            <!-- Master Admin Menu -->
            <a href="master-multi-result-input.php" class="<?php echo $currentPage === 'master-multi-result-input' ? 'active' : ''; ?>">
                <i class="fas fa-plus-circle"></i> Multi Site Result Input
            </a>
            <a href="master-view-all-results.php" class="<?php echo $currentPage === 'master-view-all-results' ? 'active' : ''; ?>">
                <i class="fas fa-eye"></i> View All Results
            </a>
            <a href="master-buku-mimpi.php" class="<?php echo $currentPage === 'master-buku-mimpi' ? 'active' : ''; ?>">
                <i class="fas fa-moon"></i> Master Buku Mimpi
            </a>
            <a href="master-support.php" class="<?php echo $currentPage === 'master-support' ? 'active' : ''; ?>">
                <i class="fas fa-headset"></i> Support Tickets
            </a>
            <?php endif; ?>
            
            <!-- Regular Admin Menu -->
            <a href="markets.php" class="<?php echo $currentPage === 'markets' ? 'active' : ''; ?>">
                <i class="fas fa-store"></i> Markets
            </a>
            <a href="livedraw.php" class="<?php echo $currentPage === 'livedraw' ? 'active' : ''; ?>">
                <i class="fas fa-play-circle"></i> Live Draw
            </a>
            <a href="buku-mimpi.php" class="<?php echo $currentPage === 'buku-mimpi' ? 'active' : ''; ?>">
                <i class="fas fa-moon"></i> Buku Mimpi
            </a>
            <a href="bukti-jackpot.php" class="<?php echo $currentPage === 'bukti-jackpot' ? 'active' : ''; ?>">
                <i class="fas fa-trophy"></i> Bukti Jackpot
            </a>
            <a href="support.php" class="<?php echo $currentPage === 'support' ? 'active' : ''; ?>">
                <i class="fas fa-headset"></i> Support
            </a>
            <a href="settings.php" class="<?php echo $currentPage === 'settings' ? 'active' : ''; ?>">
                <i class="fas fa-cog"></i> Settings
            </a>
            <a href="../index.php" target="_blank" class="website-link">
                <i class="fas fa-globe"></i> Website
            </a>
            <a href="logout.php" class="logout-btn">
                <i class="fas fa-sign-out-alt"></i> Logout
            </a>
        </nav>
    </header>

    <!-- Main Content Container -->
    <div class="container">
        <div class="page-header">
            <h1 class="page-title"><?php echo $pageTitle; ?></h1>
            <?php if (isset($_SESSION['integrated_admin_data']['site_name'])): ?>
            <p class="page-subtitle">Kelola <?php echo $_SESSION['integrated_admin_data']['site_name']; ?></p>
            <?php endif; ?>
        </div>