<?php
require_once("layouts/home/header.php");

// Directory path (adjust if needed)
$dir = "layouts/members/assets/img/";

// Get all image files (jpg, png, jpeg, gif, svg, webp)
$images = glob($dir . "*.{jpg,jpeg,png,gif,svg,webp}", GLOB_BRACE);
?>

<!-- Partners Section -->
<section class="py-5 text-center">
  <div class="container">
    <h3 class="mb-4">Our Business Partners</h3>
    <p class="text-muted mb-5">We proudly work with trusted and recognized brands.</p>

    <div class="row justify-content-center">
      <?php if (!empty($images)): ?>
        <?php foreach ($images as $img): 
          $name = ucfirst(pathinfo($img, PATHINFO_FILENAME)); ?>
          <div class="col-6 col-md-3 col-lg-2 mb-4">
            <div class="card border-0 shadow-sm p-3" style="border-radius:15px;">
              <img src="<?=$img?>" alt="<?=$name?>" class="img-fluid" style="max-height:80px; object-fit:contain;">
              <p class="mt-2 small text-muted"><?=$name?></p>
            </div>
          </div>
        <?php endforeach; ?>
      <?php else: ?>
        <div class="col-12">
          <p class="text-muted">No partner logos found in <code><?=$dir?></code></p>
        </div>
      <?php endif; ?>
    </div>
  </div>
</section>

<!-- Divider -->
<section class="position-relative">
  <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="192" viewBox="0 0 1440 240" preserveAspectRatio="none">
    <path class="fill-light" fill-rule="evenodd" d="M0 240V0c19.985 5.919 41.14 11.008 63.964 14.89 40.293 6.855 82.585 9.106 125.566 9.106 74.151 0 150.382-6.697 222.166-8.012 13.766-.252 27.51-.39 41.21-.39 99.76 0 197.087 7.326 282.907 31.263C827.843 72.527 860.3 117.25 906.926 157.2c43.505 37.277 115.38 51.186 208.485 53.076 7.584.153 15.156.224 22.714.224 40.887 0 81.402-2.062 121.914-4.125 40.512-2.062 81.027-4.125 121.902-4.125 1.01 0 2.019.002 3.03.004 16.208.042 34.959.792 55.029 2.234V240H0z"/>
  </svg>
</section>

<?php
require_once("layouts/home/footer.php");
?>
