<?php $__env->startSection('title', 'Market'); ?>

<?php $__env->startSection('content'); ?>

<div style="display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:1.5rem">
  <div>
    <h1 style="font-size:1.625rem;font-weight:700;color:var(--foreground);letter-spacing:-.03em;line-height:1.2;margin:0 0 .25rem">Market</h1>
    <p style="font-size:.875rem;color:var(--muted-foreground);margin:0">Browse and purchase software, plugins, modules, and more.</p>
  </div>
</div>


<form method="GET" style="display:flex;align-items:center;gap:.625rem;margin-bottom:1.75rem;flex-wrap:wrap">
  <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="Search products..."
    style="padding:.5rem .875rem;border:1px solid var(--border);border-radius:var(--radius);
      background:var(--card);color:var(--foreground);font-size:.875rem;font-family:inherit;
      outline:none;width:220px;transition:border-color .12s"
    onfocus="this.style.borderColor='var(--foreground)'"
    onblur="this.style.borderColor='var(--border)'">

  <select name="type" onchange="this.form.submit()"
    style="padding:.5rem .875rem;border:1px solid var(--border);border-radius:var(--radius);
      background:var(--card);color:var(--foreground);font-size:.875rem;font-family:inherit;
      outline:none;cursor:pointer;appearance:none;min-width:110px">
    <option value="">All Types</option>
    <?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <option value="<?php echo e($t); ?>" <?php if(request('type')===$t): echo 'selected'; endif; ?>><?php echo e(ucfirst($t)); ?></option>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
  </select>

  <button type="submit"
    style="padding:.5rem .875rem;border:1px solid var(--border);border-radius:var(--radius);
      background:var(--card);color:var(--foreground);font-size:.875rem;font-family:inherit;
      cursor:pointer;transition:background .12s"
    onmouseover="this.style.background='var(--muted)'" onmouseout="this.style.background='var(--card)'">
    Filter
  </button>

  <?php if(request()->anyFilled(['search','type'])): ?>
  <a href="<?php echo e(route('customer.market')); ?>"
     style="padding:.5rem .75rem;font-size:.8125rem;color:var(--muted-foreground);
       text-decoration:none;transition:color .12s"
     onmouseover="this.style.color='var(--foreground)'" onmouseout="this.style.color='var(--muted-foreground)'">
    Clear
  </a>
  <?php endif; ?>
</form>


<?php $typeIcons=['software'=>'💻','plugin'=>'🔌','module'=>'🧩','theme'=>'🎨','api'=>'⚡','website'=>'🌐','script'=>'📜','desktop'=>'🖥️','saas'=>'☁️']; ?>

<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:.875rem">
  <?php $__empty_1 = true; $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
  <div style="background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
    display:flex;flex-direction:column;transition:box-shadow .15s"
    onmouseover="this.style.boxShadow='0 2px 10px rgba(0,0,0,.06)'"
    onmouseout="this.style.boxShadow='none'">

    
    <div style="padding:1.25rem 1.25rem 1rem;border-bottom:1px solid var(--border)">
      <div style="display:flex;align-items:center;gap:.75rem;margin-bottom:.875rem">
        
        <div style="width:2.5rem;height:2.5rem;border-radius:.5rem;background:var(--muted);
          border:1px solid var(--border);display:flex;align-items:center;
          justify-content:center;font-size:1.125rem;flex-shrink:0">
          <?php echo e($typeIcons[$product->type]??'-'); ?>

        </div>
        <div>
          <div style="font-size:.9375rem;font-weight:700;color:var(--foreground);line-height:1.3;margin-bottom:.25rem">
            <?php echo e($product->name); ?>

          </div>
          <div style="display:flex;align-items:center;gap:.375rem">
            <span style="padding:.1rem .45rem;border-radius:.35rem;font-size:.6875rem;font-weight:600;
              background:var(--muted);color:var(--muted-foreground);border:1px solid var(--border)">
              <?php echo e(ucfirst($product->type)); ?>

            </span>
            <span style="font-size:.6875rem;color:var(--muted-foreground)">v<?php echo e($product->version); ?></span>
          </div>
        </div>
      </div>

      <p style="font-size:.8125rem;color:var(--muted-foreground);line-height:1.6;margin:0;
        display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden">
        <?php echo e($product->short_description ?? 'No description available.'); ?>

      </p>
    </div>

    
    <div style="padding:.875rem 1.25rem;display:flex;align-items:center;justify-content:space-between">
      <div>
        <?php $taxInfo = user_tax_info(); ?>
        <div style="font-size:1rem;font-weight:700;color:var(--foreground)">
          <?php echo e(fmt_price($product->price)); ?>

        </div>
        <div style="font-size:.72rem;color:var(--muted-foreground);margin-top:.15rem">
          <?php if($taxInfo['enabled'] && $taxInfo['rate'] > 0): ?>
            excl. <?php echo e(number_format($taxInfo['rate'], 1)); ?>% tax
            &nbsp;·&nbsp;
          <?php endif; ?>
          <?php echo e($product->licenses_count); ?> <?php echo e(Str::plural('license', $product->licenses_count)); ?> sold
        </div>
      </div>

      <a href="<?php echo e(route('customer.market.show',$product)); ?>"
         style="display:inline-flex;align-items:center;gap:.3rem;padding:.4rem .875rem;
           border-radius:var(--radius);font-size:.8rem;font-weight:500;
           color:var(--foreground);background:var(--card);
           border:1px solid var(--border);text-decoration:none;transition:all .12s"
         onmouseover="this.style.background='var(--foreground)';this.style.color='var(--card)';this.style.borderColor='var(--foreground)'"
         onmouseout="this.style.background='var(--card)';this.style.color='var(--foreground)';this.style.borderColor='var(--border)'">
        View
        <svg width="12" height="12" fill="none" stroke="currentColor" viewBox="0 0 24 24">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
        </svg>
      </a>
    </div>
  </div>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
  <div style="grid-column:1/-1;background:var(--card);border:1px solid var(--border);
    border-radius:var(--radius);padding:4rem;text-align:center">
    <div style="font-size:2.5rem;margin-bottom:.75rem">🛒</div>
    <div style="font-size:.9375rem;font-weight:600;color:var(--foreground);margin-bottom:.375rem">No products found</div>
    <p style="font-size:.875rem;color:var(--muted-foreground)">Try adjusting your search or filter.</p>
  </div>
  <?php endif; ?>
</div>

<?php if($products->hasPages()): ?>
<div style="margin-top:1.5rem"><?php echo e($products->links()); ?></div>
<?php endif; ?>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.customer', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\License system\license-platform\resources\views/customer/market/index.blade.php ENDPATH**/ ?>