<!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, viewport-fit=cover"> 
  <title>Bonus - TATA</title> 

  <!-- External Styles -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"/>
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/layui/2.8.17/css/layui.css">

  <!-- CSRF -->
  <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">

  <style>
    * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

    body {
      font-family: 'Poppins', sans-serif;
      /* আপনার থিমের এনিমেটেড ব্যাকগ্রাউন্ড */
      background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #ff8c00);
      background-size: 400% 400%;
      animation: gradientBG 15s ease infinite;
      color: #fff;
      min-height: 100vh;
      display: flex;
      justify-content: center;
      padding-top: 20px;
      overflow-x: hidden;
    }

    @keyframes gradientBG {
      0% { background-position: 0% 50%; }
      50% { background-position: 100% 50%; }
      100% { background-position: 0% 50%; }
    }

    .app-container {
      width: 92%;
      max-width: 380px; /* পারফেক্ট মোবাইল সাইজ */
    }

    /* টপ ন্যাভিগেশন */
    .header-nav {
      display: flex;
      align-items: center;
      gap: 15px;
      margin-bottom: 25px;
    }
    .header-nav a { color: #fff; text-decoration: none; font-size: 20px; }
    .header-nav h2 { font-size: 18px; font-weight: 600; letter-spacing: 0.5px; }

    /* ব্যালেন্স কার্ড - গোল্ডেন লুক */
    .balance-card {
      background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
      padding: 15px 20px;
      border-radius: 15px;
      color: #222;
      box-shadow: 0 8px 20px rgba(0,0,0,0.2);
      margin-bottom: 25px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .balance-card span { font-size: 12px; font-weight: 600; opacity: 0.8; }
    .balance-card h3 { font-size: 20px; font-weight: 800; }

    /* বোনাস ফর্ম - গ্লাস ইফেক্ট */
    .bonus-box {
      background: rgba(255, 255, 255, 0.12);
      backdrop-filter: blur(15px);
      padding: 30px 20px;
      border-radius: 25px;
      border: 1px solid rgba(255, 255, 255, 0.2);
      text-align: center;
    }

    .gift-icon {
      font-size: 50px;
      color: #FFD700;
      margin-bottom: 15px;
      filter: drop-shadow(0 0 10px rgba(255,215,0,0.3));
    }

    .input-label {
      display: block;
      font-size: 13px;
      color: #FFD700;
      margin-bottom: 10px;
      font-weight: 500;
    }

    .input-wrap {
      position: relative;
      margin-bottom: 20px;
    }

    .input-wrap i {
      position: absolute;
      left: 15px;
      top: 50%;
      transform: translateY(-50%);
      color: #FFD700;
    }

    .input-wrap input {
      width: 100%;
      padding: 13px 15px 13px 45px;
      background: rgba(0, 0, 0, 0.2);
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 12px;
      color: #fff;
      font-size: 16px; /* ১৬পিএক্স জুম আটকানোর জন্য */
      outline: none;
      text-align: center;
    }

    .input-wrap input:focus {
      border-color: #FFD700;
      background: rgba(0, 0, 0, 0.3);
    }

    /* বাটন */
    .claim-btn {
      width: 100%;
      padding: 15px;
      background: linear-gradient(90deg, #FF8C00, #FF4500);
      border: none;
      border-radius: 12px;
      color: #fff;
      font-size: 15px;
      font-weight: 700;
      text-transform: uppercase;
      cursor: pointer;
      box-shadow: 0 5px 15px rgba(255, 69, 0, 0.4);
      letter-spacing: 1px;
    }

    .claim-btn:active { transform: scale(0.97); }

    /* মেসেজ বক্স */
    #messageBox {
      margin-top: 15px;
      font-size: 13px;
      padding: 10px;
      border-radius: 10px;
      display: none;
    }
    .msg-success { background: rgba(0, 255, 0, 0.1); border: 1px solid #00ff00; color: #00ff00; }
    .msg-error { background: rgba(255, 0, 0, 0.1); border: 1px solid #ff0000; color: #ff0000; }

  </style>
</head> 
<body> 

<div class="app-container">
  
  <!-- Top Header -->
  <div class="header-nav">
    <a href="<?php echo e(route('dashboard')); ?>"><i class="fa-solid fa-chevron-left"></i></a>
    <h2>Claim Bonus</h2>
  </div>

  <!-- Wallet Bar -->
  <div class="balance-card">
    <span>MY BALANCE</span>
    <h3><?php echo e(price(auth()->user()->balance ?? 0)); ?></h3>
  </div>

  <!-- Bonus Redeem Box -->
  <div class="bonus-box">
    <div class="gift-icon"><i class="fa-solid fa-gift"></i></div>
    <label class="input-label">Enter Gift Code</label>
    
    <form id="bonusForm">
      <div class="input-wrap">
        <i class="fa-solid fa-ticket"></i>
        <input type="text" name="bonus_code" placeholder="Enter bonus code" required>
      </div>
      
      <button type="submit" class="claim-btn">Obtain Reward</button> 
    </form>

    <div id="messageBox"></div>
  </div> 

</div>

  <!-- Scripts -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/layui/2.8.17/layui.js"></script>
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js"></script>

  <script>
    layui.use(['form', 'layer'], function(){
      var layer = layui.layer;

      $('#bonusForm').on('submit', function(e){
        e.preventDefault();
        layer.load(2, {shade: [0.3,'#000']});
        $('#messageBox').hide().removeClass('msg-success msg-error');

        $.ajax({
          url: "<?php echo e(route('user.submit-bonus')); ?>",
          method: "POST",
          headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          },
          data: $(this).serialize(),
          success: function(res){
            layer.closeAll('loading');
            if(res.status === 1){
              $('#messageBox').text(res.message).addClass('msg-success').fadeIn();
              layer.msg(res.message, {icon: 1});
              showConfetti();
            } else {
              $('#messageBox').text(res.message).addClass('msg-error').fadeIn();
              layer.msg(res.message, {icon: 2});
            }
          },
          error: function(){
            layer.closeAll('loading');
            $('#messageBox').text("Server Error!").addClass('msg-error').fadeIn();
          }
        });
      });
    });

    function showConfetti() {
      const duration = 3 * 1000;
      const animationEnd = Date.now() + duration;
      const interval = setInterval(function() {
        if (Date.now() > animationEnd) return clearInterval(interval);
        confetti({
          particleCount: 50,
          startVelocity: 30,
          spread: 360,
          origin: { x: Math.random(), y: Math.random() - 0.2 }
        });
      }, 200);
    }
  </script>

</body>
</html><?php /**PATH /home/goldenyi/public_html/resources/views/app/main/bonus/index.blade.php ENDPATH**/ ?>