/* ===== Import handwriting font ===== */
@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

/* ===== Body & Background ===== */
body {
  font-family: 'Georgia', serif;
  background: #f4f1ee url('../images/trapezomantilo.jpg') repeat;
  background-size: cover;
  color: #333;
}

/* ===== Flipbook Container ===== */
.book {
  perspective: 2000px;
  position: relative;
  width: 466px;     /* same as .page width */
  height: 535px;    /* same as .page height */
  margin: 0 auto;   /* center horizontally */
}

/* ===== Pages ===== */
.page {
  width: 466px;
  height: 535px;
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 0.6s ease-in-out, box-shadow 0.3s ease-in-out;
  border-radius: 10px;
  /* z-index is dynamically set in JS */
}

/* FRONT FACE */
.page-front {
  background: url("../images/notebook.png") center center no-repeat;
  background-size: cover;
  padding: 0 60px 60px 60px;
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  backface-visibility: hidden;
  transform: rotateY(0deg);
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}

/* BACK FACE */
.page-back {
  background: url("../images/notebook.png") center center no-repeat;
  background-size: cover;
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  backface-visibility: hidden;
  transform: rotateY(180deg) scaleX(-1);
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}

/* Remove backgrounds */
.page-front.no-bg,
.page-back.no-bg {
  background: none !important;
  box-shadow: none !important;
}

/* FLIPPED STATE */
.page.flipped {
  transform: rotateY(-180deg);
  z-index: 10; /* slightly below next page */
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

/* Page content */
.page-content {
  text-align: center;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 100px;
  padding-left: 30px;
  box-sizing: border-box;
}

.page-content img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  padding: 8px;
  background-color: #fff8f0;
  border: 2px solid #d8c3a5;
  box-shadow: 0 5px 15px rgba(0,0,0,0.25);
  margin: 15px auto;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ===== Handwriting style ===== */
.page-content h2,
.page-content h1,
.page-content h4,
.page-content p,
.ingredients-list li,
.steps-list li,
.modal-title,
.modal-body h4 {
  font-family: 'Patrick Hand', cursive;
  color: #4b2e16;
}

/* Titles */
.page-content h2 {
  font-size: 1.8rem;
}

.page-content h4 {
  font-size: 1.3rem;
}

.page-content p {
  font-size: 1rem;
  color: #5a4b3d;
}

.ingredients-list li,
.steps-list li {
  margin-bottom: 6px;
  line-height: 1.6;
  font-size: 1.1rem;
  color: #2d1f14;
}

/* ===== Navbar ===== */
.navbar {
  border-radius: 8px;
}

.nav-link.active {
  background-color: #ffd6a5;
  border-radius: 5px;
  color: #6b3e26 !important;
  font-weight: bold;
}

/* ===== Buttons ===== */
#prevBtn, #nextBtn {
  background: #ffba7b;
  border: none;
  color: #6b3e26;
  font-weight: bold;
  padding: 10px 25px;
  margin: 0 10px;
  border-radius: 50px;
  box-shadow: 0 5px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

#prevBtn:hover, #nextBtn:hover {
  background: #ff9c4b;
  transform: translateY(-2px);
}

/* ===== Special Pages ===== */
.page:first-child .page-front,
.page:last-child .page-front {
  background: url("../images/cover.png") center center no-repeat;
  flex-direction: column;
  font-size: 1.2rem;
  color: #6b3e26;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  background-image: 
    url("../images/cover.png"),
    url("../images/notebook.png");
  background-position: center center, center center;
  background-repeat: no-repeat, no-repeat;
}

.page:first-child img {
  margin-top: 15px;
  max-width: 60%;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ===== Modal Styles ===== */
.modal-content {
  height: 100%;
  background: 
    linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)),
    url("../images/notebook.png") center center no-repeat;
  background-size: cover;
  border-radius: 12px;
  padding: 40px;
  padding-left: 130px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  background-color: rgba(255, 255, 255, 0.45);
}

.modal-title {
  font-weight: bold;
  margin: 0 auto;
  text-align: center;
  font-size: 1.75rem;
}

.modal-body h4 {
  font-weight: bold;
  margin-top: 15px;
  text-decoration: underline;
}

/* Modal sizes */
#recipeModal .modal-dialog {
  max-width: 932px;
  width: 100%;
  height: 1070px;
  margin: auto;
}

#recipeModal .modal-body {
  overflow-y: auto;
  flex: 1;
}

.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.modal-header .btn-close {
  position: absolute;
  right: 15px;
}

/* ===== Flipbook Wrapper ===== */
.flipbook-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.page-number {
  position: absolute;
  bottom: 20px;
  right: 50px;
  font-size: 0.85rem;
  color: #6b3e26;
  font-weight: bold;
  font-family: 'Georgia', serif;
}

.page-date {
  position: absolute;
  top: 40px;
  left: 80px;
  font-size: 0.8rem;
  color: #6b3e26;
  font-family: 'Georgia', serif;
  font-weight: bold;
}


/* ===== Mobile: tablets & small screens ===== */
/* ===== Mobile Modal Fullscreen ===== */
@media (max-width: 768px) {
  #recipeModal .modal-dialog {
    width: 100vw;
    height: 100vh;
    margin: 0;
    max-width: 100%;
  }

  #recipeModal .modal-content {
    width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background: 
      linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)),
      url("../images/notebook.png") center center no-repeat;
    background-size: cover;
    overflow-y: auto;
    box-sizing: border-box;
  }

  .modal-header {
    justify-content: center;
  }

  .modal-header .btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  .modal-title {
    font-size: 1.5rem;
    text-align: center;
    margin: 0 auto 10px;
  }

  .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .ingredients-list,
  .steps-list {
    font-size: 1rem;
    line-height: 1.4;
    padding-left: 10px;
  }

  .modal-action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
  }

  .modal-content img {
    max-width: 80%;
    height: auto;
    margin: 10px auto;
    border-radius: 8px;
  }
}

/* Extra small phones <480px */
@media (max-width: 480px) {
  #recipeModal .modal-title {
    font-size: 1.3rem;
  }

  .ingredients-list,
  .steps-list {
    font-size: 0.9rem;
  }

  .modal-action-buttons button {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
}



/* Book container - acts as the reference */
.book-container {
  display: flex;
  flex-direction: column;
  align-items: center;   /* centers everything relative to the book */
  justify-content: center;
  width: fit-content;
  margin: 0 auto;
}

/* Navbar centered relative to book */
.book-container .navbar {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Buttons centered relative to book */
.book-container .nav-buttons {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* Unlock form styling inside cookbook */
.unlock-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
}

/* Password input */
.unlock-form input[type="password"] {
  width: 70%;
  padding: 10px 14px;
  border: 2px solid #b08d57; /* warm brown border */
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  background: #fffaf3; /* soft parchment feel */
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  transition: 0.2s ease;
}

.unlock-form input[type="password"]:focus {
  outline: none;
  border-color: #8b5e34; /* darker brown when focused */
  box-shadow: 0 0 6px rgba(139, 94, 52, 0.5);
}

/* Unlock button */
.unlock-form button {
  padding: 8px 18px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #d4a373, #b08968);
  color: white;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  transition: all 0.2s ease-in-out;
}

.unlock-form button:hover {
  background: linear-gradient(135deg, #b08968, #8b5e34);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0,0,0,0.25);
}



