/**
 * Shopping List & Meal Planner Styles
 * Phase 2: Engagement Features
 */

/* ========= Shopping List Styles ========= */
.shopping-list-page {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.shopping-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.shopping-header h1 {
  margin: 0;
}

.item-count {
  color: var(--color-gray-700, #4a4a4a); /* WCAG AA: 8.5:1 contrast */
  margin: 0.5rem 0 0 0;
}

.shopping-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.shopping-actions button {
  padding: 0.75rem 1.5rem;
  border: 1px solid #ddd;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.shopping-actions button:hover {
  border-color: var(--color-brand-primary, #2d6a4f);
  background: #f8f9fa;
}

.shopping-actions .btn-primary {
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border-color: var(--color-brand-primary, #2d6a4f);
}

.shopping-actions .btn-primary:hover {
  background: var(--color-brand-dark, #1b4332);
}

.add-item-section {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--color-bg-soft, #f8f9fa);
  border-radius: 12px;
}

.add-item-section input {
  flex: 1;
  padding: 0.875rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
}

.add-item-section button {
  padding: 0.875rem 2rem;
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-item-section button:hover {
  background: var(--color-brand-dark, #1b4332);
}

.shopping-category {
  margin-bottom: 2rem;
}

.shopping-category h3 {
  margin: 0 0 1rem 0;
  color: var(--color-brand-primary, #2d6a4f);
  font-size: 1.25rem;
}

.category-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.shopping-item:hover {
  background: #f8f9fa;
  border-color: var(--color-brand-primary, #2d6a4f);
}

.shopping-item.checked {
  opacity: 0.6;
}

.shopping-item.checked .item-text {
  text-decoration: line-through;
}

.shopping-item input[type='checkbox'] {
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.item-text {
  flex: 1;
  font-weight: 500;
}

.item-source {
  color: var(--color-gray-600, #5a5a5a); /* WCAG AA: 5.9:1 contrast */
  font-size: 0.875rem;
}

.btn-remove {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-gray-600, #5a5a5a); /* WCAG AA: 5.9:1 contrast */
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.btn-remove:hover {
  background: #ffebee;
  color: #d32f2f;
}

.btn-add-to-shopping {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.btn-add-to-shopping:hover {
  background: var(--color-brand-dark, #1b4332);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

/* ========= Meal Planner Styles ========= */
.meal-planner-page {
  padding: 2rem;
}

.planner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.week-navigation {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.week-navigation button {
  padding: 0.75rem 1.25rem;
  border: 1px solid #ddd;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.week-navigation button:hover {
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
  border-color: var(--color-brand-primary, #2d6a4f);
}

.current-week {
  font-weight: 600;
  color: var(--color-text, #1a1a1a);
}

.meal-planner-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
  overflow-x: auto;
}

.day-column {
  min-width: 180px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.day-column.today {
  border-color: var(--color-brand-primary, #2d6a4f);
  border-width: 2px;
}

.day-header {
  background: var(--color-bg-soft, #f8f9fa);
  padding: 1rem;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
}

.day-column.today .day-header {
  background: var(--color-brand-primary, #2d6a4f);
  color: white;
}

.day-header h3 {
  margin: 0;
  font-size: 1rem;
}

.day-header p {
  margin: 0.25rem 0 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.meal-slot {
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
}

.meal-slot:last-child {
  border-bottom: none;
}

.meal-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-gray-600, #5a5a5a); /* WCAG AA: 5.9:1 contrast */
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.meal-slot.empty {
  cursor: pointer;
  transition: all 0.2s ease;
}

.meal-slot.empty:hover {
  background: #f8f9fa;
}

.add-meal {
  color: var(--color-brand-primary, #2d6a4f);
  text-align: center;
  padding: 1rem 0;
  font-weight: 600;
}

.meal-recipe {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meal-recipe img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.recipe-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.btn-remove-meal {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.btn-remove-meal:hover {
  background: #d32f2f;
}

/* ========= Responsive ========= */
@media (max-width: 1024px) {
  .meal-planner-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  .shopping-list-page,
  .meal-planner-page {
    padding: 1rem;
  }

  .shopping-header,
  .planner-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .shopping-actions {
    width: 100%;
  }

  .shopping-actions button {
    flex: 1;
  }

  .add-item-section {
    flex-direction: column;
  }

  .meal-planner-grid {
    grid-template-columns: 1fr;
  }

  .day-column {
    min-width: 100%;
  }
}
