/* Font size levels */
html.font-sm { font-size: 14px; }
html.font-md { font-size: 16px; }
html.font-lg { font-size: 20px; }

/* Tom Select inside Bootstrap input-group — 防止按鈕換行 */
.input-group .ts-wrapper {
  flex: 1 1 auto !important;
  width: 1% !important;
  min-width: 0 !important;
}
.input-group .ts-wrapper .ts-control {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: 0 !important;
  height: 100%;
}
/* 鎖定這些 input-group 不換行 */
.slot-row .input-group,
.week-day-card .input-group,
#dayModalBody .input-group {
  flex-wrap: nowrap !important;
}
/* 菜色配方列：維持 flex 比例 */
.ingredient-row .ts-wrapper.ts-ingredient-sel { flex: 2 !important; min-width: 0 !important; width: auto !important; }
.ingredient-row .ts-wrapper.ts-unit-sel       { flex: 1 !important; min-width: 0 !important; width: auto !important; }

body {
  padding-top: 60px;
  background-color: #f8f9fa;
}

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

.calendar-header-cell {
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 2px;
  color: #6c757d;
}

.calendar-day {
  min-height: 90px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  background: #fff;
  transition: background 0.15s;
  font-size: 0.8rem;
  overflow: hidden;
}

.calendar-day:hover { background: #e9f2ff; }
.calendar-day.today { border: 2px solid #0d6efd; }
.calendar-day.weekend { background: #fafafa; }
.calendar-day-number {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 3px;
}

.calendar-mode-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 10px;
  background: #e8f4f8;
  color: #0d6efd;
  margin-bottom: 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 依模式變色 */
[data-mode="self"] .calendar-mode-badge      { background: #e9ecef; color: #6c757d; }
[data-mode="eat_out"] .calendar-mode-badge   { background: #fff3cd; color: #856404; }
[data-mode="3dish1soup"] .calendar-mode-badge { background: #d1ecf1; color: #0c5460; }
[data-mode="4dish1soup"] .calendar-mode-badge { background: #d4edda; color: #155724; }

/* 外食備註 */
.calendar-note {
  font-size: 0.7rem;
  color: #856404;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.calendar-dish-list {
  list-style: none;
  padding: 0;
  margin: 2px 0 0 0;
  font-size: 0.72rem;
  color: #495057;
  line-height: 1.3;
}

.calendar-dish-list li {
  display: flex;
  align-items: baseline;
  gap: 3px;
  padding: 1px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calendar-dish-list li::before {
  content: '•';
  color: #adb5bd;
  font-size: 0.65rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.calendar-dish-list li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-dish-list li.text-muted {
  color: #adb5bd !important;
  font-size: 0.68rem;
}

.calendar-dish-list li.text-muted::before {
  content: '';
}

.calendar-day-empty { cursor: default; background: #f8f9fa; }

/* Quick action buttons */
.quick-btn {
  height: 80px;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Week view */
.week-day-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.week-day-card.today-card { border-color: #0d6efd; }

/* Slot row */
.slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.slot-label {
  min-width: 50px;
  font-size: 0.82rem;
  color: #6c757d;
  font-weight: 500;
}

/* Shopping list */
.shopping-ingredient-group {
  border-left: 3px solid #0d6efd;
  padding-left: 12px;
  margin-bottom: 12px;
}

.shopping-ingredient-name { font-weight: 600; font-size: 1rem; }
.shopping-unit-row { font-size: 0.9rem; color: #495057; margin-top: 2px; }
.shopping-conflict { border-left-color: #fd7e14; }
.shopping-conflict .shopping-unit-row::before { content: "⚠ "; color: #fd7e14; }

/* Ingredient inline edit */
.ingredient-name-display { cursor: pointer; }
.ingredient-edit-form { display: none; }

/* Dish card */
.dish-card {
  transition: box-shadow 0.15s;
}
.dish-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.12); }

/* Mobile optimizations */
@media (max-width: 576px) {
  /* 格子：稍高以容納模式＋菜色 */
  .calendar-day {
    min-height: 72px;
    font-size: 0.68rem;
    padding: 4px 3px;
  }
  .calendar-day-number { font-size: 0.78rem; margin-bottom: 2px; }

  /* 行動端 badge：縮小字型讓縮寫文字完整顯示 */
  .calendar-mode-badge {
    font-size: 0.6rem;
    padding: 1px 3px;
    margin-bottom: 2px;
  }

  /* 行動端菜色列表：最多顯示 3 道 */
  .calendar-dish-list li:nth-child(n+4) { display: none; }
  .calendar-dish-list { font-size: 0.65rem; }
  .calendar-dish-list li { padding: 0; }

  /* 外食備註字小 */
  .calendar-note { font-size: 0.62rem; }

  .quick-btn { height: 60px; font-size: 1rem; }
  .slot-row { flex-wrap: wrap; }
}

/* Navbar font toggle */
.font-toggle-group .btn { padding: 2px 8px; font-size: 0.8rem; }
