<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Shop - SkyArtShop</title>
    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
      rel="stylesheet"
    />
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.css"
    />
    <link rel="stylesheet" href="/assets/css/main.css" />
    <style>
      .navbar-custom {
        background-color: #1a1a1a;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      }
      .page-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 60px 0;
        text-align: center;
      }
      .product-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        border: none;
        border-radius: 10px;
        overflow: hidden;
      }
      .product-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
      }
      .product-card img {
        height: 250px;
        object-fit: cover;
      }
      .footer-custom {
        background-color: #1a1a1a;
        color: #ffffff;
        padding: 40px 0;
      }
    </style>
  </head>
  <body>
    <!-- Navigation -->
    <nav class="navbar navbar-expand-lg navbar-dark navbar-custom sticky-top">
      <div class="container">
        <a class="navbar-brand" href="/">
          <i class="bi bi-palette-fill"></i> SkyArtShop
        </a>
        <button
          class="navbar-toggler"
          type="button"
          data-bs-toggle="collapse"
          data-bs-target="#navbarNav"
        >
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
          <ul class="navbar-nav ms-auto">
            <li class="nav-item"><a class="nav-link" href="/">Home</a></li>
            <li class="nav-item">
              <a class="nav-link active" href="/shop">Shop</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/portfolio">Portfolio</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/about">About</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/contact">Contact</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/admin/login"
                ><i class="bi bi-lock"></i> Admin</a
              >
            </li>
          </ul>
        </div>
      </div>
    </nav>

    <!-- Page Header -->
    <section class="page-header">
      <div class="container">
        <h1 class="display-4">Our Products</h1>
        <p class="lead">Browse our collection of premium crafting supplies</p>
      </div>
    </section>

    <!-- Products -->
    <section class="py-5">
      <div class="container">
        <div class="row mb-4">
          <div class="col-md-12">
            <p class="text-muted"><%= products.length %> products found</p>
          </div>
        </div>
        <div class="row g-4">
          <% products.forEach(p => { %>
          <div class="col-md-3 col-sm-6">
            <div class="card product-card h-100">
              <% if (p.imagepath) { %>
              <img
                src="/uploads/images/<%= p.imagepath %>"
                class="card-img-top"
                alt="<%= p.name %>"
              />
              <% } else { %>
              <div
                style="
                  height: 250px;
                  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
                  display: flex;
                  align-items: center;
                  justify-content: center;
                "
              >
                <i class="bi bi-image" style="font-size: 3rem; color: #999"></i>
              </div>
              <% } %>
              <div class="card-body">
                <h5 class="card-title"><%= p.name %></h5>
                <% if (p.description) { %>
                <p class="card-text text-muted small">
                  <%= p.description.substring(0, 80) %>...
                </p>
                <% } %>
                <div
                  class="d-flex justify-content-between align-items-center mt-3"
                >
                  <span class="h5 mb-0 text-primary"
                    >$<%= parseFloat(p.price).toFixed(2) %></span
                  >
                  <button class="btn btn-sm btn-primary">
                    <i class="bi bi-cart-plus"></i> Add to Cart
                  </button>
                </div>
              </div>
            </div>
          </div>
          <% }) %>
        </div>
      </div>
    </section>

    <!-- Footer -->
    <footer class="footer-custom mt-5">
      <div class="container">
        <div class="row">
          <div class="col-md-4 mb-4">
            <h5><i class="bi bi-palette-fill"></i> SkyArtShop</h5>
            <p class="text-muted">
              Your one-stop shop for premium scrapbooking, journaling, and
              crafting supplies.
            </p>
          </div>
          <div class="col-md-4 mb-4">
            <h5>Quick Links</h5>
            <ul class="list-unstyled">
              <li>
                <a href="/" class="text-muted text-decoration-none">Home</a>
              </li>
              <li>
                <a href="/shop" class="text-muted text-decoration-none">Shop</a>
              </li>
              <li>
                <a href="/about" class="text-muted text-decoration-none"
                  >About</a
                >
              </li>
              <li>
                <a href="/contact" class="text-muted text-decoration-none"
                  >Contact</a
                >
              </li>
            </ul>
          </div>
          <div class="col-md-4 mb-4">
            <h5>Connect With Us</h5>
            <div class="d-flex gap-3">
              <a href="#" class="text-muted"
                ><i class="bi bi-facebook fs-4"></i
              ></a>
              <a href="#" class="text-muted"
                ><i class="bi bi-instagram fs-4"></i
              ></a>
              <a href="#" class="text-muted"
                ><i class="bi bi-twitter fs-4"></i
              ></a>
            </div>
          </div>
        </div>
        <hr class="bg-light" />
        <div class="text-center text-muted">
          <p>&copy; 2025 SkyArtShop. All rights reserved.</p>
        </div>
      </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
  </body>
</html>
