<!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">
  <title>{{env('APP_NAME')}} | Home</title> 

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui@2.8.17/dist/css/layui.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css">
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">

  <style>
    :root {
      --accent-black: #1a1a1a; /* Signature Black Color */
      --accent-soft: #2e2e2e;
      --dark-gray: #333333;
      --bg-light: #fff;
    }

    * {
      box-sizing: border-box;
    }

    body {
      font-family: 'Roboto', sans-serif;
      background-color: var(--bg-light);
      margin: 0; padding: 0;
      padding-bottom: 80px;
      animation: fadeInBody 0.6s ease;
    }

    @keyframes fadeInBody {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    @keyframes fadeInUp {
      from { opacity: 0; transform: translateY(15px); }
      to { opacity: 1; transform: translateY(0); }
    }

    @keyframes popIn {
      from { opacity: 0; transform: scale(0.92); }
      to { opacity: 1; transform: scale(1); }
    }

    /* ðŸ”¹ Header Section */
    .top-header {
      padding: 15px 20px;
      background: #fff;
      display: flex;
      justify-content: space-between;
      align-items: center;
      animation: fadeInUp 0.5s ease both;
    }

    .top-header h2 {
      font-size: 20px;
      font-weight: 700;
      color: var(--accent-black); 
      margin: 0;
    }

    .top-header i {
      transition: transform 0.25s ease, color 0.25s ease;
      cursor: pointer;
    }

    .top-header i:hover {
      transform: scale(1.15);
      color: var(--accent-soft) !important;
    }

    /* ðŸ”¹ Main Banner Area (Updated for Swiper Slider) */
    .hero-banner {
      margin: 0 15px;
      border-radius: 20px;
      overflow: hidden;
      height: 180px;
      background: var(--accent-black);
      animation: popIn 0.6s ease 0.1s both;
    }

    .hero-banner .swiper-slide {
      width: 100%;
      height: 100%;
    }

    .hero-banner img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: transform 6s ease;
    }

    .swiper-slide-active img {
      transform: scale(1.05);
    }

    /* Style for the active slide dots */
    .hero-banner .swiper-pagination-bullet-active {
      background: #fff !important;
    }

    /* ðŸ”¹ Navigation Grid (8 Icons) - UPDATED FOR BLACK BG VISIBILITY */
    .nav-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 15px;
      padding: 25px 15px;
      background: #fff;
    }

    .nav-item {
      text-align: center;
      text-decoration: none;
      animation: fadeInUp 0.5s ease both;
      transition: transform 0.2s ease;
    }

    .nav-item:active {
      transform: scale(0.93);
    }

    .nav-item:nth-child(1) { animation-delay: 0.05s; }
    .nav-item:nth-child(2) { animation-delay: 0.1s; }
    .nav-item:nth-child(3) { animation-delay: 0.15s; }
    .nav-item:nth-child(4) { animation-delay: 0.2s; }
    .nav-item:nth-child(5) { animation-delay: 0.25s; }
    .nav-item:nth-child(6) { animation-delay: 0.3s; }
    .nav-item:nth-child(7) { animation-delay: 0.35s; }
    .nav-item:nth-child(8) { animation-delay: 0.4s; }

    .nav-item .icon-wrapper {
      width: 55px;
      height: 55px;
      background: var(--accent-black) !important; /* Force true black background */
      border-radius: 12px;
      margin: 0 auto 8px;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden; /* Prevent custom images bleeding past edges */
      transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    }

    .nav-item:hover .icon-wrapper {
      transform: translateY(-4px);
      box-shadow: 0 8px 16px rgba(0,0,0,0.18);
      background: var(--accent-soft) !important;
    }

    .nav-item img {
      width: 32px;  /* Sized down to leave structural framing for the black background */
      height: 32px; 
      object-fit: contain;
      display: block;
    }

    .nav-item span {
      font-size: 12px;
      color: #1e293b;
      font-weight: 500;
      display: block;
    }

    /* ðŸ”¹ Product Section */
    .product-card {
      background: #fff;
      margin: 15px;
      border-radius: 15px;
      padding: 15px;
      position: relative;
      box-shadow: 0 2px 10px rgba(0,0,0,0.03);
      animation: fadeInUp 0.5s ease both;
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .product-card:hover {
      transform: translateY(-4px);
      box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    }

    .product-badge {
      position: absolute;
      right: 0; top: 0;
      background: #ff0000;
      color: white;
      padding: 4px 15px;
      border-radius: 0 15px 0 15px;
      font-size: 12px;
      font-weight: 700;
      animation: popIn 0.4s ease 0.2s both;
    }

    .product-title {
      color: var(--accent-black);
      font-weight: 700;
      font-size: 18px;
      margin-bottom: 10px;
    }

    .product-body {
      display: flex;
      align-items: center;
    }

    .product-img {
      width: 50%;
      overflow: hidden;
      border-radius: 10px;
    }

    .product-img img {
      width: 100%;
      transition: transform 0.4s ease;
    }

    .product-card:hover .product-img img {
      transform: scale(1.06);
    }

    .product-stats {
      width: 60%;
      padding-left: 20px;
    }

    .product-stats p {
      margin: 5px 0;
      font-size: 14px;
      color: #64748b;
      display: flex;
      justify-content: space-between;
    }

    .product-stats span {
      color: #1e293b;
      font-weight: 700;
    }

    .layui-btn-fluid {
      transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .layui-btn-fluid:hover {
      opacity: 0.9;
    }

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

    /* ðŸ”¹ Support / Join Group Modal */
    .support-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 15, 15, 0.55);
      backdrop-filter: blur(3px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
      padding: 20px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease;
    }

    .support-modal-overlay.is-open {
      opacity: 1;
      pointer-events: auto;
    }

    .support-modal {
      background: #fff;
      width: 100%;
      max-width: 340px;
      border-radius: 20px;
      padding: 28px 22px 22px;
      position: relative;
      text-align: center;
      box-shadow: 0 20px 50px rgba(0,0,0,0.25);
      transform: translateY(14px) scale(0.96);
      opacity: 0;
      transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    }

    .support-modal-overlay.is-open .support-modal {
      transform: translateY(0) scale(1);
      opacity: 1;
    }

    .support-modal-close {
      position: absolute;
      top: 14px;
      right: 14px;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: #f4f6f8;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: #64748b;
      font-size: 16px;
      transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
      border: none;
    }

    .support-modal-close:hover {
      background: var(--accent-black);
      color: #fff;
      transform: rotate(90deg);
    }

    .support-modal-icon {
      width: 64px;
      height: 64px;
      margin: 0 auto 14px;
      border-radius: 16px;
      background: var(--accent-black);
      display: flex;
      align-items: center;
      justify-content: center;
      animation: popIn 0.4s ease 0.05s both;
    }

    .support-modal-icon img {
      width: 36px;
      height: 36px;
      object-fit: contain;
    }

    .support-modal h3 {
      font-size: 18px;
      font-weight: 700;
      color: #1e293b;
      margin: 0 0 6px;
    }

    .support-modal p.subtext {
      font-size: 13px;
      color: #64748b;
      margin: 0 0 22px;
      line-height: 1.5;
    }

    .support-modal-actions {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .support-btn {
      width: 100%;
      padding: 13px;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 700;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-decoration: none;
      transition: transform 0.2s ease, box-shadow 0.25s ease, opacity 0.2s ease;
    }

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

    .support-btn-group {
      background: var(--accent-black);
      color: #fff;
    }

    .support-btn-group:hover {
      background: var(--accent-soft);
      box-shadow: 0 6px 14px rgba(0,0,0,0.18);
    }

    .support-btn-chat {
      background: #f4f6f8;
      color: #1e293b;
    }

    .support-btn-chat:hover {
      background: #e9edf1;
    }

    .support-btn img {
      width: 18px;
      height: 18px;
      object-fit: contain;
    }

    .support-modal-cancel {
      margin-top: 14px;
      font-size: 13px;
      color: #94a3b8;
      cursor: pointer;
      background: none;
      border: none;
      font-weight: 500;
      transition: color 0.2s ease;
    }

    .support-modal-cancel:hover {
      color: #1e293b;
    }
  </style>
</head>
<body>

  <div class="top-header">
    <h2>Home</h2>
    <div>
      <i class="layui-icon layui-icon-chat" style="font-size: 24px; color: #1a1a1a;" onclick="openSupportModal()"></i>
      <i class="layui-icon layui-icon-headset" style="font-size: 24px; color: #1a1a1a; margin-left: 15px;" onclick="openSupportModal()"></i>
    </div>
  </div>

  <div class="swiper hero-banner">
    <div class="swiper-wrapper">
      <div class="swiper-slide">
        <img src="https://www.gadgetmatch.com/wp-content/uploads/2024/12/iQOO-13-Colorway-Rear.jpg" alt="Banner 1">
      </div>
      <div class="swiper-slide">
        <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSPmDVH9-Kv4RqEQ0n1syrt-ORmCooi5Tx3oD4LWf6n3LTA3wSl8LUD9sUh&s=10" alt="Banner 2">
      </div>
      <div class="swiper-slide">
        <img src="https://www.notebookcheck.net/fileadmin/Notebooks/News/_nc5/iQoo-15-ultra.png" alt="Banner 3">
      </div>
    </div>
    <div class="swiper-pagination"></div>
  </div>

  <div class="nav-grid">
    <a href="/user/recharge" class="nav-item">
      <div class="icon-wrapper"><img src="https://img.icons8.com/?size=100&id=Equ51VYci0uQ&format=png&color=FFFFFF"></div>
      <span>Recharge</span>
    </a>
    <a href="/withdraw" class="nav-item">
      <div class="icon-wrapper"><img src="https://img.icons8.com/?size=100&id=RY8gfnvdIsdN&format=png&color=FFFFFF"></div>
      <span>Withdraw</span>
    </a>
    <a href="/get-bonus" class="nav-item">
      <div class="icon-wrapper"><img src="https://img.icons8.com/?size=100&id=W9z7ceYLkNGj&format=png&color=FFFFFF"></div>
      <span>Gift Code</span>
    </a>
    <a href="/invitation-task" class="nav-item">
      <div class="icon-wrapper"><img src="https://img.icons8.com/?size=100&id=2koI9uU0dBK7&format=png&color=FFFFFF"></div>
      <span>Invitation Task</span>
    </a>
  </div>

  <div class="product-section">
    @foreach ($packages as $package)
    <div class="product-card">
      <div class="product-badge">Hot Product</div>
      <div class="product-title">{{ $package->name }}</div>
      <div class="product-body">
        <div class="product-img">
          <img src="{{ asset($package->photo) }}" alt="Bike">
        </div>
        <div class="product-stats">
          <p>Price: <span>₱{{ $package->price }}</span></p>
          <p>Daily income: <span>₱{{ number_format($package->commission_with_avg_amount / $package->validity, 2) }}</span></p>
          <p>Total income: <span>₱{{ $package->commission_with_avg_amount }}</span></p>
        </div>
      </div>
      <a href="{{ route('vip.details', $package->id) }}" style="text-decoration:none;">
        <button class="layui-btn layui-btn-fluid" style="background: var(--accent-black); border-radius: 10px; margin-top:15px; font-weight:700;">
          Buy ₱{{ $package->price }}
        </button>
      </a>
    </div>
    @endforeach
  </div>
@include('alert-message')

  <!-- ðŸ”¹ Support / Join Group Modal -->
  <div class="support-modal-overlay" id="supportModalOverlay" onclick="if(event.target === this) closeSupportModal()">
    <div class="support-modal">
      <button class="support-modal-close" onclick="closeSupportModal()" aria-label="Close">
        <i class="layui-icon layui-icon-close"></i>
      </button>

      <div class="support-modal-icon">
        <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Iqoo.svg/3840px-Iqoo.svg.png" alt="iQOO">
      </div>

      <h3>Join the iQOO Community</h3>
      <p class="subtext">Stay updated with exclusive offers, or chat directly with our support team for help anytime.</p>

      <div class="support-modal-actions">
        <a href="https://t.me/iqoo_official_group" target="_blank" class="support-btn support-btn-group">
          <img src="https://img.icons8.com/?size=100&id=F4ZPUh2Mk5tk&format=png&color=FFFFFF" alt="Telegram">
          Join iQOO Group
        </a>
        <a href="https://t.me/IQOO_rohan" target="_blank" class="support-btn support-btn-chat">
          <img src="https://img.icons8.com/?size=100&id=F4ZPUh2Mk5tk&format=png&color=1A1A1A" alt="Support">
          Message Support
        </a>
      </div>

      <button class="support-modal-cancel" onclick="closeSupportModal()">Cancel</button>
    </div>
  </div>

<style>
  :root {
    --accent-black: #1a1a1a;
    --inactive-color: #94a3b8;
    --nav-bg: rgba(255, 255, 255, 0.95);
  }

  .foot {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid rgba(0,0,0,0.05);
    z-index: 9999;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.03);
  }

  .foot ul {
    width: 100%;
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: flex-end;
  }

  .foot li {
    flex: 1;
    text-align: center;
    position: relative;
  }

  .foot li a {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--inactive-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .foot li img {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
    filter: grayscale(1) opacity(0.4);
    transition: all 0.4s ease;
  }

  .foot li p {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
  }

  .foot li.cur a {
    color: var(--accent-black);
  }

  .foot li.cur img {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
    transform: translateY(-5px) scale(1.2);
  }

  .foot li.cur::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-black);
    border-radius: 50%;
  }

  .foot li.cur p {
    font-weight: 800;
  }
</style>

<ul>
  <div class="foot">
    <li class="cur">
      <a href="/dashboard">
        <img src="https://cdn-icons-png.flaticon.com/512/1946/1946436.png" alt="Home">
        <p>Home</p>
      </a>
    </li>
    <li>
      <a href="/ordered">
        <img src="https://cdn-icons-png.flaticon.com/512/1170/1170678.png" alt="Order">
        <p>Order</p>
      </a>
    </li>
    <li>
      <a href="/my-team">
        <img src="https://cdn-icons-png.flaticon.com/512/912/912318.png" alt="Team">
        <p>Team</p>
      </a>
    </li>
    <li>
      <a href="/my-profile">
        <img src="https://cdn-icons-png.flaticon.com/512/1077/1077063.png" alt="Mine">
        <p>Mine</p>
      </a>
    </li>
  </div>
</ul>

  <script src="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.js"></script>
  <script>
    // ðŸ”¹ Initialize Swiper Loop Slider for Hero Banner
    const bannerSwiper = new Swiper('.hero-banner', {
      loop: true,                         
      spaceBetween: 0,                    
      autoplay: {
        delay: 3000,                      
        disableOnInteraction: false,      
      },
      pagination: {
        el: '.swiper-pagination',         
        clickable: true,
      },
    });

    // Logic for tab switching if you use multiple categories
    document.querySelectorAll('.record-tab a').forEach(tab => {
      tab.addEventListener('click', function() {
        document.querySelector('.record-tab a.active').classList.remove('active');
        this.classList.add('active');
      });
    });

    // ðŸ”¹ Support Modal Logic
    function openSupportModal() {
      document.getElementById('supportModalOverlay').classList.add('is-open');
      document.body.style.overflow = 'hidden';
    }

    function closeSupportModal() {
      document.getElementById('supportModalOverlay').classList.remove('is-open');
      document.body.style.overflow = '';
    }

    // Close on Escape key
    document.addEventListener('keydown', function(e) {
      if (e.key === 'Escape') closeSupportModal();
    });

    // ðŸ”¹ Auto-open the support modal shortly after the page loads/refreshes
    window.addEventListener('DOMContentLoaded', function() {
      setTimeout(openSupportModal, 800);
    });
  </script>
</body>
</html>
