<?php 
if (
  !isset($_GET['page']) ||
  (
    $_GET['page'] != 'profile' &&
    $_GET['page'] != 'withdraw' &&
    $_GET['page'] != 'deposit' &&
    $_GET['page'] != 'daftar' &&
    $_GET['page'] != 'roda' &&
    $_GET['page'] != 'referral' &&
    $_GET['page'] != 'bahan-iklan' &&
    $_GET['page'] != 'promosi' &&
    $_GET['page'] != 'riwayat'
  )
):
?>

  <!-- ================= HEADER MOBILE ================= -->
  <div class="header-mobile">
    
    <!-- TOP HEADER -->
    <div class="header-mobile__top">

      <!-- MENU BUTTON -->
      <div data-target="slide-out" class="button-nav sidenav-toggle">
        <i class="fas fa-bars m-auto"></i>
      </div>
      
      <!-- LOGO -->
      <div class="mobile-logo">
        <a href="?page=home">
          <img
            src="../assets/img/<?php echo $logo ?>"
            alt="WebsiteLogo"
            width="125"
            height="30"
          >
        </a>
      </div>
      
      <!-- BUTTON AREA -->
      <div class="mobile-button">
        <?php if ($id_login == "") { ?>

          <a href="#"
             class="header-btn btn-custom-3"
             data-toggle="modal"
             data-target="#loginModal">
            <i class="fas fa-sign-in-alt"></i> Masuk
          </a>

          <a href="?page=daftar" class="header-btn btn-custom" style="flex:1">
            <i class="fas fa-user-plus"></i> Daftar
          </a>

        <?php } else { ?>

          <!-- WALLET -->
          <div class="wallet-ui">
            <div class="wallet-balance" data-toggle="modal" data-target="#accountBalance">
              <span class="currency">Rp</span>
              <span class="amount" name="mainBalance">
                <?php echo number_format($liat['active'], 0, ',', '.'); ?>
              </span>
            </div>

            <div class="wallet-refresh"
                 style="cursor:pointer; margin-left:5px;"
                 data-user="<?= htmlspecialchars($extplayer) ?>">
              <i class="fas fa-sync-alt"></i>
            </div>
          </div>

          <!-- [CHAT PUBLIC DIHAPUS DISINI] -->

                    
          <!-- Tombol Bell -->
          <div class="button-nav bell-btn" style="position: relative; cursor: pointer;">
            <i class="fas fa-bell m-auto"></i>
            <span id="notifBadge" style="
              position: absolute;
              top: 0;
              right: 0;
              background: #d6a24f;
              color: #121212;
              font-size: 8px;
              font-weight: bold;
              padding: 2px 6px;
              border-radius: 12px;
              min-width: 10px;
              text-align: center;
              display: none; /* sembunyikan kalau 0 */
              user-select: none;
            ">0</span>
          
            <!-- Container notifikasi -->
            <div id="notifDropdown" style="
              display: none;
              position: absolute;
              top: 100%;
              right: 0;
              width: 280px;
              max-height: 400px;
              overflow-y: auto;
              background: #222;
              border: 1px solid #444;
              border-radius: 8px;
              box-shadow: 0 5px 15px rgba(0,0,0,0.3);
              z-index: 9999;
              padding: 10px;
            ">
              <h4 style="color:#d6a24f; margin: 0 0 10px;">Notifikasi</h4>
              <ul id="notifList" style="list-style:none; padding:0; margin:0; color:#eee; font-size:14px;">
                <?php if (count($notifikasi) > 0): ?>
                  <?php foreach ($notifikasi as $notif): ?>
                    <li style="padding:8px 0; border-bottom:1px solid #444;">
                      <strong><?= htmlspecialchars($notif['judul']) ?></strong><br>
                      <small style="color:#999;"><?= date('d M Y H:i', strtotime($notif['tanggal'])) ?></small>
                      <p style="margin:5px 0 0; font-size:13px;"><?= htmlspecialchars($notif['deskripsi']) ?></p>
                    </li>
                  <?php endforeach; ?>
                <?php else: ?>
                  <li>Tidak ada notifikasi.</li>
                <?php endif; ?>
              </ul>
            </div>
          </div>
        <?php } ?>
      </div>
    </div>

    <!-- MARQUEE INFO -->
    <div class="header-mobile__marquee">
      <i class="fas fa-bullhorn"></i>
      <marquee class="marquee"><?php echo $title ?></marquee>
    </div> 

  </div>

<?php endif; ?>