<?php
session_start();
if (!isset($_SESSION['eggzie_iboPlayer'])) {
    header('location:login.php');
    exit();
}
$IIIIIIIlI1lI = $_SESSION['id'];
$IIIIIIIlI1ll = new SQLite3('./a/.eggziepanels.db');
$adb = new SQLite3('./api/.adb.db');
$IIIIIIIlI1l1 = $IIIIIIIlI1ll->query('SELECT * FROM USERS WHERE id=\'1\'');
$IIIIIIIlI11I = $IIIIIIIlI1l1->fetchArray();
$IIIIIIIlI11l = $IIIIIIIlI11I['NAME'];
$IIIIIIIlI111 = $IIIIIIIlI11I['LOGO'];

$current_page = basename($_SERVER['PHP_SELF']);

function nav_item($href, $icon, $label, $current) {
    $active = (basename($href) === $current) ? ' active' : '';
    echo '<li class="nav-item">';
    echo '<a class="nav-link'.$active.'" href="'.$href.'">';
    echo '<i class="'.$icon.'"></i>';
    echo '<span>'.$label.'</span>';
    echo '</a></li>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
$IIIIIIIllIII = file_get_contents('./includes/eggzie.json');
$IIIIIIIllIIl = json_decode($IIIIIIIllIII, true);
$IIIIIIIllII1 = $IIIIIIIllIIl['info'];
$IIIIIIIllIlI = $IIIIIIIllII1['aa'];
?>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Ultra IBO</title>
  <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

  <!-- Preconnect fonts -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap" rel="stylesheet">

  <!-- Bootstrap (keep for modals / JS) -->
  <link href="css/sb-admin-<?php echo $IIIIIIIllIlI; ?>.css" rel="stylesheet">

  <!-- Icons -->
  <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

  <!-- Flatpickr -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
  <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

  <!-- Ultra Design System (overrides sb-admin) -->
  <link href="css/ultra.css" rel="stylesheet">
</head>
<body id="page-top">

<!-- Sidebar Overlay (mobile) -->
<div id="sidebar-overlay" onclick="closeSidebar()"></div>

<div id="wrapper">

  <!-- ════════════════ SIDEBAR ════════════════ -->
  <nav id="sidebar">

    <!-- Brand -->
    <a class="sidebar-brand" href="#">
      <?php if ($IIIIIIIlI111): ?>
        <img src="<?php echo $IIIIIIIlI111; ?>" alt="Logo">
      <?php else: ?>
        <img src="img/logo.png" alt="Logo">
      <?php endif; ?>
      <div class="sidebar-brand-text">
        <span class="brand-name">Ultra IBO</span>
        <span class="brand-sub">Control Panel</span>
      </div>
    </a>

    <!-- Nav -->
    <ul class="sidebar-nav" id="accordionSidebar">

      <li class="sidebar-section-label">Gestão</li>
      <?php nav_item('users.php',          'fas fa-fw fa-users',      'Users',            $current_page); ?>
      <?php nav_item('users_bulk_dns.php', 'fas fa-fw fa-globe',      'DNS em Massa',     $current_page); ?>
      <?php nav_item('update.php',         'fas fa-fw fa-sync-alt',   'Apk Update',       $current_page); ?>
      <?php nav_item('snoop.php',          'fas fa-fw fa-eye',        'Snoop',            $current_page); ?>

      <li class="sidebar-section-label">Aparência</li>
      <?php nav_item('mRTXBGImage.php',    'fas fa-fw fa-image',      'Background',       $current_page); ?>
      <?php nav_item('mRTXBGlogo.php',     'fas fa-fw fa-smile',      'Change Logo',      $current_page); ?>
      <?php nav_item('mRTXBGads.php',      'fas fa-fw fa-ad',         'Ads',              $current_page); ?>
      <?php nav_item('mRTXBGlayouts.php',  'fas fa-fw fa-th-large',   'Layout',           $current_page); ?>
      <?php nav_item('mRTXBGSport.php',    'fas fa-fw fa-futbol',     'Sport',            $current_page); ?>

      <li class="sidebar-section-label">Configurações</li>
      <?php nav_item('profile.php',        'fas fa-fw fa-user-circle','Profile',          $current_page); ?>

      <!-- App Settings collapsible -->
      <li class="nav-item">
        <a class="nav-link collapsed" href="#collapseSettings" data-toggle="collapse" aria-expanded="false">
          <i class="fas fa-fw fa-cog"></i>
          <span>App Settings</span>
          <i class="fas fa-chevron-down ml-auto" style="font-size:10px;margin-left:auto"></i>
        </a>
        <div id="collapseSettings" class="collapse sidebar-collapse-inner">
          <p class="collapse-header">Background Setting</p>
          <a class="collapse-item" href="mRTXBGmWebpage.php"><i class="fas fa-cog"></i> Setup WebSite</a>
          <a class="collapse-item" href="mRTXBGGradint.php"><i class="fas fa-paint-brush"></i> Gradient BG</a>
        </div>
      </li>

      <!-- Cloud collapsible -->
      <li class="nav-item">
        <a class="nav-link collapsed" href="#collapseCloud" data-toggle="collapse" aria-expanded="false">
          <i class="fas fa-fw fa-cloud"></i>
          <span>Cloud</span>
          <i class="fas fa-chevron-down" style="font-size:10px;margin-left:auto"></i>
        </a>
        <div id="collapseCloud" class="collapse sidebar-collapse-inner">
          <p class="collapse-header">Cloud Uploads</p>
          <a class="collapse-item" href="https://db.tt" target="_blank"><i class="fas fa-share"></i> DropBox</a>
          <a class="collapse-item" href="https://mega.nz/" target="_blank"><i class="fas fa-share"></i> Mega</a>
        </div>
      </li>

      <li class="sidebar-section-label">Sessão</li>
      <?php nav_item('logout.php',         'fas fa-fw fa-sign-out-alt','Logout',          $current_page); ?>
    </ul>

    <div class="sidebar-footer">Ultra IBO &copy; Eggzie00</div>
  </nav>
  <!-- ════════════════ END SIDEBAR ════════════════ -->

  <!-- ════════════════ CONTENT WRAPPER ════════════════ -->
  <div id="content-wrapper" class="d-flex flex-column">

    <!-- Topbar -->
    <div id="topbar">
      <div class="topbar-left">
        <button id="sidebarToggleTop" onclick="toggleSidebar()">
          <i class="fas fa-bars"></i>
        </button>
        <div class="topbar-title">
          IBO Player Pro
          <small><?php echo htmlspecialchars($IIIIIIIlI11l); ?></small>
        </div>
      </div>
      <div class="topbar-right">
        <a href="logout.php" class="u-btn u-btn-ghost u-btn-sm">
          <i class="fas fa-sign-out-alt"></i>
          <span class="btn-label">Logout</span>
        </a>
      </div>
    </div>
    <!-- End Topbar -->

    <!-- Main Content starts here -->
    <div id="content-main">
