<template>
  <section id="menu" class="featured">
    <h2>Popular Dishes</h2>
    <div class="dishes">
      <div
        v-for="dish in dishes"
        :key="dish.id"
        class="dish"
      >
        <img
          :src="dish.image"
          width="280"
          height="280"
          :alt="dish.alt"
        />
        <h3>{{ dish.name }}</h3>
        <p>{{ dish.description }}</p>
        <div class="card-actions">
          <a
            :href="dish.whatsappLink"
            class="whatsapp-button"
            target="_blank"
            rel="noopener"
          >
            WhatsApp
          </a>
          <button
            class="detail-button"
            type="button"
          >
            {{ dish.detailLabel }}
          </button>
        </div>
      </div>
    </div>
  </section>
</template>

<script setup>
import spaghettiImg from "@/assets/spaghetti.jpg";
import steakImg from "@/assets/steak.jpg";
import saladImg from "@/assets/salad.jpg";

const whatsappLink = "https://wa.me/1234567890";

const dishes = [
  {
    id: "spaghetti",
    name: "Spaghetti Carbonara",
    description: "Classic Italian pasta with creamy sauce and pancetta.",
    image: spaghettiImg,
    alt: "Spaghetti Carbonara",
    whatsappLink,
    detailLabel: "Detail"
  },
  {
    id: "steak",
    name: "Grilled Steak",
    description: "Perfectly grilled steak served with mashed potatoes.",
    image: steakImg,
    alt: "Grilled Steak",
    whatsappLink,
    detailLabel: "Detail"
  },
  {
    id: "salad",
    name: "Caesar Salad",
    description: "Fresh greens tossed in Caesar dressing.",
    image: saladImg,
    alt: "Caesar Salad",
    whatsappLink,
    detailLabel: "Detail"
  }
];
</script>

<style scoped>
#menu {
  box-sizing: border-box;
  padding: 100px 0;
}

h2 {
  text-align: center;
  margin-bottom: 50px;
  font-size: 30px;
}

.dishes {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  padding: 0 80px;
  justify-content: space-evenly;
}

.dish {
  background-color: white;
  width: 280px;
  height: 400px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 13px 0 rgba(0, 0, 0, 0.3);
  transition: 300ms;
  padding: 0 0 20px;
}

.dish:hover {
  margin-top: -10px;
  box-shadow: 0 0 20px 1px rgba(0, 0, 0, 1);
}

img {
  border-radius: 20px 20px 0 0;
  height: 220px;
  object-fit: cover;
}

p {
  width: 230px;
}

.card-actions {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  width: 230px;
  padding-top: 10px;
}

.detail-button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.detail-button:hover {
  background-color: #0056b3;
}

.whatsapp-button {
  background-color: #25d366;
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.whatsapp-button:hover {
  background-color: #1ebe5d;
}

@media (max-width: 1024px) {
  .dishes {
    flex-direction: column;
    align-items: center;
  }

  .dish {
    margin-bottom: 20px;
  }
}
</style>
