body {
  margin: 0;
  background: #0b1220;
  color: white;
  font-family: system-ui, sans-serif;

  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 30px 0;
}

/* WRAPPER */
.calendar-wrapper {
  width: 900px;
  max-width: 95%;

  background: rgba(255,255,255,0.06);
  border-radius: 18px;

  padding: 20px;

  border: 1px solid rgba(255,255,255,0.1);
}

/* TOP BAR */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* WEEKDAYS */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  opacity: 0.6;
  margin: 15px 0;
}

/* GRID */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

/* DAYS */
.day {
  height: 90px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;

  padding: 8px;

  cursor: pointer;

  transition: 0.2s ease;
}

.day:hover {
  background: rgba(99,102,241,0.25);
  transform: translateY(-3px);
}

.empty {
  background: transparent;
  cursor: default;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,0.6);

  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden {
  display: none;
}

.modal-content {
  width: 500px;
  max-height: 85vh;
  overflow-y: auto;

  background: #111827;

  padding: 20px;

  border-radius: 16px;

  border: 1px solid rgba(255,255,255,0.1);
}

textarea {
  width: 100%;
  height: 120px;

  margin: 10px 0;

  background: rgba(255,255,255,0.05);
  color: white;

  border: 1px solid rgba(255,255,255,0.1);

  border-radius: 10px;

  padding: 10px;
}

button {
  cursor: pointer;
}

/* SAVED FOOD LIST */
#savedFoodList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.food-item {
  background: rgba(255,255,255,0.06);
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.food-item:hover {
  background: rgba(99,102,241,0.25);
  transform: translateY(-2px);
}

/* MACRO SECTION */
.macro-section {
  margin-top: 20px;
}

.macro-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.bar-bg {
  width: 100%;
  height: 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.bar {
  height: 100%;
  width: 0%;
  transition: 0.3s ease;
}

.calories {
  background: #f97316;
}

.protein {
  background: #22c55e;
}

.carbs {
  background: #3b82f6;
}

.fat {
  background: #eab308;
}

.fibre {
  background: #a855f7;
}

/* CREATE FOOD BOX */
.create-food-box input {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: white;
  box-sizing: border-box;
}

#cf-saveBtn {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  background: #6366f1;
  color: white;
  cursor: pointer;
  font-size: 15px;
}

#cf-saveBtn:hover {
  background: #4f52d9;
}

#cf-msg {
  color: #22c55e;
  margin: 8px 0 0;
  min-height: 20px;
  transition: opacity 0.3s;
}

#openCreateFoodBtn {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px dashed rgba(99,102,241,0.5);
  border-radius: 10px;
  background: rgba(99,102,241,0.1);
  color: #a5b4fc;
  font-size: 14px;
  transition: 0.2s ease;
}

#openCreateFoodBtn:hover {
  background: rgba(99,102,241,0.25);
  border-color: rgba(99,102,241,0.8);
  color: white;
}
.grams-box {
  width: 320px;
  background: #111827;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
}

.grams-box input {
  width: 100%;
  padding: 12px;
  margin: 14px 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: white;
}

.entry-item {

  margin-top: 12px;

  padding: 12px;

  background: rgba(255,255,255,0.05);

  border-radius: 12px;

  border: 1px solid rgba(255,255,255,0.08);
}

.delete-entry-btn {

  margin-top: 10px;

  padding: 8px 12px;

  border: none;

  border-radius: 8px;

  background: #ef4444;

  color: white;

  cursor: pointer;
}

.day {
  position: relative;
}

/* number stays top-left */
.day-number {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 14px;
  opacity: 0.9;
}

/* green indicator */
.dot {
  position: absolute;
  bottom: 8px;
  right: 8px;

  width: 8px;
  height: 8px;
  border-radius: 50%;

  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}
/* MEAL BUILDER */
#openMealBuilderBtn {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px dashed rgba(34,197,94,0.5);
  border-radius: 10px;
  background: rgba(34,197,94,0.08);
  color: #86efac;
  font-size: 14px;
  transition: 0.2s ease;
  cursor: pointer;
}

#openMealBuilderBtn:hover {
  background: rgba(34,197,94,0.2);
  border-color: rgba(34,197,94,0.8);
  color: white;
}

.meal-builder-box {
  width: 540px;
}

.meal-builder-box input#mb-name {
  width: 100%;
  padding: 10px;
  margin: 6px 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: white;
  box-sizing: border-box;
  font-size: 15px;
}

.mb-ingredient-row {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.mb-ing-name {
  font-weight: 600;
  margin-bottom: 6px;
}

.mb-ing-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.mb-grams-input {
  width: 90px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  color: white;
  font-size: 14px;
}

.mb-remove-ing {
  margin-left: auto;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
  cursor: pointer;
  font-size: 13px;
  transition: 0.2s;
}

.mb-remove-ing:hover {
  background: #ef4444;
  color: white;
}

.mb-ing-macros {
  font-size: 12px;
  opacity: 0.6;
}

.mb-totals {
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}

.mb-totals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  margin-top: 4px;
}

#mb-saveBtn {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  border: none;
  border-radius: 10px;
  background: #22c55e;
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: 0.2s;
}

#mb-saveBtn:hover {
  background: #16a34a;
}

#mb-msg {
  color: #22c55e;
  margin: 8px 0 0;
  min-height: 20px;
  transition: opacity 0.3s;
  font-size: 14px;
}

#mb-food-picker {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 4px;
}

/* NAV LINKS */
.top-bar-links {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 14px;
}
.nav-link {
  padding: 7px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
}
.nav-link:hover {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.4);
  color: white;
}

/* TDEE / DEFICIT ROWS */
.tdee-row {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 8px;
  padding-top: 8px;
  opacity: 0.6;
}
.deficit-row {
  font-weight: 700;
  font-size: 15px;
  margin-top: 4px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.food-search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.food-search-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
}
.food-search-input:focus {
  border-color: rgba(99,102,241,0.6);
}
.food-search-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.food-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 999;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.food-dropdown.open {
  display: block;
}

/* each row */
.food-drop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 8px;
}
.food-drop-item:last-child {
  border-bottom: none;
}

/* left side: name + kcal */
.food-drop-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.food-drop-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* long names get ... */
}
.food-drop-cal {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

/* right side: action buttons */
.food-drop-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.food-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

/* + add button — green */
.food-add-btn {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  font-size: 18px;
  font-weight: 700;
}
.food-add-btn:hover {
  background: #22c55e;
  color: white;
}

/* ✎ edit button — indigo */
.food-edit-btn {
  background: rgba(99,102,241,0.15);
  color: #6366f1;
}
.food-edit-btn:hover {
  background: #6366f1;
  color: white;
}

/* ✕ delete button — red */
.food-del-btn {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}
.food-del-btn:hover {
  background: #ef4444;
  color: white;
}

.food-drop-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.35);
}
