<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>{{ config('app.name') }} | Product</title> 
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">

  <style>
    body {
      font-family: Arial, sans-serif;
      background: #f4fdf8;
      margin: 0;
      padding: 0;
      color: #222;
    }

    /* Header Fixed */
    .top {
      background: #FF4C4C;
      color: #fff;
      text-align: center;
      padding: 14px 0;
      font-weight: bold;
      font-size: 18px;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1000;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    .top a {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: #fff;
      text-decoration: none;
      font-size: 20px;
    }

    /* Page content offset below header */
    .content {
      padding: 70px 12px 25px;
    }

    /* Product Card */
    .product-card {
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 3px 8px rgba(0,0,0,0.08);
      overflow: hidden;
      max-width: 380px;
      margin: 20px auto;
    }

    .product-card img {
      width: 100%;
      height: 170px;
      object-fit: cover;
    }

    .product-info {
      padding: 14px;
      text-align: center;
    }

    .product-info h3 {
      margin: 6px 0;
      font-size: 18px;
      font-weight: bold;
      color: #222;
    }

    .product-info p {
      margin: 6px 0;
      font-size: 14px;
      color: #555;
    }

    /* New details box with lines */
    .details-list {
      background: #f8fcf9;
      border: 1px solid #d9f1e2;
      border-radius: 10px;
      margin-top: 12px;
      overflow: hidden;
    }

    .details-list div {
      display: flex;
      justify-content: space-between;
      padding: 10px 12px;
      font-size: 14px;
      color: #333;
      border-bottom: 1px solid #FF4C4C;
    }

    .details-list div:last-child {
      border-bottom: none;
    }

    .details-list span {
      color: #FF4C4C;
      font-weight: bold;
    }

    /* Button */
    .buy-btn {
      width: 92%;
      background: #FF4C4C;
      border: none;
      color: #fff;
      padding: 12px 0;
      border-radius: 10px;
      font-size: 16px;
      font-weight: bold;
      margin: 18px auto 16px;
      display: block;
      cursor: pointer;
      transition: 0.3s ease;
      box-shadow: 0 3px 8px rgba(0, 184, 107, 0.25);
    }

    .buy-btn:hover {
      background: #00a761;
      transform: translateY(-2px);
    }
  </style>
</head>
<body>

  <!-- Fixed Header -->
  <div class="top">
    <a href="{{ url('products.index') }}"><i class="fa-solid fa-arrow-left"></i></a>
    Product
  </div>

  <div class="content">
    <div class="product-card">
      <img src="{{ asset($package->photo) }}" alt="{{ $package->name }}">

      <div class="product-info">
        <h3>{{ $package->name }}</h3>
        <p>Cycle: <strong>{{ $package->validity }} Days</strong> | Limit: <strong>{{ $package->limit ?? 0 }}/{{ $package->max_limit ?? 1 }}</strong></p>

        <div class="details-list">
          <div>Buy Price <span>{{ price($package->price) }}</span></div>
          <div>Daily Income <span>{{ price($package->commission_with_avg_amount / $package->validity) }}</span></div>
          <div>Total Income <span>{{ price($package->commission_with_avg_amount) }}</span></div>
          <div>Stock <span>40%</span></div>
        </div>
      </div>

      <form method="POST" action="{{ route('purchase.confirmation', $package->id) }}">
        @csrf
        <button type="submit" class="buy-btn">Buy Now</button>
      </form>
    </div>
  </div>

  @include('alert-message')

</body>
</html>
