/* ===============================
   :root — Color Palette
================================ */
:root {
  --primary: #958ade;
  --secondary: #FFE8A3;
  --accent: #FFE8A3;
  --bg-soft: #FFF9EE;
  --text-dark: #48426c;
  --white: #FFFFFF;
}

/* ===============================
   Base Styles
================================ */
body {
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  background-color: var(--bg-soft);
}

h1, h2 a {
  font-family: 'Fraunces', serif;
  font-weight: 700;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===============================
   Header
================================ */
header {
  background: var(--primary);
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
}

header .page-title {
  margin: 0;
  font-size: 3rem;
  font-weight: 700;
  color: var(--bg-soft);
  position: relative;
}

header .page-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 6px;
  margin: 0.6rem auto 0;
  background: var(--secondary);
  border-radius: 3px;
}

/* ===============================
   Navigation Tabs / Links
================================ */
.tab {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-dark);
  font-weight: bold;
  transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 0 rgba(72, 66, 108, 0.05); /* subtle default shadow */
}

.tab-nav,
.page-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.tab,
.page-link {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  background: var(--white);
  color: var(--text-dark);
  font-weight: bold;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.tab:hover,
.page-link:hover {
  background: var(--secondary);
  transform: translateY(-2px);
}

.tab.active,
.page-link.active {
  background: var(--secondary);
  box-shadow: 0 4px 0 rgba(72, 66, 108, 0.2);
}

/* ===============================
   Dropdown Menu
================================ */
.dropdown {
  display: none;
  position: absolute;
  right: 0;
  background: var(--white);
  min-width: 150px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  margin-top: 10px;
}

.dropdown a {
  display: block;
  padding: 12px 16px;
  color: var(--primary);
  transition: background 0.2s, color 0.2s;
}

.dropdown a:hover {
  background: var(--accent);
  color: var(--white);
}

/* ===============================
   Recipe Grid
================================ */
.recipe-grid,
#searchResults {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
  max-width: 1200px;
  margin: auto;
}

.recipe-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 5px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s, border 0.2s;
}

.recipe-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  border-color: var(--accent);
}

.recipe-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.recipe-info {
  padding: 1rem;
  text-align: center;
}

.recipe-info h3 {
  margin: 0.5rem 0 0.3rem;
  font-size: 1.2rem;
  color: var(--primary);
}

.recipe-info p {
  margin: 0;
  color: #555;
  font-size: 0.9rem;
}

/* ===============================
   Search Page
================================ */
main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.search-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.search-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: bold;
}

#ingredientInput,
#typeSelect {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  margin-top: 0.3rem;
}

#ingredientInput {
  width: 100%;
}

#typeSelect {
  width: 30%;
}

.ingredient-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.ingredient-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: var(--white);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: default;
}

#searchBtn,
#clearSearchBtn,
.back-button {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

#searchBtn {
  background: var(--primary);
  color: var(--white);
}

#searchBtn:hover {
  background: #7d6ee2;
  transform: translateY(-2px);
}

#clearSearchBtn,
.back-button {
  background: var(--secondary);
  color: var(--text-dark);
}

#clearSearchBtn:hover {
  background: #ffd966;
  transform: translateY(-2px);
}

.back-button:hover {
  background: #ffb703;
  transform: translateY(-2px);
}

/* ===============================
   Meal Prep Layout
================================ */
.meal-layout {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex-wrap: wrap;
}

.meal-recipes {
  flex: 1 1 250px;
  background: var(--white);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.meal-recipes h2 {
  text-align: center;
  color: var(--primary);
}

#recipeList {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

#recipeList .recipe-card {
  cursor: grab;
}

.recipe-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.recipe-filters .filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--text-dark);
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.recipe-filters .filter-btn:hover {
    background: var(--secondary);
    transform: translateY(-1px);
}

.recipe-filters .filter-btn.active {
    background: var(--secondary);
    box-shadow: 0 4px 0 rgba(72, 66, 108, 0.2);
}

.week-calendar {
  flex: 2 1 600px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
}

.day-column {
  background: var(--white);
  border-radius: 12px;
  padding: 0.5rem;
  min-height: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: background 0.2s;
}

.day-column h3 {
  text-align: center;
  margin: 0.5rem 0;
  color: var(--primary);
}

.day-column.drag-over {
  background: var(--secondary);
}

.planned-recipe {
  background: var(--accent);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  margin: 0.3rem 0;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  color: var(--text-dark);
  transition: transform 0.1s;
}

.planned-recipe:hover {
  transform: scale(1.03);
}

/* Grocery List */
.grocery-section {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.grocery-section h2 {
  color: var(--primary);
  margin-top: 0;
}

.grocery-section ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin-top: 1rem;
}

/* ===============================
   Responsive
================================ */
@media (max-width: 900px) {
  .meal-layout {
    flex-direction: column;
  }
  .week-calendar {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .week-calendar {
    grid-template-columns: repeat(2, 1fr);
  }
}
