<?php
session_start();
include 'db.php'; // hii ni connection yako

$user_id = $_SESSION['user_id'] ?? 0;

if ($user_id) {
    $stmt = $conn->prepare("SELECT balance FROM users WHERE id = ?");
    $stmt->bind_param("i", $user_id);
    $stmt->execute();
    $result = $stmt->get_result();
    if($row = $result->fetch_assoc()){
        $balance = $row['balance'];
    } else {
        $balance = 0;
    }
} else {
    $balance = 0;
}
?>
<!DOCTYPE html>    
<html lang="en">    
<head>    
<link rel="manifest" href="manifest.json" />
<meta name="theme-color" content="#2196f3">
<link rel="apple-touch-icon" href="icon-192.png">
  <meta charset="UTF-8" />    
  <title>BlackRock-USDT & Platform Dashboard</title>    
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>    
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />    
  <style>    
    * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }    
    body { background: #0f1a24; color: #fff; padding-bottom: 120px; }    
    header { background-color: #1a2734; padding: 15px; display: flex; justify-content: space-between; align-items: center; }    
    header h1 { font-size: 18px; }    
    .language { background: #2c2e3f; padding: 5px 10px; border-radius: 5px; font-size: 13px; }    
    .notice { background: #1a2734; padding: 10px 15px; font-size: 13px; display: flex; align-items: center; color: #ccc; }    
    .card { background: #2c2e3f; margin: 15px; padding: 15px; border-radius: 10px; position: relative; }    
    .email-row { display: flex; justify-content: space-between; align-items: center; }    
    .email { color: #ccc; font-size: 14px; }    
    .badge { background: #2196f3; color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 12px; }    
    .balance-box { background: #1a2734; padding: 12px; margin-top: 15px; border-radius: 12px; text-align: center; }    
    .balance-box span { color: #ccc; font-size: 14px; }    
    .balance-box strong { display: block; font-size: 26px; color: #00bcd4; margin-top: 4px; }    
    .wallet-icon { position: absolute; top: 75px; right: 20px; background: #444; padding: 10px; border-radius: 50%; }    
    .wallet-icon i { color: #fff; }    
    .actions { display: flex; justify-content: space-between; margin-top: 20px; }    
    .action { text-align: center; flex: 1; }    
    .action i { font-size: 22px; background: linear-gradient(to right, #2196f3, #00bcd4); color: #fff; padding: 10px; border-radius: 50%; }    
    .action p { margin-top: 8px; font-size: 14px; }    
    .banner { margin: 10px 15px; border-radius: 10px; overflow: hidden; }    
    .banner img { width: 100%; border-radius: 10px; }    
    .section-title { margin: 20px 15px 10px; font-weight: bold; font-size: 1.3em; color: #ffffff; }    
    .share-card { background: #2c2e3f; margin: 0 15px 15px; border-radius: 10px; padding: 10px; display: flex; align-items: center; gap: 10px; }    
    .share-card img { width: 50px; height: 50px; border-radius: 8px; }    
    .share-info { flex: 1; }    
    .share-info p { font-size: 13px; line-height: 1.3; }    
    .green { color: #00bcd4; font-weight: bold; }    
    .view-btn { background: #2196f3; color: #fff; font-size: 13px; padding: 4px 8px; border-radius: 8px; }    
    .bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: #1a2734; display: flex; justify-content: space-around; padding: 10px 0; border-top: 1px solid #444; }    
    .bottom-nav div { text-align: center; font-size: 13px; color: #ccc; }    
    .bottom-nav div.active { color: #2196f3; }    
    .bottom-nav i { display: block; font-size: 18px; margin-bottom: 4px; }    
    .countdown { text-align: center; margin-top: 30px; font-size: 24px; color: #00bcd4; }    
    .countdown small { display: block; font-size: 16px; color: #00bcd4; }    
    .vip-section { margin: 20px; }    
    .vip-title { font-size: 20px; margin-bottom: 15px; }    
    .vip-card { background: #2c2e3f; border-radius: 8px; margin-bottom: 15px; display: flex; align-items: center; padding: 10px; }    
    .vip-card img { width: 70px; height: 70px; border-radius: 6px; object-fit: cover; }    
    .vip-info { flex: 1; margin-left: 10px; }    
    .vip-info .amount { color: #2196f3; font-weight: bold; }    
    .vip-action { color: #fff; font-size: 20px; }    
    .container { max-width: 800px; margin: auto; }    
    .video-section { background-color: #1a2734; border-radius: 10px; padding: 20px; margin: 20px; }    
    video { width: 100%; border-radius: 10px; }    
    .supervisory-container { background-color: #1a2734; padding: 20px; border-radius: 10px; margin: 0 20px 40px; }    
    .supervisory-wrapper { display: flex; justify-content: space-between; align-items: flex-start; }    
    .supervisory-left, .supervisory-right { width: 48%; }    
    .supervisory-left img, .supervisory-right img { width: 100%; background: #ffffff; border-radius: 8px; padding: 5px; }    
    a { text-decoration: none; color: inherit; }    
    @keyframes scrollUp { 0% { transform: translateY(0); } 100% { transform: translateY(-100%); } }

    /* Announcement Modal */
    .announcement-modal {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background-color: rgba(0,0,0,0.8);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 9999;
    }

    .modal {
      background: #1a2734;
      width: 90%;
      max-width: 400px;
      border-radius: 14px;
      overflow: hidden;
      color: #fff;
      display: flex;
      flex-direction: column;
    }

    .modal-header {
      background: #1a2734;
      padding: 16px;
      font-size: 20px;
      font-weight: bold;
      text-align: center;
    }

    .modal-divider {
      height: 6px;
      background: linear-gradient(to right, #2196f3 40%, transparent 0%);
      border-radius: 10px;
      margin: 0 16px;
    }

    .modal-body {
      background: #ffffff;
      color: #000;
      padding: 16px;
      font-size: 14px;
      line-height: 1.5;
      height: 300px;
      overflow-y: auto;
    }

    .image-container {
      margin-top: 16px;
      width: 100%;
    }

    .image-container img {
      width: 100%;
      display: block;
      border-radius: 8px;
    }

    .modal-footer {
      display: flex;
      justify-content: space-between;
      padding: 12px 16px;
      background: #1a2734;
      border-top: 1px solid #444;
    }

    .modal-footer button {
      background: none;
      border: none;
      color: #2196f3;
      font-weight: bold;
      font-size: 15px;
      cursor: pointer;
    }

    .modal-footer button:hover {
      text-decoration: underline;
    }
    #draggable-icons {
      position: fixed;
      bottom: 100px;
      right: 20px;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      gap: 15px;
    }

    .draggable-icon {
      font-size: 30px;
      background-color: #25d366; /* WhatsApp green */
      color: white;
      padding: 12px;
      border-radius: 50%;
      cursor: move;
      box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    }

    .draggable-icon:nth-child(2) {
      background-color: #0088cc; /* Telegram blue */
    }

  </style>
</head>    
<body>    



<header>
  <h1>BlackRock</h1>
  <div class="language">🌐 English</div>
</header>
<div class="notice"><i class="fas fa-bell"></i>
<marquee behavior="scroll" direction="left" scrollamount="5">Welcome to BlackRock Investment – Your Trusted Path to Financial Growth. 

At BlackRock Investment, your financial security is our top priority. We are proud to offer a modern, reliable, and user-friendly investment platform designed to protect and grow your wealth. Using cutting-edge security technologies such as data encryption and multi-layer verification, we ensure that your funds and personal data are always safe. Our team of experienced financial experts continuously monitors the market to provide you with stable and high-return investment opportunities. Whether you're just starting your investment journey or you're a seasoned investor, BlackRock gives you access to smart tools, daily income potential, and a seamless user experience. Join thousands of satisfied users and take control of your financial future with confidence, trust, and unmatched support. Invest with BlackRock – where your success is our mission.
</marquee>
</div>

<div class="card">
  <div class="email-row">
    <div class="email"><?php echo htmlspecialchars($phone); ?></div>
    <div class="badge">Stable income</div>
  </div>
  <div class="balance-box">
    <span>Balance</span>
    <strong>ZMW <?php echo number_format($balance); ?></strong>
  </div>
  
  <div class="actions">
    <div class="action" onclick="window.location.href='recharge.php';" style="cursor: pointer;"><i class="fas fa-wallet"></i><p>Recharge</p></div>
    <div class="action" onclick="window.location.href='withdraw.php'" style="cursor: pointer;"><i class="fas fa-arrow-up"></i><p>Withdraw</p></div>
  <div class="action" onclick="location.href='app.php'">
    <i class="fas fa-download"></i>
    <p>App</p>
</div>
    <div class="action" onclick="window.location.href='company.html'">
      <i class="fas fa-building"></i>
      <p>Company</p>
    </div>
  </div>
</div>

<div class="banner"><img src="est.jpg" alt="BlackRock Banner" /></div>



<!-- LIVE UPDATES -->
<div class="container">
  <div style="display: flex; justify-content: space-between; gap: 10px;">
    <div style="flex: 1; overflow: hidden; height: 120px;">
      <div style="display: flex; flex-direction: column; gap: 10px; animation: scrollUp 10s linear infinite;">
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">+2547***2 withdrew ZMW 2,000</div>
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">07180***0 completed a task</div>
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">74631***8 referred a friend</div>
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">+254791**1 upgraded to VIP 3</div>
      </div>
    </div>
    <div style="flex: 1; overflow: hidden; height: 120px;">
      <div style="display: flex; flex-direction: column; gap: 10px; animation: scrollUp 12s linear infinite;">
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">Daniel qualified for salary</div>
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">01139***71 recharged ZMW 5,000</div>
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">07239***55 joined today</div>
        <div style="background: linear-gradient(to left, #2196f3, #00bcd4); padding: 10px; border-radius: 8px;">7221***41 earned daily income</div>
      </div>
    </div>
  </div>
</div>

<div class="section-title">Platform Introduction</div>
<div class="video-section">
  <video controls poster="thumbnail.jpg">
    <source src="mone.mp4" type="video/mp4" />
    Your browser does not support the video tag.
  </video>
</div>

<div class="section-title">Supervisory bodies</div>
<div class="supervisory-container">
  <div class="supervisory-wrapper">
    <div class="supervisory-left"><img src="in.jpg" alt="Supervisory Image Left" /></div>
    <div class="supervisory-right"><img src="aut.jpg" alt="Supervisory Image Right" /></div>
  </div>
</div>

<div class="bottom-nav">
  <a href="home.php"><div class="active"><i class="fas fa-home"></i>Home</div></a>
  <a href="task.php"><div><i class="fas fa-tasks"></i>Task</div></a>
   <a href="team.php"><div><i class="fas fa-users"></i>Team</div></a>
  <a href="vip.php"><div><i class="fas fa-crown"></i>VIP</div></a>
  <a href="me.php"><div><i class="fas fa-user"></i>Me</div></a>
</div>
<!-- Floating Draggable Icons -->
<div id="draggable-icons">
  <i class="fab fa-whatsapp draggable-icon" onclick="window.open('https://chat.whatsapp.com/JJwccrvPb7OIeGs3frjyQk?mode=ems_copy_c', '_blank')"></i>
  <i class="fab fa-telegram draggable-icon" onclick="window.open('#', '_blank')"></i>
</div>

<script>
  document.querySelectorAll('.draggable-icon').forEach(icon => {
    let isDragging = false, offsetX = 0, offsetY = 0;

    icon.addEventListener('mousedown', function (e) {
      isDragging = true;
      offsetX = e.clientX - icon.getBoundingClientRect().left;
      offsetY = e.clientY - icon.getBoundingClientRect().top;
      icon.style.position = 'fixed';
    });

    document.addEventListener('mousemove', function (e) {
      if (isDragging) {
        icon.style.left = (e.clientX - offsetX) + 'px';
        icon.style.top = (e.clientY - offsetY) + 'px';
      }
    });

    document.addEventListener('mouseup', function () {
      isDragging = false;
    });
});
</script>
<script>
  if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('service-worker.js')
      .then(function(registration) {
        console.log('ServiceWorker registered:', registration);
      })
      .catch(function(error) {
        console.log('ServiceWorker failed:', error);
      });
}
</script>
</body>
</html>

