<?php
if (!isAdminLoggedIn()) redirect('login.php');
$siteName = getSiteName();
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo isset($pageTitle) ? $pageTitle . ' - ' : ''; ?>Admin - <?php echo $siteName; ?></title>
    <link rel="stylesheet" href="../assets/css/style.css">
</head>
<body>
    <div class="sidebar">
        <div class="sidebar-logo"><?php echo $siteName; ?> Admin</div>
        <ul class="sidebar-menu">
            <li><a href="dashboard.php">📊 Dashboard</a></li>
            <li><a href="users.php">👥 Users</a></li>
            <li><a href="withdrawals.php">💰 Withdrawals</a></li>
            <li><a href="tasks.php">📝 Tasks</a></li>
            <li><a href="videos.php">🎥 Videos</a></li>
            <li><a href="trivia.php">❓ Trivia</a></li>
            <li><a href="ads.php">📺 Ads</a></li>
            <li><a href="blogs.php">📰 Blogs</a></li>
            <li><a href="announcements.php">📢 Announcements</a></li>
            <li><a href="settings.php">⚙️ Settings</a></li>
            <li><a href="logout.php">🚪 Logout</a></li>
        </ul>
    </div>
    <div class="main-content">
        <div class="header">
            <div><h2><?php echo isset($pageTitle) ? $pageTitle : 'Dashboard'; ?></h2></div>
            <div><button class="theme-toggle" id="theme-toggle"><span id="theme-icon">🌙</span></button></div>
        </div>
        <?php if ($flash = getFlash()): ?>
            <div class="alert alert-<?php echo $flash['type']; ?>"><?php echo $flash['message']; ?></div>
        <?php endif; ?>
