@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap");

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: #f4f4f4;
  color: #333;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-image: linear-gradient(to right, #e53935, #e35d5b);
  padding: 10px 20px;
  height: 50px;
  position: relative;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.logo {
  margin: 0;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.menu-icon {
  font-size: 2rem;
  color: white;
  cursor: pointer;
  font-weight: bold;
}

.search-section {
  background: url('./images/bg.jpg') no-repeat center center/cover;
  height: 400px; /* This height can be problematic for dynamic content */
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
}

.search-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

.search-overlay {
  position: relative;
  z-index: 1;
  padding: 20px;
  border-radius: 10px;
}

.search-title {
  color: white;
  font-size: 2.5rem;
  margin-bottom: 0;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.search-subtitle {
  color: white;
  font-size: 1.2rem;
  margin-top: 5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.searchForm {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: white;
  border-radius: 50px;
  padding: 5px;
  width: 90%;
  max-width: 500px;
  margin: 20px auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#searchInput {
  border: none;
  outline: none;
  font-size: 1rem;
  padding: 10px 20px;
  width: 100%;
  border-radius: 50px;
}

.searchForm button {
  background-image: linear-gradient(to right, #e53935, #e35d5b);
  color: white;
  border: none;
  border-radius: 50%;
  padding: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease;
}

.searchForm button:hover {
  transform: scale(1.1);
}

.category-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 300px;
  background-color: #ffffff;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  padding: 20px;
  z-index: 20;
  overflow-y: auto;
}

.category-sidebar.show {
  transform: translateX(0);
}

.close-icon {
  font-size: 2rem;
  cursor: pointer;
  text-align: right;
  color: #333;
  margin-bottom: 20px;
}

#categoryList {
  list-style: none;
  padding: 0;
}

#categoryList li {
  padding: 15px 0;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 1.1rem;
  color: #555;
  transition: color 0.2s;
}

#categoryList li:hover {
  color: #e53935;
}

.categories {
  padding: 40px 20px;
  background: #f7f7f7;
}

.categories-header {
  border-bottom: 3px solid #e53935;
  display: inline-block;
  margin-bottom: 20px;
  margin-left: 15px;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: #333;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px;
}

.category-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.category-card img {
  width: 100%;
  display: block;
}

.category-title {
  position: absolute;
  top: 10px;
  right: 10px;
  background-image: linear-gradient(to right, #e53935, #e35d5b);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 600;
}

.hidden {
  display: none;
}

/* Specific styles for meal results */
#meals-by-category {
    padding: 20px; /* Add some padding around the section */
}

.meals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px;
}

.meal-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  background-color: #fff;
  width: 250px;
  
}

.meal-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.meal-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}


.meal-title {
  position: static; /* Change from absolute to static */
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px;
  text-align: center;
  font-weight: 600;
  /* Removed bottom, left, right to make it flow with content */
}

.meal-details-header {
  background-image: linear-gradient(to right, #e53935, #e35d5b);
  padding: 10px 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.meal-details-title-bar {
  display: flex;
  align-items: center;
  color: white;
  font-size: 1.5rem;
}

.meal-details-title-bar h1 {
  margin: 0;
  font-weight: 600;
  flex-grow: 1;
  text-align: center;
}

#back-button {
  color: white;
  font-size: 1.5rem;
  margin-right: 15px;
  transition: transform 0.2s ease;
}

#back-button:hover {
  transform: translateX(-5px);
}

.meal-details-container {
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.meal-details-image {
  flex: 1;
  text-align: center;
}

.meal-details-image img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.meal-details-info {
  flex: 2;
}

.meal-details-info h2 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 5px;
  font-weight: 700;
}

.meal-details-info .category-text {
  font-size: 1.1rem;
  color: #555;
  text-transform: uppercase;
  font-weight: 500;
}

.meal-details-info .source-link {
  font-size: 0.9rem;
  color: #e53935;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.meal-details-info .source-link:hover {
  text-decoration: underline;
  color: #e35d5b;
}

.meal-details-tags {
  margin: 15px 0;
}

.meal-details-tags h3 {
  display: inline-block;
  margin-right: 10px;
  color: #555;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  background-image: linear-gradient(to right, #e53935, #e35d5b);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 500;
}

.details-box {
  background-image: linear-gradient(to bottom, #e53935, #e35d5b);
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.details-box h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-weight: 600;
  text-transform: uppercase;
}

.details-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
}

.details-list li {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 5px 10px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.ingredient-number {
  background-color: white;
  color: #e53935;
  font-weight: bold;
  border-radius: 50%;
  min-width: 25px;
  min-height: 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
}

.details-instructions {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.instructions-list {
  list-style: none;
  padding: 0;
}

.instructions-list li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 15px;
  line-height: 1.5;
  font-size: 1rem;
}

.instructions-list li i {
  color: #e53935;
  margin-right: 10px;
  font-size: 1.2rem;
  transform: translateY(3px);
}

@media (min-width: 768px) {
  .meal-details-container {
    flex-direction: row;
    align-items: flex-start;
  }
}