<?php include 'include/header.php';?>
<?php include 'include/navbar.php';?>
 <style>
  
    .section-title {
      color: #00796B;
    }
    .blog-card {
      border: 1px solid #eee;
      border-radius: 10px;
      transition: 0.3s;
    }
    .blog-card:hover {
      box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    }
    .blog-image {
      border-top-left-radius: 10px;
      border-top-right-radius: 10px;
      height: 200px;
      object-fit: cover;
    }
    .blog-image {
      max-height: 400px;
      object-fit: cover;
      width: 100%;
    }
    .blog-card h5{
        color: #00796B;
    }
  </style>
<div style="background-image:url('img/about-us.jpg'); background-size: cover; background-repeat: no-repeat;">
<header class="py-5 text-center" style="background-color:rgb(000, 000, 000,0.8);">
  <div class="container">
    <h1 class="text-white section-title">Blog</h1>
    <p class="text-white">Explore expert visa tips, global travel updates, and real stories from <?php echo $info['website_name']; ?> <br>your trusted guide to hassle-free international journeys.</p>
  </div>
</header>
</div>





<section class="py-5">
  <div class="container">
    <div class="row g-4">
      <?php
      $sql = "SELECT * FROM blogs ORDER BY id DESC";
      $result = $conn->query($sql);

      if ($result->num_rows > 0) {
          while ($row = $result->fetch_assoc()) {
              $title = $row['title'];
              $image = $row['image'];
              $date = $row['date'];
              $short_description = $row['short_description'];
              $id = $row['id'];
              ?>
              <div class="col-md-4 mt-3">
                <div class="blog-card">
                  <img src="admin/<?php echo $image; ?>" class="img-fluid blog-image" alt="Blog Image">
                  <div class="p-3">
                    <h5 class="fw-bold"><?php echo $title; ?></h5>
                    <p class="small text-muted"><?php echo $date; ?> · 3 min read</p>
                    <p><?php echo substr($short_description, 0, 100); ?>...</p>
                    <a href="blog-details.php?id=<?php echo $id; ?>" class="btn btn-sm btn-outline-warning text-dark">Read More</a>
                  </div>
                </div>
              </div>
              <?php
          }
      } else {
          echo "<p>No blog posts found.</p>";
      }
      ?>
    </div>
  </div>
</section>







 <?php include 'include/footer.php';?>