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

@import url("meal-planner.css");

body {
  font-family: "Cormorant Garamond", serif;
  background: linear-gradient(135deg, #1a0f0a 0%, #2d1810 50%, #1a0f0a 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.meal-planner-page {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bg-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.top-navigation {
  position: fixed;
  top: 0;
  left: clamp(6px, 1.3vw, 20px);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  padding: 22px 0;
  z-index: 100;
}

.ui-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition:
    transform var(--t),
    filter var(--t);
}

.nav-btn {
  width: clamp(84px, 9vw, 130px);
  height: clamp(72px, 7.6vw, 110px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Icon+label PNGs (labels are baked into the artwork) */
.nav-btn .title-logo,
.title-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.5));
}

.ui-btn:hover {
  transform: translateY(-3px) scale(1.04);
  filter: brightness(1.08);
}

.ui-btn:active {
  transform: translateY(0) scale(0.98);
}

.close-btn {
  position: absolute;
  top: 1px;
  right: -2px;
  width: 100px;
  height: 100px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.close-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.close-btn:hover {
  transform: scale(1.08);
  filter: brightness(1.12);
}

.journal-book-shell {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 20px;
}

.journal-book-frame {
  width: min(90vw, 1000px);
  aspect-ratio: 3 / 2;
  background: url("../img/chefbook.png") center/contain no-repeat;
  position: relative;
  padding: 6% 5%;
  filter: drop-shadow(0 25px 40px rgba(0, 0, 0, 0.35));
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.journal-right-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(90vw, 1000px);
  aspect-ratio: 3 / 2;
  max-height: min(90vh, 666px);
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

.journal-left-header {
  position: absolute;
  top: 12%;
  left: 13%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 40%;
  color: #4a2d14;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  font-family: "Cinzel", serif;
}

.journal-left-header .journal-label-main {
  font-size: clamp(1.5rem, 2.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.journal-left-header .journal-label-sub {
  font-size: clamp(1.1rem, 1.8vw, 1.7rem);
  font-weight: 500;
  line-height: 1.1;
}

.cooking-history-board {
  --recipe-card-height: 76px;
  --card-gap: 12px;

  position: absolute;
  top: 27%;
  left: 12%;
  width: 33%;
  height: 58%;
  max-height: 58%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 10px 4px 10px 0;
  gap: var(--card-gap);
  isolation: isolate;
  scrollbar-width: thin;
  scrollbar-color: #caa77a transparent;
}

.cooking-history-board::-webkit-scrollbar {
  width: 10px;
}

.cooking-history-board::-webkit-scrollbar-track {
  background: transparent;
}

.cooking-history-board::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e0c8a8, #caa77a);
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.06);
}

.recipe-cards-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-date-header {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b4a26;
  padding: 6px 2px 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-date-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(107, 74, 38, 0.45), transparent);
}

.recipe-card {
  display: flex;
  align-items: center;
  background: linear-gradient(
    135deg,
    rgba(245, 235, 220, 0.95) 0%,
    rgba(230, 215, 195, 0.95) 100%
  );
  border: 1px solid rgba(139, 111, 71, 0.55);
  border-left: 4px solid #8b6f47;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
  gap: 12px;
  min-width: 0;
  height: var(--recipe-card-height);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  animation: card-enter 0.4s ease backwards;
  animation-delay: calc(var(--card-index, 0) * 45ms);
}

.recipe-card:hover,
.recipe-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  border-left-color: #b8874a;
  outline: none;
}

.recipe-card:active {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .recipe-card,
  .favorite-recipe-card {
    animation: none;
  }
}

.recipe-card-image {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(139, 111, 71, 0.35);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.recipe-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}

.recipe-card-name {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #3a2214;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 6px;
}

.recipe-card-count {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #f5ebe0;
  background: #8b6f47;
  border-radius: 10px;
  padding: 1px 7px;
  line-height: 1.3;
  flex-shrink: 0;
}

.recipe-card-checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 34px;
  padding: 0 16px;
  background: rgba(139, 111, 71, 0.12);
  color: #8b6f47;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 999px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.recipe-card:hover .recipe-card-checkmark,
.recipe-card:focus-visible .recipe-card-checkmark {
  background: #8b6f47;
  color: #f5ebe0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.empty-history-message {
  position: absolute;
  top: 50%;
  left: 13%;
  width: 30%;
  transform: translateY(-50%);
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: #8b6f47;
  font-style: italic;
  opacity: 0.7;
}

.empty-favorites-message {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30%;
  transform: translateY(-50%);
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: #8b6f47;
  font-style: italic;
  opacity: 0.7;
}

.journal-right-header {
  position: absolute;
  top: 16%;
  left: 53%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 40%;
  color: #4a2d14;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  font-family: "Cinzel", serif;
}

.journal-right-header .journal-label-main {
  font-size: clamp(1.5rem, 2.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.favorite-recipes-board {
  position: absolute;
  top: 27%;
  left: 55%;
  width: 33%;
  height: 58%;
  display: block;
  overflow-y: auto;
  padding: 10px 6px;
  box-sizing: border-box;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: #caa77a transparent;
}

.favorite-recipes-board::-webkit-scrollbar {
  width: 10px;
}

.favorite-recipes-board::-webkit-scrollbar-track {
  background: transparent;
}

.favorite-recipes-board::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e0c8a8, #caa77a);
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.06);
}

.favorite-recipe-cards-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 160px;
  row-gap: 12px;
  width: 100%;
  justify-items: center;
  padding: 0;
  box-sizing: border-box;
}

.favorite-recipe-card {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #f7ead9;
  border: 1px solid rgba(115, 83, 52, 0.18);
  border-radius: 24px;
  padding: 5px 5px 5px;
  min-height: 130px;
  width: 150px;
  max-width: 150px;
  position: relative;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.3s ease;
  animation: card-enter 0.4s ease backwards;
  animation-delay: calc(var(--card-index, 0) * 45ms);
}

.favorite-recipe-card:hover,
.favorite-recipe-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  outline: none;
}

.favorite-recipe-card:active {
  transform: translateY(-1px) scale(0.98);
}

.favorite-recipe-card.removing {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.favorite-card-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: #8b3a3a;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    background 0.15s ease;
  z-index: 2;
}

.favorite-recipe-card:hover .favorite-card-remove,
.favorite-recipe-card:focus-within .favorite-card-remove {
  opacity: 1;
}

.favorite-card-remove:hover {
  background: #c22f2f;
  color: #fff;
  transform: scale(1.12);
}

@media (hover: none) {
  .favorite-card-remove {
    opacity: 1;
  }
}

.favorite-card-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  transform: none;
  width: 26px;
  height: 26px;
  background: #ffffffcc;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #c22f2f;
  font-size: 0.9rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  z-index: 2;
}

.favorite-card-image-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
  margin: 10px 0 6px;
}

.favorite-recipe-card-image {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 16px;
  transition: transform 0.25s ease;
}

.favorite-recipe-card:hover .favorite-recipe-card-image {
  transform: scale(1.06);
}

.favorite-recipe-card-name {
  margin-top: 2px;
  text-align: center;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #432b1b;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

@media (max-width: 1024px), (max-aspect-ratio: 4/3) {
  .journal-right-header {
    top: 19%;
    left: 57%;
  }

  .favorite-recipes-board {
    left: 53%;
    width: 33%;
    height: 46%;

  }
}
  



@media (max-height: 620px) {
  .cooking-history-board {
    --recipe-card-height: 60px;
  }

  .recipe-card-image {
    width: 42px;
    height: 42px;
  }

  .recipe-card-name {
    font-size: 0.82rem;
  }

  .favorite-recipe-cards-container {
    grid-auto-rows: 130px;
  }

  .favorite-recipe-card {
    min-height: 105px;
    width: 120px;
  }

  .favorite-recipe-card-image {
    height: 76px;
  }
}
