<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>VIP Investment Page</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
  <style>
    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: 'Roboto', sans-serif;
    }

    body {
      background: #0f1a24;
      padding: 10px;
      padding-bottom: 80px;
      color: #fff;
    }

    .tabs {
      display: flex;
      justify-content: center;
      margin-bottom: 15px;
    }

    .tab {
      padding: 8px 20px;
      border-radius: 20px;
      margin: 0 5px;
      font-weight: bold;
      text-align: center;
    }

    .tab.active {
      background: linear-gradient(45deg, #1e3c72, #2a5298);
      color: white;
      width: 160px;
      box-shadow: 0 0 10px rgba(0,191,255,0.5);
    }

    .tab.inactive {
      background: #16222a;
      color: #ccc;
      width: 160px;
      border: 1px solid #1ca7ec;
    }

    .product-card {
      background: linear-gradient(to bottom, #16222a, #0f1a24);
      border-radius: 15px;
      margin: 15px 0;
      padding: 15px;
      box-shadow: 0 0 8px rgba(0, 191, 255, 0.3);
    }

    .card-header {
      display: flex;
      align-items:center;
    }
    .card-header img {
      width: 60px;
      height: 60px;
      margin-right: 10px;
      border-radius: 10px;
    }

    .card-title {
      font-weight: bold;
      font-size: 16px;
      color: #00bfff;
    }

    .card-price {
      color: #ffb700;
      font-weight: bold;
      margin-top: 5px;
    }

    .card-info {
      margin-top: 5px;
      font-size: 14px;
      color: #ccc;
    }

    .card-bottom {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 15px;
    }

    .income-block {
      text-align: left;
      font-size: 14px;
    }

    .income-block span {
      display: block;
      margin-bottom: 3px;
    }

    .income-block strong {
      color: #1ca7ec;
    }

    .invest-btn {
      background: linear-gradient(to right, #1e3c72, #2a5298);
      color: white;
      border: none;
      padding: 8px 20px;
      border-radius: 20px;
      font-weight: bold;
      cursor: pointer;
      transition: 0.3s;
    }
    .invest-btn:hover {
      background: linear-gradient(to right, #2a5298, #1ca7ec);
    }

    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      background: #16222a;
      display: flex;
      justify-content: space-around;
      padding: 10px 0;
      border-top: 1px solid #1ca7ec;
    }
    .bottom-nav div {
      text-align: center;
      font-size: 13px;
      color: #ccc;
    }
    .bottom-nav div.active {
      color: #00bfff;
    }
    .bottom-nav i {
      display: block;
      font-size: 18px;
      margin-bottom: 4px;
    }

    .flash-message {
      position: fixed;
      top: 20px;
      left: 50%;
      transform: translateX(-50%);
      background: #1ca7ec;
      color: #fff;
      border: 1px solid #00bfff;
      padding: 12px 20px;
      border-radius: 50px;
      box-shadow: 0 0 15px #00bfff;
      z-index: 9999;
      font-weight: bold;
      animation: glow 1s infinite alternate, fadeOut 1s ease-in-out 4s forwards;
    }

    @keyframes glow {
      from {
        box-shadow: 0 0 10px #00bfff;
      }
      to {
        box-shadow: 0 0 20px #1ca7ec, 0 0 30px #00bfff;
      }
    }

    @keyframes fadeOut {
      to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
        visibility: hidden;
      }
    }

    a {
      text-decoration: none;
      color: inherit;
    }
  </style>
</head>
<body>
<?php if (isset($_SESSION['invest_message'])): ?>
  <div class="flash-message">
    <span class="message-text"><?php echo $_SESSION['invest_message']; ?> ✨</span>
  </div>
  <?php unset($_SESSION['invest_message']); ?>
<?php endif; ?>

  <div class="tabs">
    <div class="tab active">Product</div>
    <div class="tab inactive" onclick="window.location.href='my_package.php'">My Product</div>
  </div>

  <!-- ===== ALL PRODUCTS ===== -->
<?php
$products = [
    ["Stable Income", 0, 1, 10, 10], 
    ["Fintech", 150, 45, 15, 675],
    ["Smart Investing", 300, 45, 30, 1350],
    ["Advance Algorithms", 500, 45, 50, 2250],
    ["Hedging Strategies", 700, 45, 70, 3150],
    ["Diversified Investments", 1000, 45, 100, 4500],
    ["Precision Investments", 1500, 45, 150, 6750],
    ["Financial Freedom", 2000, 45, 200, 9000],
    ["Supreme", 5000, 45, 500, 22500],
    ["Ultimate", 7500, 45, 750, 33750],
    ["Legendary", 10000, 45, 1000, 45000],
    ["Titanium", 15000, 45, 1500, 67500], 
    ["Elite", 20000, 45, 2000, 90000],
];
  foreach ($products as $p): ?>
  <div class="product-card">
    <div class="card-header">
      <img src="ai.jpg" alt="AI" />
      <div>
        <div class="card-title"><?= $p[0] ?></div>
        <div class="card-price">Price: ZMW<?= number_format($p[1]) ?></div>
        <div class="card-info">Investment Cycle(Days): <?= $p[2] ?></div>
      </div>
    </div>
    <div class="card-bottom">
      <div class="income-block">
        <span><strong>ZMW <?= number_format($p[3]) ?></strong></span>
        <span style="color: gray;">Daily Income</span>
      </div>
      <div class="income-block">
        <span><strong>ZMW <?= number_format($p[4]) ?></strong></span>
        <span style="color: gray;">Total Income</span>
      </div>
      <form action="invest_now.php" method="POST">
        <input type="hidden" name="amount" value="<?= $p[1] ?>">
        <input type="hidden" name="cycle_days" value="<?= $p[2] ?>">
        <input type="hidden" name="daily_income" value="<?= $p[3] ?>">
        <?php if ($p[1] > 0): ?>
          <button type="submit" class="invest-btn">Unlock Now</button>
        <?php endif; ?>
      </form>
    </div>
  </div>
  <?php endforeach; ?>

  <div class="bottom-nav">
    <a href="home.php"><div><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 class="active"><i class="fas fa-crown"></i>VIP</div></a>
    <a href="me.php"><div><i class="fas fa-user"></i>Me</div></a>
  </div>

  <script>
    setTimeout(() => {
      const msg = document.querySelector('.flash-message');
      if (msg) msg.remove();
    }, 5000);
  </script>
</body>
</html>
