/* ===== Body ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  background: #fafafa;
  color: #333;
}

.container {
  max-width: 1100px;
  margin: auto;
  padding: 2rem 1rem;
}

/* ===== Hero & Controls ===== */
.hero {
  background: linear-gradient(135deg, #fff5e6, #ffe6e6);
  padding: 6rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 20px;
  margin-bottom: 4rem;
}

.controls-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* ===== SEARCH INPUT WITH ICON ===== */
#searchInput {
  padding: 0.8rem 1.3rem 0.8rem 2.8rem; /* extra left space for icon */
  font-size: 1.75rem;
  border-radius: 1rem;
  width: 100%;
  max-width: 500px;
  border: 2px solid #ddd;
  margin-bottom: 2rem;
  text-align: left;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23999' viewBox='0 0 24 24'%3E%3Cpath d='M21 21l-4.35-4.35m1.35-5.65a7 7 0 11-14 0 7 7 0 0114 0z' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 18px;
}

/* ===== Toolbar ===== */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.controls-bar #searchInput {
  
  max-width: 350px;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  font-size: 1.1rem;
  border-radius: 8px;
  border: 2px solid #ddd;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: border-color 0.25s ease;
}

.controls-bar #searchInput:focus {
  border-color: #7b4b94;
  outline: none;
}

/* Category buttons */
.controls-bar .category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.controls-bar .category-buttons button {
  background: #7b4b94;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.25s ease, transform 0.2s ease;
}

.controls-bar .category-buttons button:hover,
.controls-bar .category-buttons button.active {
  background: #5e2a84;
  transform: translateY(-2px);
}

/* ===== Category Buttons ===== */
.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
  margin-bottom: 2.5rem;
  margin-left: auto;
}

.top-controls .category-buttons {
  justify-content: flex-end;
  margin-bottom: 0; /* optional cleanup */
}

.category-buttons button {
  background: #7b4b94;
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.25s ease, transform 0.2s ease;
}

.category-buttons button:hover,
.category-buttons button.active {
  background: #5e2a84;
  transform: translateY(-2px);
}

/* ===== Recipe Grid ===== */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

@media (max-width: 1100px) {
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
}

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

@media (max-width: 600px) {
  .recipe-grid { grid-template-columns: 1fr; }
}

/* ===== Recipe Cards ===== */
.recipe-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

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

.recipe-card h2 {
  font-size: 1.25rem;
  padding: 0.75rem 1rem 0 1rem;
}

.recipe-card p {
  padding: 0 1rem 1rem 1rem;
  color: #555;
  font-size: 0.95rem;
}

/* ===== Individual Recipe Pages ===== */
.recipe-page {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.recipe-title {
  margin-bottom: 1rem;
  font-size: 2rem;
  text-align: center;
}

.recipe-image {
  width: 100%;
  max-width: 400px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 1rem auto;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.instructions h3,
.ingredients h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

ul {
  list-style: none;
  padding-left: 0;
}

/* Add space between ingredients list and whatever follows */
.instructions {
  margin-top: 2rem;
}

.phase h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  background: #dcdcdc;
  padding: 0.5rem;
  border-radius: 6px;
}

.phase h3:hover {
  background: #eaeaea;
}

.ingredients input[type="checkbox"] {
  margin-right: 6px;
}

.ingredients input[type="checkbox"]:checked + span,
.ingredients input[type="checkbox"]:checked {
  opacity: 0.6;
}

.top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* keeps it responsive */
  gap: 1rem;
  margin-bottom: 2rem;
}
/* Recipe category badge */
.recipe-category {
  display: inline-block;      /* shrink to fit content */
  background-color: #f3e6fa;  /* light purple */
  color: #7b4b94;             /* matching dark purple text */
  padding: 4px 12px;          /* vertical + horizontal padding */
  border-radius: 8px;         /* rounded corners */
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ===== Mobile Fixes ===== */
@media (max-width: 768px) {

  .hero {
    padding: 2rem 1rem;
    border-radius: 14px;
    margin-bottom: 2rem;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .category-buttons {
    gap: 8px;
    margin-bottom: 2rem;
  }

  .category-buttons button {
    padding: 0.4rem 0.9rem;
    font-size: 0.95rem;
  }
}

/* ===== Print ===== */
@media print {
  body { background: white; }
  .site-header,
  .site-footer,
  .controls-wrapper,
  .category-buttons {
    display: none !important;
  }
}

@media (max-width: 768px) {

  .ingredients ul,
  .instructions ol {
    padding-left: 1.5rem;
    margin-left: 0;
  }
}

/* ===== FORCE MOBILE SEARCH SIZE FIX ===== */

@media (max-width: 768px) {
  .controls-bar #searchInput {
    font-size: 16px !important;
    padding: 8px 12px 8px 38px !important;
    height: 40px !important;
    max-width: 100% !important;
    background-position: 12px center !important;
    background-size: 16px !important;
  }
}
