:root {
  --primary-color: #a3b684;  /* Darker primary color (was #c6d8a7) */
  --primary-dark: #8ea271;   /* Adjusted primary-dark to be darker */
  --primary-light: #c6d8a7;  /* Previous primary color becomes the light variant */
  --accent-color: #77895e;   /* Darker accent color */
  --text-color: #4A4A4A;
  --text-light: #787878;
  --background-light: #F9F9F9;
  --border-color: #E0E0E0;
  --success-color: #9CB36B;
  --error-color: #D55C5A;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--background-light);
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  color: var(--primary-dark);
  margin-bottom: 8px;
}

header p {
  color: var(--text-light);
}

h2 {
  color: var(--primary-dark);
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.section-description {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 15px;
  font-style: italic;
}

/* Meal Selector Styles */
.meal-selector,
.grocery-list {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.meal-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.meal-checkbox {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
}

.meal-name {
  flex-grow: 1;
}

.meal-disabled {
  color: var(--text-light);
}

.servings-control {
  display: flex;
  align-items: center;
}

.servings-btn {
  width: 30px;
  height: 30px;
  background-color: var(--primary-light);
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
}

.servings-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

.servings-btn:disabled {
  background-color: var(--border-color);
  cursor: not-allowed;
}

.servings-count {
  width: 40px;
  text-align: center;
  font-size: 16px;
  margin: 0 5px;
}

/* Grocery List Styles */
.grocery-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.btn i {
  margin-right: 5px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--text-color);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background-color: #f0f0f0;
  color: var(--text-color);
}

.btn-secondary:hover {
  background-color: #e0e0e0;
}

.grocery-buttons {
  display: flex;
  gap: 10px;
}

.groceries-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.grocery-item {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}

.grocery-item:last-child {
  border-bottom: none;
}

.grocery-checkbox {
  margin-right: 8px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
}

.grocery-name {
  flex-grow: 0;
  margin-right: 6px;
}

.grocery-quantity {
  font-weight: 500;
  color: var(--text-light);
  text-align: right;
}

.grocery-unit {
  margin-left: 4px;
  color: var(--primary-dark);
  font-weight: 500;
  width: auto;
  min-width: 15px;
  display: inline-block; /* Ensure it displays even when empty */
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-dark);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  transition: opacity 0.3s, visibility 0.3s;
}

.hidden {
  opacity: 0;
  visibility: hidden;
}

footer {
  text-align: center;
  margin-top: 30px;
  color: var(--text-light);
  font-size: 0.9rem;
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive styles */
@media (max-width: 768px) {
  .grocery-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .grocery-buttons {
    width: 100%;
    justify-content: space-between;
  }

  .meal-item {
    flex-wrap: wrap;
  }

  .grocery-item {
    padding: 4px 0;
  }

  .servings-control {
    margin-top: 8px;
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .groceries-container {
    grid-template-columns: 1fr;
  }
}

/* Loading indicator styles */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
  text-align: center;
}

.loading-indicator p {
  margin-bottom: 15px;
  color: var(--text-light);
  font-size: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-left-color: var(--primary-color);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}