/* Food Items — Filter Page & Detail */

.food-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 16px 0;
  border-bottom: 2px solid #e5e7eb;
}

.food-filter-btn {
  padding: 6px 18px;
  border: 2px solid #d1d5db;
  border-radius: 20px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.food-filter-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.food-filter-btn.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.food-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 16px;
}

.food-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  background: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.food-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.food-card.hidden {
  display: none;
}

.food-card__name {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.food-card__name a {
  text-decoration: none;
  color: #111827;
}

.food-card__name a:hover {
  color: #4f46e5;
}

.food-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
}

.tag-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: #f3f4f6;
  color: #4b5563;
}

.tag-badge--dairy        { background: #dbeafe; color: #1d4ed8; }
.tag-badge--protein      { background: #dcfce7; color: #166534; }
.tag-badge--carbohydrate { background: #fef3c7; color: #92400e; }
.tag-badge--sugar        { background: #fce7f3; color: #9d174d; }
.tag-badge--fat          { background: #f3e8ff; color: #6b21a8; }

.food-card__serving {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 8px;
}

.food-card__benefits {
  font-size: 14px;
  color: #374151;
  line-height: 1.55;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.food-card__link {
  display: inline-block;
  font-size: 13px;
  color: #4f46e5;
  font-weight: 500;
  text-decoration: none;
}

.food-card__link:hover { text-decoration: underline; }

/* Detail page */
.food-detail {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 0;
}

.food-detail__title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #111827;
}

.food-detail__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.food-detail__description {
  font-size: 16px;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 32px;
}

.food-detail__meta {
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}

.food-detail__row {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}

.food-detail__label {
  font-weight: 600;
  color: #111827;
  min-width: 180px;
  flex-shrink: 0;
}

.food-detail__value {
  color: #374151;
  line-height: 1.6;
}

.food-detail__paired {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paired-item {
  padding: 4px 14px;
  background: #f3f4f6;
  border-radius: 8px;
  text-decoration: none;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

.paired-item:hover { background: #e5e7eb; color: #111827; }

@media (max-width: 600px) {
  .food-detail__row { flex-direction: column; gap: 4px; }
  .food-detail__label { min-width: unset; }
}


/* -------------------------------------------------------
   Lazy-loading listing  (/food-items)
------------------------------------------------------- */

.food-lazy-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Loading spinner — hidden by default, shown via .is-active */
.fi-loading-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1.5rem;
  color: #6b7280;
  font-size: 14px;
}

.fi-loading-indicator.is-active {
  display: flex;
}

.fi-loading-indicator::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: fi-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes fi-spin {
  to { transform: rotate(360deg); }
}

/* End-of-list message — hidden by default, shown via .is-active */
.fi-end-message {
  display: none;
  text-align: center;
  padding: 1.5rem;
  color: #9ca3af;
  font-size: 13px;
  font-style: italic;
}

.fi-end-message.is-active {
  display: block;
}