/* =========================================================
   Lutopia · Weekly Meal Planner
   Cozy rustic-kitchen theme (refined)
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces (deep -> raised) */
  --bg-deep: #150c07;
  --panel: #2a1810;
  --panel-raised: #3d2416;
  --panel-inset: rgba(20, 11, 6, 0.55);
  --card-a: #4a3525;
  --card-b: #352518;

  /* Text (contrast-checked on dark wood) */
  --text: #f2e0c6;
  --text-muted: #cdb088;
  --text-faint: #ad9068;

  /* Brand / accents */
  --gold: #f4c57a;
  --gold-soft: #d4a574;
  --gold-deep: #c78a3a;
  --line: rgba(212, 165, 116, 0.18);
  --line-strong: rgba(212, 165, 116, 0.42);

  /* Meal accents */
  --breakfast: #f0b95e;
  --lunch: #bcd06d;
  --dinner: #e28a6a;

  /* Semantic */
  --success: #86c46f;
  --weekend: #e0a06a;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Elevation */
  --sh-1: 0 2px 8px rgba(0, 0, 0, 0.35);
  --sh-2: 0 8px 24px rgba(0, 0, 0, 0.45);
  --sh-3: 0 25px 80px rgba(0, 0, 0, 0.6);
  --hi: inset 0 1px 1px rgba(255, 235, 205, 0.12);

  /* Calendar tracks (shared by headers + rows so columns always align) */
  --label-col: clamp(84px, 11vw, 118px);
  --day-min: 78px;
  --cal-gap: clamp(5px, 0.7vw, 9px);

  /* Motion + focus */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t: 0.22s var(--ease);
  --focus: 0 0 0 3px rgba(244, 197, 122, 0.5);
}

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

body {
  font-family: "Cormorant Garamond", serif;
  background: radial-gradient(
    120% 120% at 50% 0%,
    #24140c 0%,
    var(--bg-deep) 70%
  );
  height: 100vh;
  color: var(--text);
  overflow: hidden;
}

/* Accessible focus ring for every interactive element */
:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Page shell ---------- */
.meal-planner-page {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2.5vw, 32px);
  /* reserve room for the fixed left rail so the card never sits under it */
  padding-left: clamp(96px, 11vw, 172px);
}

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

/* Warm vignette so the card reads clearly against the busy kitchen art */
.meal-planner-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
    135% 100% at 50% 45%,
    transparent 46%,
    rgba(8, 4, 2, 0.55) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* ---------- Left navigation rail (matches Start.html) ---------- */
.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);
}

/* ---------- Main card ---------- */
.main-card {
  background: linear-gradient(
    145deg,
    var(--panel-raised) 0%,
    var(--panel) 50%,
    #1f120d 100%
  );
  border-radius: var(--r-xl);
  box-shadow:
    var(--sh-3),
    var(--hi),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  padding: clamp(12px, 1.5vw, 20px);
  max-width: 820px;
  width: 100%;
  border: 1px solid var(--line);
  position: relative;
  z-index: 3;
  margin: 0 auto;
}

.main-card::before {
  content: "";
  position: absolute;
  inset: -7px;
  background: linear-gradient(
    145deg,
    #4a2f1e 0%,
    var(--panel) 50%,
    #1f120d 100%
  );
  border-radius: calc(var(--r-xl) + 6px);
  z-index: -1;
  opacity: 0.5;
}

/* ---------- Header ---------- */
.planner-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo::before {
  content: "";
  width: 40px;
  height: 40px;
  flex: none;
  background: radial-gradient(circle at 35% 30%, var(--gold), var(--gold-deep));
  border-radius: 50%;
  box-shadow:
    var(--sh-1),
    inset 0 2px 4px rgba(255, 240, 210, 0.4);
  /* whisk glyph */
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2v7'/><path d='M8 9c0 4 1 8 4 13 3-5 4-9 4-13'/><path d='M8.5 9h7'/></svg>")
    center / 62% no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2v7'/><path d='M8 9c0 4 1 8 4 13 3-5 4-9 4-13'/><path d='M8.5 9h7'/></svg>")
    center / 62% no-repeat;
}

.logo-text {
  font-family: "Cinzel", serif;
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  font-weight: 700;
  color: var(--gold);
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(212, 165, 116, 0.25);
  letter-spacing: 0.05em;
}

.logo-text.highlight {
  color: var(--gold);
}

.welcome-text {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--text-muted);
  text-align: right;
  line-height: 1.5;
  flex: 1 1 260px;
}

.welcome-text .subtitle {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.92em;
  color: var(--gold-soft);
  font-style: italic;
}

/* ---------- Calendar ---------- */
.calendar-section {
  background: linear-gradient(
    145deg,
    rgba(61, 36, 22, 0.6) 0%,
    rgba(42, 24, 16, 0.85) 100%
  );
  border-radius: var(--r-lg);
  padding: clamp(10px, 1.3vw, 16px);
  margin-bottom: 12px;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(255, 230, 200, 0.05);
  border: 1px solid var(--line);
}

/* Horizontal scroll wrapper keeps headers + rows locked to the same tracks */
.calendar-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #5a4030 rgba(0, 0, 0, 0.2);
  -webkit-overflow-scrolling: touch;
}

.calendar-scroll::-webkit-scrollbar {
  height: 8px;
}
.calendar-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--r-pill);
}
.calendar-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(145deg, #5a4030, #403020);
  border-radius: var(--r-pill);
}

.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1vw, 11px);
  /* default (auto = min-content) lets columns fill when wide,
     and overflow-scroll via .calendar-scroll only when cramped */
}

.day-headers,
.meal-row {
  display: grid;
  grid-template-columns: var(--label-col) repeat(7, minmax(var(--day-min), 1fr));
  gap: var(--cal-gap);
}

.day-headers {
  align-items: stretch;
}

.corner-spacer {
  /* aligns the day pills with the meal-card columns */
}

.day-pill {
  padding: 8px 6px;
  border-radius: var(--r-md);
  font-family: "Cinzel", serif;
  font-size: clamp(0.72rem, 1vw, 0.95rem);
  font-weight: 700;
  text-align: center;
  color: #f6e2c4;
  background: linear-gradient(145deg, #7a5330 0%, #5c3d22 100%);
  box-shadow:
    var(--sh-1),
    inset 0 1px 1px rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  transition:
    transform var(--t),
    box-shadow var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-pill:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--sh-2),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

/* Weekend columns get a warm distinct tone */
.day-sun,
.day-sat {
  background: linear-gradient(145deg, #8a4a3c 0%, #63332a 100%);
  color: #ffe6d0;
}

.meal-rows {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1vw, 11px);
}

.meal-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-family: "Cinzel", serif;
  font-size: clamp(0.78rem, 1vw, 1rem);
  font-weight: 700;
  box-shadow:
    var(--sh-1),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  border-left-width: 4px;
}

.meal-ico {
  width: 22px;
  height: 22px;
  flex: none;
}

.meal-name {
  white-space: nowrap;
}

.breakfast-label {
  background: linear-gradient(145deg, #5a4428 0%, #40301c 100%);
  color: var(--breakfast);
  border-left-color: var(--breakfast);
}

.lunch-label {
  background: linear-gradient(145deg, #46521f 0%, #333c16 100%);
  color: var(--lunch);
  border-left-color: var(--lunch);
}

.dinner-label {
  background: linear-gradient(145deg, #5a2a2a 0%, #401a1a 100%);
  color: var(--dinner);
  border-left-color: var(--dinner);
}

/* JS renders .meal-card children straight into the row grid */
.meal-cards {
  display: contents;
}

.meal-card {
  background: linear-gradient(145deg, var(--card-a) 0%, var(--card-b) 100%);
  border-radius: var(--r-md);
  padding: 8px 6px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  box-shadow:
    var(--sh-1),
    inset 0 1px 1px rgba(255, 230, 200, 0.08);
  border: 1px solid var(--line);
  transition:
    transform var(--t),
    box-shadow var(--t),
    border-color var(--t);
  position: relative;
  overflow: hidden;
}

.meal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 55%
  );
  pointer-events: none;
}

.meal-card:hover {
  transform: translateY(-3px);
  box-shadow:
    var(--sh-2),
    inset 0 1px 1px rgba(255, 230, 200, 0.14);
  border-color: var(--line-strong);
}

.meal-card:active {
  transform: translateY(0) scale(0.98);
}

.meal-card.filled {
  background: linear-gradient(145deg, #5a4028 0%, #3c2c19 100%);
  border-color: var(--line-strong);
}

.meal-card-img {
  width: clamp(44px, 4vw, 54px);
  height: clamp(44px, 4vw, 54px);
  border-radius: var(--r-sm);
  object-fit: cover;
  border: 2px solid rgba(212, 165, 116, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.meal-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Empty slots: clear "add" affordance */
.meal-card.empty {
  background: repeating-linear-gradient(
    -45deg,
    rgba(74, 53, 37, 0.35) 0,
    rgba(74, 53, 37, 0.35) 10px,
    rgba(53, 37, 24, 0.35) 10px,
    rgba(53, 37, 24, 0.35) 20px
  );
  border-style: dashed;
  border-color: rgba(180, 140, 100, 0.3);
}

.meal-card.empty::after {
  content: "+";
  order: -1; /* place the plus above the "Add Meal" label */
  font-family: "Cinzel", serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold-soft);
  opacity: 0.7;
  transition:
    transform var(--t),
    opacity var(--t);
}

.meal-card.empty:hover::after {
  opacity: 1;
  transform: scale(1.15);
}

.meal-card.empty .meal-card-name {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 0.74rem;
}

.meal-card.salamat::after {
  content: "Maraming Salamat";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  z-index: 20;
  white-space: nowrap;
  opacity: 0;
  animation: fadeOutUp 1.5s ease-in forwards;
}

@keyframes fadeOutUp {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -120%) scale(0.8);
  }
}

/* ---------- Context menu ---------- */
.meal-context-menu {
  position: fixed;
  background: linear-gradient(
    145deg,
    var(--panel-raised) 0%,
    var(--panel) 100%
  );
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  z-index: 1000;
  min-width: 150px;
  padding: 6px;
  animation: popIn 0.18s var(--ease);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.meal-context-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Cormorant Garamond", serif;
  cursor: pointer;
  text-align: left;
  transition:
    background var(--t),
    color var(--t);
}

.meal-context-menu-item:hover {
  background: rgba(212, 165, 116, 0.16);
  color: var(--gold);
}

/* ---------- Action buttons ---------- */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* Shared button base */
.action-btn,
.back-home-btn,
.generate-btn,
.save-shopping-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 26px;
  border-radius: var(--r-md);
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform var(--t),
    box-shadow var(--t),
    filter var(--t);
  min-height: 40px;
}

/* Primary (gold) */
.action-btn,
.btn-shopping,
.generate-btn {
  background: linear-gradient(180deg, #f1c67c 0%, var(--gold-deep) 100%);
  color: #3a2412;
  border: 1px solid rgba(255, 232, 194, 0.55);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.4);
  box-shadow: var(--sh-1), var(--hi);
}

.action-btn:hover,
.generate-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-2), var(--hi);
  filter: brightness(1.05);
}

.action-btn:active,
.generate-btn:active,
.back-home-btn:active,
.save-shopping-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Secondary / ghost */
.back-home-btn {
  background: linear-gradient(145deg, #3c2e22 0%, #2a2018 100%);
  border: 1px solid var(--line);
  color: var(--text-muted);
  box-shadow: var(--sh-1), var(--hi);
  margin: 0 auto;
  font-size: 0.88rem;
}

.back-home-btn:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: var(--gold);
  box-shadow: var(--sh-2);
}

/* ---------- Modals (recipe + shopping) ---------- */
.recipe-modal-overlay,
.shopping-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 9, 6, 0.86);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.recipe-modal-overlay.show,
.shopping-modal-overlay.show {
  display: flex;
  animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.recipe-modal,
.shopping-modal {
  background: linear-gradient(
    145deg,
    var(--panel-raised) 0%,
    var(--panel) 100%
  );
  border-radius: var(--r-xl);
  width: 100%;
  overflow: hidden;
  box-shadow:
    var(--sh-3),
    0 0 0 1px var(--line);
  border: 1px solid var(--line-strong);
  animation: modalIn 0.28s var(--ease);
}

.recipe-modal {
  max-width: 900px;
  max-height: 85dvh;
}

.shopping-modal {
  max-width: 650px;
  max-height: 80dvh;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.recipe-modal-header,
.shopping-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    145deg,
    rgba(61, 36, 22, 0.85) 0%,
    rgba(42, 24, 16, 0.6) 100%
  );
}

.recipe-modal-title,
.shopping-modal-title {
  font-family: "Cinzel", serif;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  color: var(--gold-soft);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.highlight-text {
  color: var(--gold);
}

.modal-close-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #5a3a28 0%, #40281c 100%);
  border-radius: 50%;
  color: var(--gold-soft);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sh-1);
  transition:
    transform var(--t),
    background var(--t),
    border-color var(--t);
}

.modal-close-btn:hover {
  transform: scale(1.1);
  background: linear-gradient(145deg, #6a4a38 0%, #503828 100%);
  border-color: var(--line-strong);
  color: var(--gold);
}

.recipe-modal-body {
  padding: 22px 26px;
  max-height: calc(85dvh - 96px);
  overflow-y: auto;
}

.shopping-modal-body {
  padding: 22px 26px;
  max-height: calc(80dvh - 96px);
  overflow-y: auto;
}

.recipe-modal-body,
.shopping-list-container {
  scrollbar-width: thin;
  scrollbar-color: #5a4030 rgba(0, 0, 0, 0.2);
}

.recipe-modal-body::-webkit-scrollbar,
.shopping-list-container::-webkit-scrollbar {
  width: 9px;
}
.recipe-modal-body::-webkit-scrollbar-track,
.shopping-list-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--r-pill);
}
.recipe-modal-body::-webkit-scrollbar-thumb,
.shopping-list-container::-webkit-scrollbar-thumb {
  background: linear-gradient(145deg, #5a4030, #403020);
  border-radius: var(--r-pill);
  border: 2px solid rgba(61, 36, 22, 0.5);
}

/* Search */
.recipe-search-box {
  margin-bottom: 18px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-ico {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--text-faint);
  pointer-events: none;
}

.recipe-search {
  width: 100%;
  padding: 13px 18px 13px 46px;
  background: linear-gradient(
    145deg,
    rgba(61, 36, 22, 0.6) 0%,
    rgba(42, 24, 16, 0.85) 100%
  );
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  color: var(--text);
  transition:
    border-color var(--t),
    box-shadow var(--t);
}

.recipe-search:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: var(--focus);
}

.recipe-search::placeholder {
  color: var(--text-faint);
}

/* Filters */
.recipe-filters {
  display: flex;
  gap: 9px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 9px 16px;
  min-height: 40px;
  background: linear-gradient(
    145deg,
    rgba(61, 36, 22, 0.5) 0%,
    rgba(42, 24, 16, 0.7) 100%
  );
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--t),
    border-color var(--t),
    color var(--t),
    box-shadow var(--t);
  letter-spacing: 0.04em;
}

.filter-pill:hover {
  border-color: var(--line-strong);
  color: var(--gold-soft);
}

.filter-pill.active {
  background: linear-gradient(180deg, #f1c67c 0%, var(--gold-deep) 100%);
  border-color: rgba(255, 232, 194, 0.55);
  color: #3a2412;
  box-shadow: 0 2px 10px rgba(244, 197, 122, 0.3);
}

/* Recipe grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.recipe-item {
  background: linear-gradient(145deg, var(--card-a) 0%, var(--card-b) 100%);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  box-shadow:
    var(--sh-1),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  transition:
    transform var(--t),
    box-shadow var(--t),
    border-color var(--t);
}

.recipe-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-2);
  border-color: var(--line-strong);
}

.recipe-item:active {
  transform: translateY(-1px) scale(0.99);
}

.recipe-item-img {
  width: 92px;
  height: 92px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 2px solid rgba(212, 165, 116, 0.2);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.recipe-item-name {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.recipe-item-category {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: center;
}

/* ---------- Shopping list ---------- */
.shopping-generate-section {
  text-align: center;
  margin-bottom: 20px;
}

.shopping-hint {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 16px;
  font-style: italic;
}

.shopping-list-container {
  background: var(--panel-inset);
  border-radius: var(--r-lg);
  padding: 18px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
  min-height: 120px;
  border: 1px solid var(--line);
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: rgba(74, 53, 37, 0.42);
  border-radius: var(--r-sm);
  margin-bottom: 9px;
  border: 1px solid var(--line);
}

.shopping-item:last-child {
  margin-bottom: 0;
}

.shopping-item-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: brightness(0.9) sepia(0.2);
}

.shopping-item-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  font-size: 1.05rem;
}

.shopping-item-qty {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(212, 165, 116, 0.16);
  padding: 5px 12px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

.shopping-empty {
  text-align: center;
  color: var(--text-faint);
  font-style: italic;
  padding: 32px 12px;
}

.save-shopping-btn {
  width: 100%;
  background: linear-gradient(180deg, #93cf7c 0%, #4f8a3f 100%);
  border: 1px solid rgba(220, 245, 200, 0.4);
  color: #16300f;
  text-shadow: 0 1px 0 rgba(230, 255, 210, 0.4);
  box-shadow: var(--sh-1), var(--hi);
}

.save-shopping-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
  filter: brightness(1.05);
}

/* ---------- Close button ---------- */
.close-btn {
  position: fixed;
  top: 10px;
  right: 12px;
  width: clamp(64px, 6vw, 96px);
  height: clamp(64px, 6vw, 96px);
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 12;
  padding: 0;
  transition:
    transform var(--t),
    filter var(--t);
}

.close-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

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

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

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  :root {
    --label-col: clamp(84px, 11vw, 120px);
    --day-min: 92px;
  }
}

/* Tablet / phone: keep the Start-style vertical rail, stack the card content */
@media (max-width: 820px) {
  .planner-header {
    flex-direction: column;
    text-align: center;
  }

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

  .welcome-text {
    text-align: center;
  }

  .day-pill {
    font-size: 0.74rem;
  }

  .action-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .close-btn {
    top: 8px;
    right: 8px;
  }
}

/* Short viewports: shrink rail buttons so all five stay visible and spread */
@media (max-height: 620px) {
  .nav-btn {
    width: clamp(60px, 13vh, 104px);
    height: clamp(50px, 11vh, 88px);
  }
}

@media (max-width: 560px) {
  :root {
    --day-min: 84px;
    --cal-gap: 7px;
  }

  .main-card {
    padding: 16px 14px;
  }

  .recipe-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .recipe-item-img {
    width: 78px;
    height: 78px;
  }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .meal-card.salamat::after {
    opacity: 1;
  }
}
