<?php
$currentPage = basename($_SERVER['PHP_SELF']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title><?= isset($pageTitle) ? htmlspecialchars($pageTitle) : 'Admin Panel' ?> - Admin Pro</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <style>
        :root {
            --admin-sidebar: #1a1d29;
            --admin-sidebar-hover: #009ef7;
            --admin-card-shadow: 0 4px 24px rgba(0,0,0,0.06);
            --admin-card-radius: 16px;
            --admin-nav-shadow: 0 2px 12px rgba(0,0,0,0.04);
        }
        * { box-sizing: border-box; }
        body { background: #f0f2f7; font-family: 'Segoe UI', system-ui, sans-serif; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
        
        /* Sidebar - Pro level */
        .sidebar {
            height: 100vh; background: var(--admin-sidebar); color: #fff; position: fixed; width: 268px;
            padding-top: 16px; transition: transform 0.3s ease, box-shadow 0.3s ease;
            box-shadow: 6px 0 24px rgba(0,0,0,0.08); z-index: 1050; left: 0; overflow-y: auto;
        }
        .sidebar .brand {
            text-align: center; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 12px;
        }
        .sidebar .brand h4 { font-size: 1.1rem; font-weight: 800; margin: 0; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
        .sidebar .brand .ver { font-size: 10px; color: #6c7293; margin-top: 4px; }
        .sidebar a {
            padding: 12px 20px; text-decoration: none; color: #a1a5b7; display: flex; align-items: center; gap: 12px;
            font-weight: 600; font-size: 13px; transition: all 0.2s; border-left: 3px solid transparent;
        }
        .sidebar a i { width: 22px; text-align: center; font-size: 15px; opacity: 0.9; }
        .sidebar a:hover { background: rgba(0,158,247,0.12); color: #fff; border-left-color: var(--admin-sidebar-hover); }
        .sidebar a.active { background: linear-gradient(90deg, rgba(0,158,247,0.2), transparent); color: #fff; border-left-color: var(--admin-sidebar-hover); }
        .sidebar .nav-label { padding: 10px 20px 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #6c7293; }
        
        /* Mobile */
        .mobile-toggle {
            display: none; background: var(--admin-sidebar); color: #fff; border: none; padding: 10px 14px;
            border-radius: 10px; font-size: 18px; cursor: pointer; box-shadow: var(--admin-card-shadow);
        }
        .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1040; }
        .sidebar-overlay.show { display: block; }
        
        .main-content { margin-left: 268px; padding: 20px; transition: margin 0.3s ease; min-height: 100vh; }
        .top-navbar {
            background: #fff; padding: 14px 22px; border-radius: var(--admin-card-radius);
            box-shadow: var(--admin-nav-shadow); margin-bottom: 22px;
            display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
        }
        .top-navbar h5 { margin: 0; font-weight: 800; color: #181c32; font-size: 1.15rem; }
        .badge-online { background: rgba(0,200,83,0.12); color: #00c853; padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: 12px; border: 1px solid rgba(0,200,83,0.3); }
        .badge-online i { font-size: 6px; vertical-align: middle; margin-right: 4px; }
        
        .custom-card { background: #fff; border-radius: var(--admin-card-radius); box-shadow: var(--admin-card-shadow); overflow: hidden; margin-bottom: 20px; border: 1px solid rgba(0,0,0,0.04); }
        .custom-card-header { padding: 18px 24px; border-bottom: 1px solid #f0f0f0; font-weight: 700; color: #181c32; }
        
        @media (max-width: 991px) {
            .sidebar { transform: translateX(-100%); }
            .sidebar.show { transform: translateX(0); box-shadow: 12px 0 32px rgba(0,0,0,0.15); }
            .main-content { margin-left: 0; padding: 14px; }
            .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }
            .top-navbar { padding: 12px 16px; }
        }
    </style>
</head>
<body>

<div class="sidebar-overlay" id="sidebarOverlay" onclick="document.getElementById('adminSidebar').classList.remove('show'); document.getElementById('sidebarOverlay').classList.remove('show');"></div>
<div class="sidebar" id="adminSidebar">
    <div class="brand">
        <h4><i class="fas fa-crown text-warning"></i> Admin Pro</h4>
        <div class="ver">v3.0 • Full Control</div>
    </div>
    
    <a href="index.php" class="<?= $currentPage == 'index.php' ? 'active' : '' ?>"><i class="fas fa-home"></i> Dashboard</a>
    
    <div class="nav-label">Finance</div>
    <a href="deposit_requests.php" class="<?= $currentPage == 'deposit_requests.php' ? 'active' : '' ?>"><i class="fas fa-inbox"></i> Deposit Requests</a>
    <a href="withdraw_requests.php" class="<?= $currentPage == 'withdraw_requests.php' ? 'active' : '' ?>"><i class="fas fa-paper-plane"></i> Withdraw Requests</a>
    <a href="depositmanage.php" class="<?= $currentPage == 'depositmanage.php' ? 'active' : '' ?>"><i class="fas fa-qrcode"></i> Deposit Channels</a>
    
    <div class="nav-label">App Content</div>
    <a href="banners.php" class="<?= $currentPage == 'banners.php' ? 'active' : '' ?>"><i class="fas fa-images"></i> Home Banners</a>
    <a href="categories.php" class="<?= $currentPage == 'categories.php' ? 'active' : '' ?>"><i class="fas fa-layer-group"></i> Categories</a>
    <a href="games.php" class="<?= $currentPage == 'games.php' ? 'active' : '' ?>"><i class="fas fa-gamepad"></i> Game List</a>
    
    <div class="nav-label">Sports & Games</div>
    <a href="cricketmanage.php" class="<?= $currentPage == 'cricketmanage.php' ? 'active' : '' ?>"><i class="fas fa-baseball-ball text-success"></i> Cricket</a>
    <a href="wingomanage.php" class="<?= $currentPage == 'wingomanage.php' ? 'active' : '' ?>"><i class="fas fa-gem"></i> Wingo</a>
    <a href="manage_mines.php" class="<?= $currentPage == 'manage_mines.php' ? 'active' : '' ?>"><i class="fas fa-bomb"></i> Mines</a>
    <a href="manage_chicken.php" class="<?= $currentPage == 'manage_chicken.php' ? 'active' : '' ?>"><i class="fas fa-dice"></i> Chicken</a>
    
    <div class="nav-label">Features</div>
    <a href="vipmanage.php" class="<?= $currentPage == 'vipmanage.php' ? 'active' : '' ?>"><i class="fas fa-star text-warning"></i> VIP Levels</a>
    <a href="promotionmanage.php" class="<?= $currentPage == 'promotionmanage.php' ? 'active' : '' ?>"><i class="fas fa-gift"></i> Promotion</a>
    <a href="activitymanage.php" class="<?= $currentPage == 'activitymanage.php' ? 'active' : '' ?>"><i class="fas fa-fire-alt"></i> Activity</a>
    <a href="spin_wheel.php" class="<?= $currentPage == 'spin_wheel.php' ? 'active' : '' ?>"><i class="fas fa-dharmachakra"></i> Spin Wheel</a>
    <a href="profilemanage.php" class="<?= $currentPage == 'profilemanage.php' ? 'active' : '' ?>"><i class="fas fa-user-cog"></i> Profile Options</a>
    
    <div class="nav-label">Support</div>
    <a href="support_manage.php" class="<?= $currentPage == 'support_manage.php' ? 'active' : '' ?>"><i class="fas fa-headset"></i> Support Chat</a>
    <div class="nav-label">Site Control</div>
    <a href="settings.php" class="<?= $currentPage == 'settings.php' ? 'active' : '' ?>"><i class="fas fa-cog"></i> Settings & Theme</a>
    
    <div style="margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.06);"></div>
    <a href="logout.php" style="color: #f55757;"><i class="fas fa-power-off"></i> Logout</a>
</div>

<div class="main-content">
    <div class="top-navbar">
        <div class="d-flex align-items-center gap-3">
            <button class="mobile-toggle" type="button" onclick="document.getElementById('adminSidebar').classList.toggle('show'); document.getElementById('sidebarOverlay').classList.toggle('show');" aria-label="Menu">
                <i class="fas fa-bars"></i>
            </button>
            <h5><?= isset($pageTitle) ? htmlspecialchars($pageTitle) : 'Dashboard' ?></h5>
        </div>
        <span class="badge-online"><i class="fas fa-circle"></i> Online</span>
    </div>
