/* ================= ROOT & RESET ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 62.5%; /* 1rem = 10px */
}

body {
  font-family: "Roboto", sans-serif;
  background-color: #f8f8f8;
  color: #222;
}

/* Card Hover effect */

.hover-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Button hover effect */
.btn-hover {
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.btn-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/*pop up modal loading effect */
.modal-loader-wrapper {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid lightblue;
  border-right-color: orange;
  animation: l2 1s infinite linear;
}

@keyframes l2 {
  to {
    transform: rotate(1turn);
  }
}

/* ================= LOADER ================= */

#loader {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 9999;
}

/* Spinning circle inside loader */
#loader::before {
  content: "";
  width: 50px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid lightblue;
  border-right-color: orange;
  animation: l2 1s infinite linear;
}

/* Animation keyframes */
@keyframes l2 {
  to {
    transform: rotate(1turn);
  }
}

/* ================= NAVBAR ================= */
nav {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4rem;
  background-color: #ffffff;
}

.nav-center img {
  height: 40px;
}

/* ================= HERO / HEADER ================= */
header {
  height: 420px;
  background: url("./assets/page-title.jpg") center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
  color: #ffffff;
}

header h1 {
  font-size: 4.2rem;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

header p {
  font-size: 1.6rem;
  max-width: 450px;
  margin-bottom: 2.5rem;
  color: #ffffff9a;
  margin: 0 2rem;
}

/* ================= SEARCH BOX ================= */

.search-section {
  padding: 3rem 0;
}

.search-box {
  width: 50%;
  margin: 0 auto;

  display: flex;
  background: #ffffff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease; /*for searchbox animation*/
}

.search-box:focus-within {
  transform: scale(1.03);
  box-shadow: 0 12px 30px rgba(249, 168, 37, 0.4);
}

.search-box input:focus {
  outline: none;
}

.search-box input {
  flex: 1;
  padding: 1.2rem;
  font-size: 1.5rem;
  border: none;
  outline: none;
}

.search-box button {
  width: 55px;
  border: none;
  background-color: #f9a825;
  color: #ffffff;
  font-size: 1.6rem;
  cursor: pointer;
}

/* ================= MAIN SECTION ================= */
main {
  padding: 5rem 8rem;
}

section h2 {
  font-size: 2.6rem;
  margin-bottom: 3rem;
  text-align: center;
}

/* ================= RECIPE GRID ================= */
#recipe-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem;
}

/* ================= RECIPE LOADER ================= */
.recipes-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px 0;
}

.recipes-loader::before {
  content: "";
  width: 40px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 6px solid lightblue;
  border-right-color: orange;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* ================= RECIPE CARD ================= */
.recipe-card {
  background-color: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.card-image img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-content h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.card-content p {
  font-size: 1.4rem;
  line-height: 1.5;
  color: #555;
  margin-bottom: auto;
  text-align: justify;
}

/* ================= CARD BUTTON ================= */
.card-action {
  text-align: right;
  margin-top: 1.5rem;
}

.details-btn {
  padding: 0.8rem 1.6rem;
  font-size: 1.3rem;
  border: none;
  background-color: #f9a825;
  color: #ffffff;
  cursor: pointer;
  border-radius: 4px;
}

/* ================= MODAL ================= */

#details-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
}

/* Show modal */
#details-modal.show {
  opacity: 1;
  visibility: visible;
}

/* ================= MODAL CONTENT ================= */
.modal-content {
  background: #fff;
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;

  border-radius: 12px;
  padding: 20px;

  transform: scale(0.8) translateY(30px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Pop-up animation */
#details-modal.show .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Pop-out animation */
#details-modal.hide .modal-content {
  transform: scale(0.8) translateY(30px);
  opacity: 0;
}

.modal-image img {
  width: 100%;
  height: 58rem;
  border-radius: 2rem;
  margin-bottom: 2rem;
}

.modal-content h2 {
  font-size: 2.4rem;
  margin-bottom: 1.5rem;
}

.modal-content h3 {
  font-size: 1.8rem;
  margin: 2rem 0 1rem;
}

.modal-content p {
  font-size: 1.4rem;
  line-height: 1.6;
  text-align: justify;
}

.modal-content ol {
  padding-left: 2rem;
  font-size: 1.4rem;
}

.modal-links {
  margin-top: 2rem;
}

.modal-links a {
  margin-right: 1.5rem;
  font-size: 1.4rem;
  color: #f9a825;
  text-decoration: none;
}

/* ================= MODAL CLOSE ================= */
.modal-close {
  text-align: center;
  margin-top: 2.5rem;
}

.modal-close button {
  padding: 1rem 2.5rem;
  font-size: 1.4rem;
  border: none;
  background-color: #f9a825;
  color: #ffffff;
  cursor: pointer;
  border-radius: 4px;
}

/* ================= FOOTER ================= */
footer {
  background-color: #222;
  color: #ffffff;
  text-align: center;
  padding: 2rem;
  margin-top: 5rem;
}

footer p {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.social-icons i {
  font-size: 1.6rem;
  margin: 0 0.8rem;
  cursor: pointer;
}

/* ================= SCROLL TO TOP BUTTON ================= */
.scroll-top-btn {
  position: fixed;
  bottom: 100px;
  right: 7px;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background-color: #ff6b35;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 20px;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
}

/* Show animation */
.scroll-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Hover effect */
.scroll-top-btn:hover {
  background-color: #e85c2a;
  transform: translateY(-5px);
}

/* =================  RESPONSIVE ================= */

/* ≤ 1199px (Large → Laptop) */
@media (max-width: 1199.98px) {
  #recipe-container {
    grid-template-columns: repeat(3, 1fr);
  }

  .search-box {
    width: 60%;
  }

  .scroll-top-btn {
    bottom: 100px;
    right: 20px;
    width: 3.5rem;
    height: 3.5rem;
  }
}

/* ≤ 991px (Laptop → Tablet) */
@media (max-width: 991.98px) {
  main {
    padding: 4rem 6rem;
  }

  #recipe-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-box {
    width: 70%;
  }

  header h1 {
    font-size: 3.6rem;
  }

  .scroll-top-btn {
    right: 18px;
    width: 3.2rem;
    height: 3.2rem;
    font-size: 18px;
  }
}

/* ≤ 767px (Tablet → Mobile) */
@media (max-width: 767.98px) {
  nav {
    padding: 0 2rem;
  }

  header {
    height: 360px;
  }

  header h1 {
    font-size: 3.2rem;
  }

  header p {
    font-size: 1.4rem;
  }

  main {
    padding: 3rem 5rem;
  }

  #recipe-container {
    grid-template-columns: 1fr;
  }

  .modal-image img {
    height: 25%;
  }

  .search-box {
    width: 90%;
  }
  .scroll-top-btn {
    right: 10px;
    width: 3rem;
    height: 3rem;
    font-size: 16px;
  }
}

/* ≤ 575px (Small Mobile) */
@media (max-width: 575.98px) {
  header h1 {
    font-size: 2.8rem;
  }

  main {
    padding: 0rem 4rem;
  }

  .search-box input {
    font-size: 1.4rem;
  }

  .modal-content {
    width: 95%;
    padding: 2rem;
  }

  .modal-image img {
    height: 25%;
  }
  .scroll-top-btn {
    right: 7px;
    width: 2.8rem;
    height: 2.8rem;
    font-size: 15px;
  }
}
