/* --- Meal planner calendar ------------------------------------------------- */
/* One grid does both views: week is a single 7-column row of tall day cards,
   month is the same 7 columns repeated over as many rows as the month needs,
   with a narrow leading gutter carrying the per-week actions. */

.weeknav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.weeknav b { font-size: 15px; font-weight: 700; color: var(--text); min-width: 165px; }

.weeknav button {
  padding: 7px 13px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.weeknav button:hover { background: var(--surface-3); }
.weeknav .step { width: 32px; padding: 7px 0; text-align: center; }

/* week / month switch */
.viewtog { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-3); border-radius: 10px; }

.viewtog button {
  padding: 6px 15px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-weight: 650;
  font-size: 13px;
  color: var(--text-muted);
}

.viewtog button:hover { background: transparent; color: var(--text-soft); }
.viewtog button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.viewtog button.on:hover { background: var(--surface); color: var(--text); }

.plcal { display: grid; gap: 8px; align-items: stretch; }
.plcal.week  { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.plcal.month { grid-template-columns: 46px repeat(7, minmax(0, 1fr)); gap: 6px; }

.cal-dow {
  font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); text-align: center; padding: 0 0 2px;
}

.cal-day {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 8px 6px;
  min-height: 190px;
  box-shadow: var(--shadow-card);
  transition: border-color .12s ease, background-color .12s ease;
}

.plcal.month .cal-day { min-height: 108px; padding: 6px 6px 4px; }
.cal-day.out { background: var(--bg-soft); box-shadow: none; }
.cal-day.out .cal-dnum { color: var(--text-muted); }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.cal-day.drop { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }

.cal-dhead { display: flex; align-items: baseline; gap: 6px; }
.cal-dname { font-size: 11.5px; font-weight: 700; color: var(--text-muted); letter-spacing: .03em; }
.cal-dnum  { font-size: 14px; font-weight: 750; color: var(--text); }
.cal-day.today .cal-dnum { color: var(--accent); }
.cal-dhead .n { margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--text-muted); }

/* the meal stack — flex:1 so the whole empty area of a day is a drop target */
.cal-meals { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 14px; }

.cal-chip {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  background: var(--accent-soft);
  color: var(--green-dark);
  border-radius: 8px;
  padding: 5px 5px 5px 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;                 /* so a drag on a touchscreen isn't a scroll */
}

.cal-chip .t {
  flex: 1; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.cal-chip .rm {
  flex: none; width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--green-dark); opacity: .45; cursor: pointer;
}

.cal-chip .rm:hover { opacity: 1; background: var(--red); color: #fff; }
.cal-chip.lifted { opacity: .3; }

/* the chip that follows the pointer while dragging */
.cal-ghost {
  position: fixed; z-index: 200; pointer-events: none;
  transform: translate(-50%, -50%) rotate(-2deg);
  box-shadow: var(--shadow-pop); opacity: .96;
}

body.pl-dragging, body.pl-dragging .cal-chip { cursor: grabbing; }

/* where the dragged meal will land */
.cal-mark { height: 3px; border-radius: 3px; background: var(--accent); margin: 1px 0; }

.cal-add {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: transparent;
  padding: 4px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-muted);
  cursor: pointer;
  opacity: .7;
  transition: opacity .12s ease, border-color .12s ease, color .12s ease;
}

.cal-day:hover .cal-add { opacity: 1; }
.cal-add:hover { border-color: var(--accent); border-style: solid; color: var(--accent); }
.cal-add .ic { width: 14px; height: 14px; display: block; margin: 0 auto; }
.cal-chip .rm .ic { width: 9px; height: 9px; }

/* the "printing is per week" note that replaces the week toolbar in month view */
.plnote { color: var(--text-muted); font-size: 12.5px; max-width: 340px; text-align: right; line-height: 1.35; }

/* month view: the per-week gutter down the left edge */
.cal-wk {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding-top: 8px; color: var(--text-muted);
}

.cal-wk .d { font-size: 10.5px; font-weight: 750; letter-spacing: .02em; }

.cal-wk button {
  width: 26px; height: 24px; border-radius: 7px;
  background: transparent; border: 1px solid transparent;
  font-size: 12px; color: var(--text-muted); cursor: pointer; opacity: .55;
  transition: opacity .12s ease, background-color .12s ease;
}

.cal-wk button:hover { opacity: 1; background: var(--surface-3); border-color: var(--border); }
.cal-wk button .ic { width: 14px; height: 14px; display: block; margin: 0 auto; }

/* the add-a-meal picker */
.mealpick { max-width: 620px; padding: 22px 24px 18px; }
.mealpick h3 { font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.mealpick .sub { color: var(--text-muted); font-size: 13px; margin: 2px 0 14px; }

.mealpick input.q {
  width: 100%; padding: 10px 13px; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-soft); color: var(--text); outline: none;
}

.mealpick input.q:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

.mpick-list { margin-top: 12px; max-height: min(52vh, 460px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }

.mpick-row {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left;
  padding: 6px 8px; border-radius: 9px; background: transparent; border: none;
  cursor: pointer; color: var(--text); transition: background-color .12s ease;
}

.mpick-row:hover, .mpick-row:focus-visible { background: var(--surface-3); outline: none; }
.mpick-row img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; flex: none; background: var(--surface-3); }
.mpick-row .tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mpick-row .nm { font-size: 13.5px; font-weight: 650; }
.mpick-row .mt { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.mpick-row .nm, .mpick-row .mt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpick-empty { padding: 18px 8px; color: var(--text-muted); font-size: 13px; text-align: center; }

/* the day picker used by the calendar button on a recipe card */
.daypick { max-width: 460px; padding: 22px 24px 20px; }
.daypick .mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.daypick .mini .dw { font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); text-align: center; padding-bottom: 2px; }

.daypick .mini button {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 650; color: var(--text);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}

.daypick .mini button:hover { border-color: var(--accent); background: var(--accent-soft); }
.daypick .mini button.out { color: var(--text-muted); background: var(--bg-soft); }
.daypick .mini button.today { border-color: var(--accent); color: var(--accent); }
.daypick .mini button .dot { width: 4px; height: 4px; border-radius: 999px; background: var(--accent); }

@media (max-width: 1180px) {
  .plcal.week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .plcal.week .cal-day { min-height: 150px; }
}

@media (max-width: 820px) {
  .plcal.week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plcal.month { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .cal-wk { display: none; }                    /* no room for the week gutter */
  .plcal.month .cal-day { min-height: 84px; padding: 4px; }
  .plcal.month .cal-chip { font-size: 11px; padding: 3px 3px 3px 6px; }
  .plcal.month .cal-chip .t { -webkit-line-clamp: 1; }
  .plcal.month .cal-add { display: none; }        /* tap the empty day instead */
}

@media (max-width: 520px) {
  .plcal.week { grid-template-columns: minmax(0, 1fr); }
  .plcal.week .cal-day { min-height: 0; }
}

