/* ==========================================================================
   Menu: sticky category bar, category sections, product cards.
   ========================================================================== */

.menu {
  padding-bottom: 1.75rem;
  scroll-margin-top: var(--header-height);
}

.category-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 0.5rem 0;
  margin-bottom: 1rem;
}

.category-bar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.category-btn {
  padding: 0.55rem 1.2rem;
  border: 2px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.87rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.category-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.category-btn[aria-current='true'] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(122, 181, 29, 0.3);
}

.menu-section {
  scroll-margin-top: calc(var(--header-height) + 70px);
  margin-bottom: 2rem;
}

.menu-section-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--dark);
  margin-bottom: 0.8rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}

.menu-status {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

/* ── Product card ────────────────────────────────────────────────────────── */

.product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.product-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.product-media {
  height: 110px;
  background: linear-gradient(135deg, #f5f5f5 0%, #efefef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  border-bottom: 1px solid var(--border);
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-body {
  padding: 0.65rem 0.75rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.25;
  color: var(--dark);
  margin-bottom: 0.2rem;
}

.product-desc {
  font-size: 0.72rem;
  line-height: 1.3;
  color: #999;
  margin-bottom: 0.4rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-allergens {
  align-self: flex-start;
  font-size: 0.66rem;
  line-height: 1.3;
  color: #b06a00;
  background: #fff8ec;
  border-radius: 5px;
  padding: 0.15rem 0.4rem;
  margin-bottom: 0.45rem;
}

.product-allergens[data-type='none'] {
  color: #999;
  background: #f5f5f5;
}

.product-allergens[data-type='warn'] {
  color: #c0392b;
  background: #fdecea;
  font-weight: 700;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.product-price {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.product-add {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-weight: 700;
  font-size: 0.75rem;
  transition: background 0.2s;
}

.product-add:hover {
  background: var(--primary-dark);
}

/* Quantity stepper, shown instead of the add button once the product is in the cart */
.qty-stepper {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 110px;
  height: 36px;
  padding: 2px 4px;
  border: 1.5px solid var(--dark);
  border-radius: 8px;
  background: var(--white);
}

.product-card.in-cart .product-add {
  display: none;
}

.product-card.in-cart .qty-stepper {
  display: flex;
}

.qty-stepper .qty-btn {
  width: 32px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: #111;
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
}

.qty-stepper .qty-btn:hover {
  background: #2a2a2a;
}

.qty-value {
  flex: 1;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (min-width: 641px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 0.85rem;
  }
}

@media (max-width: 768px) {
  .category-bar {
    padding: 0.35rem 0;
  }

  .category-bar-inner {
    padding: 0 0.7rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .category-bar-inner::-webkit-scrollbar {
    display: none;
  }

  .category-btn {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.7rem;
  }

  .product-card:hover {
    transform: none;
  }

  .product-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .product-add {
    width: 100%;
    min-height: 40px;
    font-size: 0.8rem;
  }

  .qty-stepper {
    width: 100%;
    height: 42px;
  }

  .qty-stepper .qty-btn {
    width: 44px;
    height: 36px;
    font-size: 1.3rem;
  }
}
