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

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

body {
  background: #fffaf4;
  font-family: "Poppins", sans-serif;
  color: #333;
  overflow-x: hidden;
}

/* Navbar */
.navbar {
  background-color: #f7eedd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 3rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid #ffe5c4;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: coral;
}
.logo span {
  color: #ff6347;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: color 0.3s;
}
.nav-links a:hover {
  color: coral;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-bar input {
  padding: 0.4rem 0.7rem;
  border: 2px solid coral;
  border-radius: 6px;
  outline: none;
}
.search-bar button {
  background-color: coral;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: 0.3s;
}
.search-bar button:hover {
  background-color: #ff8243;
}

/* Section */
.section {
  padding: 3rem 10%;
  text-align: center;
}
.section h2 {
  color: coral;
  margin-bottom: 1.5rem;
}

.try-again-btn {
  background-color: coral;
  border: 2px solid coral;
  color: rgb(255, 255, 255);
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.try-again-btn:hover {
  background-color: #ff9a68;
  color: white;
  transform: translateY(-2px);
}

/* Meals Grid */
.meals,
.meals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}
.meal {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease;
}
.meal:hover {
  transform: translateY(-5px);
}
.meal img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.meal-body {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.meal-body h4 {
  color: #333;
  font-size: 1rem;
}
.fav-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #999;
}
.fav-btn.active {
  color: coral;
}

/* Favorite Meals */
.fav-section {
  background-color: #fff7ed;
}
.fav-meals {
  display: flex;
  justify-content: center;
  gap: 1rem;
  list-style: none;
  overflow-x: auto;
  padding: 1rem;
}
.fav-meals li {
  text-align: center;
}
.fav-meals img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid coral;
  object-fit: cover;
}

/* Contact */
.contact-form {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-form input,
.contact-form textarea {
  padding: 0.8rem;
  border: 1.5px solid coral;
  border-radius: 6px;
  outline: none;
}
.contact-form button {
  background: coral;
  color: white;
  border: none;
  padding: 0.8rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.3s;
}
.contact-form button:hover {
  background-color: #ff8243;
}

/* Modal */
.meal-info-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

/*Empty Search Popup */
.search-warning {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.warning-box {
  background: #ffffff;
  padding: 28px 32px;
  border-radius: 16px;
  text-align: center;
  width: 320px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  animation: scaleIn 0.25s ease;
}

.warning-box h3 {
  margin-bottom: 10px;
  font-size: 20px;
}

.warning-box p {
  font-size: 14px;
  color: #555;
  margin-bottom: 18px;
}

.warning-box button {
  background: #ff4757;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.warning-box button:hover {
  background: #e84148;
}

@keyframes scaleIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.meal-info-container {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.meal-info {
  position: relative;
  background: #ffffff;
  width: 92%;
  max-width: 520px;
  max-height: 85vh;
  border-radius: 18px;
  padding: 24px 26px;
  overflow-y: auto;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  animation: modalFade 0.25s ease;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.close-popup {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: #555;
  cursor: pointer;
}

.meal-details-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
}

.meal-details-content img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 16px;
}

.meal-details-content p {
  font-size: 14px;
  line-height: 1.6;
  color: #4b5563;
  margin-bottom: 10px;
}

.meal-details-content strong {
  color: #111827;
  font-weight: 600;
}

.remove-fav-btn {
  margin-top: 18px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.remove-fav-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.remove-fav-btn:active {
  transform: scale(0.97);
}

@keyframes modalFade {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.meal-info-container img {
  height: 50px;
}

/*Remove from Favorites button */
.remove-fav-btn {
  margin-top: 16px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: #ff4757;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.remove-fav-btn:hover {
  background: #e84148;
  transform: scale(1.02);
}

.remove-fav-btn:active {
  transform: scale(0.97);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.modal-close-btn i {
  font-size: 14px;
  color: #374151;
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

/* Footer */
footer {
  background-color: #f7eedd;
  text-align: center;
  padding: 1rem;
  border-top: 2px solid #ffe5c4;
}
footer a {
  color: coral;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .nav-links {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .search-bar {
    width: 100%;
  }
  .search-bar input {
    flex: 1;
  }
}
