* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  list-style: none;
}
:root {
  --primary: #2c3e50;
  --white: white;
  --second: #f39c12;
  --third: #e67e22;
  --shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s ease;
  --font_family: "Playfair Display", serif;
  --radius: 10px;
}
::selection {
  background-color: var(--white);
  color: var(--primary);
}
body {
  margin: 0 10rem;
  /* background-color: var(--primary); */
}
/* header start  */
.api {
  color: var(--second);
}
header {
  padding: 3rem 5rem;
  background-color: var(--primary);
  color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 1rem;
}
header .title,
header .controls {
  display: flex;
  justify-content: space-between;
}
header .title h1 {
  font-family: var(--font_family);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
#Fav_btn {
  display: none;
}
/* favorite btn start*/
header .title button {
  background-color: var(--second);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 1px 4px var(--third);
  display: flex;
  align-items: center;
  gap: 10px;
}

header .title button i {
  color: var(--white);
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

header .title button:hover {
  background-color: var(--third);
  transform: scale(1.05);
}

header .title button:hover i {
  transform: scale(1.2);
}

#fav_btn-count {
  position: relative;
  top: -20px;
  right: -10px;
  background-color: var(--white);
  color: var(--third);
  border-radius: 50%;
  padding: 5px;
  font-weight: bolder;
}

/* favorite btn end */
.form-group {
  position: relative;
}

.form-group i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
}

#select_category {
  background: white;
  border: none;
  padding: 12px 20px 12px 45px;
  border-radius: var(--radius);
  font-size: 1rem;
  /* width: 250px; */
  box-shadow: var(--shadow);
  cursor: pointer;
  appearance: none;
  transition: var(--transition);
}

#select_category:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

#searchName:focus {
  outline: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.search-container {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin: 0 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

#searchName {
  flex: 2;
  padding: 12px 15px;
  border: none;
  font-size: 1rem;
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
}

#searchBtn {
  background-color: var(--third);
  color: white;
  border: none;
  padding:  12px 15px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 0 var(--radius) var(--radius) 0;
}

#searchBtn:hover {
  background-color: var(--second);
}

/* header end  */

/* Main start  */
main {
  margin: 1rem;
}
main .title {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  /* flex-direction: column; */
  margin: 1rem;
}
main .title span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}
#mealsCount {
  font-size: 2rem;
  color: var(--third);
  font-family: var(--font_family);
}

.section-title {
  margin: 40px 0 30px;
  font-family: var(--font_family);
  font-size: 2.2rem;
  color: var(--primary);
  position: relative;
  padding-bottom: 15px;
  font-weight: 700;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 4px;
  background: var(--third);
  border-radius: 2px;
}

/* Cards start  */
#recipesContainer,
#favorites {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding: 40px 20px;
}

#recipesContainer .card,
#favorites .card {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 3px 2px rgba(0, 0, 0, 0.1);
  width: 300px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  height: 100%;
}

#recipesContainer .card:hover,
#favorites .card:hover {
  transform: translateY(-8px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);
}

#recipesContainer .card img,
#favorites .card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: var(--transition);
}
#Click_fav {
  position: absolute;
  right: 10%;
  top: 10%;
  font-size: 2rem;
  color: var(--third);
  transition: var(--transition);
}
/* #recipesContainer .card:hover #Click_fav  {
  opacity: 1;
  top :20%;
  transition: var(--transition);
  
} */

#recipesContainer .card-body,
#favorites .card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#recipesContainer .card-title,
#favorites .card-title {
  font-family: "Playfair Display", serif;
  font-size: 1.3rem;
  color: var(--primary);
  margin: 0;
  text-align: center;
  margin-bottom: 1rem;
}

#recipesContainer .card button,
#favorites .card button {
  background: var(--third);
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: var(--shadow);
}
#recipesContainer .card button:hover,
#favorites .card button:hover {
  background: var(--second);
}

#recipeDetails .card-error {
  font-family: "Poppins", sans-serif;
  font-size: 2rem;
  color: red;
  line-height: 1.5;
  max-height: 100px;
  text-align: center;
  font-weight: bolder;
  margin-bottom: 5rem;
  /* overflow: hidden; */
  /* text-overflow: ellipsis; */
}

/* Recipe Details Overlay */
#recipeDetails {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: none; /* Hidden by default */
  justify-content: center;
  align-items: center;
  z-index: 999;
  padding: 1rem;
}

/* Show when active */
#recipeDetails.active {
  display: flex;
}

/* Card Styling */
#recipeDetails .card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Section inside card */
#recipeDetails .card .sec {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

/* Image */
#recipeDetails .card img {
  width: 300px;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  cursor: pointer;
}

/* Info beside image */
#recipeDetails .card .sec div {
  flex: 1;
  min-width: 250px;
}

#recipeDetails .card p {
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  color: #2c3e50;
}

#recipeDetails .card p span {
  font-weight: bold;
  color: #e67e22;
}

#recipeDetails .card button {
  margin-top: 0.5rem;
  padding: 0.6rem 1.2rem;
  background-color: #e67e22;
  border: none;
  color: white;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.3s ease;
}

#recipeDetails .card button:hover {
  background-color: #f39c12;
}

#recipeDetails .card a {
  color: white;
  text-decoration: none;
}

/* Ingredients & Instructions */
.ingredients,
.instruction {
  flex: 1;
  min-width: 280px;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.5rem;
}

.sub-title {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.4rem;
  color: #2c3e50;
}

/* List */
.ingredient-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ingredient-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #ccc;
  padding: 0.4rem 0.3rem;
  margin-bottom: 1rem;
  background-color: #f9daa9;
  border-radius: 5px;
}

/* Close Button */
#close_btn_details {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
}

/* Cards end  */
/* Main end */

/* Footer start  */
footer {
  text-align: center;
  background-color: var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  color: var(--white);
  font-size: larger;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
footer h1 {
  font-family: var(--font_family);
}
footer ul {
  display: flex;
  justify-content: center;
  align-content: center;
  gap: 1rem;
}
footer ul a {
  cursor: pointer;
  color: var(--third);
  font-size: 2rem;
  transition: var(--transition);
}
footer ul a:hover {
  color: var(--white);
  font-size: 2.2rem;
}
/* Footer end  */

@media (max-width: 1200px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .search-container {
  max-width: 450px;
}
}
@media (max-width: 900px) {
    body {
  margin: 0 6rem;
}
  main .title {
    display: flex;
    justify-content: center;
    flex-direction: column;
  }
  header .title button {
    display: none;
  }
  #Fav_btn {
    display: block;
  }
}

@media (max-width: 780px) {
  body {
    margin: 0;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .search-container {
    width: 40%;
  }
  .section-title {
    font-size: 2rem;
  }
  main .title {
    display: flex;
    justify-content: center;
    flex-direction: column;
  }
  .search-container {
    flex-direction: column;
   width: 15rem;
    gap: 0.5rem;
    box-shadow: none;
  }

  #searchName,
  #searchBtn {
    width: 100%;
    border-radius: var(--radius);
  }

  /* #searchBtn {
    padding: 10px 0;
  } */
}

@media (max-width: 530px) {
  header .title button {
    display: none;
  }

  #searchName {
    padding: 0.8rem;
  }
  #Fav_btn {
    display: block;
  }
}
@media (max-width: 430px) {
  header {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  #Fav_btn {
    display: inline;
    padding: 0 1rem;
    margin-left: 1rem;
    margin-right: 1rem;
  }

  #searchName {
    padding: 0.7rem 0.5rem;
    font-size: 0.8rem;
  }
  .section-title {
    font-size: 1.8rem;
  }
}

@media (max-width: 380px) {
  #searchName {
    display: flex;
    max-width: 130%;
  }
  #searchBtn {
    width: 80%;
  }

  #recipeDetails .card .sec {
    padding-left: 1.2rem;
  }
}
