/* ============================================
   MEAL — List Item Component
   <link rel="stylesheet" href="meal-list-item.css">
   ============================================ */

#list {
  position: relative;
  z-index: 1;
  width: min(430px, 88%);
  margin-top: clamp(8px, 1.2vw, 14px);
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 100%;
  overflow: auto;
  padding-right: 4px;
}

/* ── CATÉGORIE ── */
.meal-cat {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #7a6a58;
  margin: 14px 0 3px;
}

.meal-cat:first-child {
  margin-top: 0;
}

/* ── SOUS-CATÉGORIE ── */
.meal-sub {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #9a8a78;
  margin: 0 0 8px;
}

/* ── ITEM ── */
.meal-item {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border: 0.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 8px rgba(180, 140, 100, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, opacity 0.25s ease;
  margin-bottom: 6px;
}

.meal-item:active {
  transform: scale(0.98);
}

/* ── CHECKBOX ── */
.meal-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(180, 160, 130, 0.7);
  background: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.meal-checkbox svg {
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── NOM ── */
.meal-name {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 17px;
  font-weight: 400;
  color: #1a1a1a;
  flex: 1;
  letter-spacing: -0.2px;
  transition: color 0.2s ease;
}

/* ── QUANTITÉ ── */
.meal-qty {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #8a7a68;
  white-space: nowrap;
  transition: color 0.2s ease;
}

/* ── ÉTAT COCHÉ ── */
.meal-item.checked {
  opacity: 0.38;
}

.meal-item.checked .meal-checkbox {
  background: #34C759;
  border-color: #34C759;
}

.meal-item.checked .meal-checkbox svg {
  opacity: 1;
  transform: scale(1);
}

.meal-item.checked .meal-name {
  text-decoration: line-through;
  color: #b0a090;
}

.meal-item.checked .meal-qty {
  color: #c0b0a0;
}

/* ── SÉPARATEUR ── */
.meal-divider {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 0 6px;
}

.meal-divider.visible {
  display: flex;
}

.meal-divider-line {
  flex: 1;
  height: 0.5px;
  background: rgba(150, 130, 110, 0.3);
}

.meal-divider-label {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #a09080;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* ── ZONE DONE ── */
#meal-zone-done {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#meal-zone-todo {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (max-width: 768px) {
  #list {
    width: 100%;
    margin-top: 4px;
    padding-right: 0;
  }

  .meal-cat {
    margin-top: 10px;
  }
}

@media (prefers-color-scheme: dark) {
  .meal-cat {
    color: rgba(235, 235, 245, 0.68);
  }

  .meal-sub {
    color: rgba(235, 235, 245, 0.52);
  }

  .meal-item {
    background: rgba(35, 35, 40, 0.7);
    border: 0.5px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .meal-checkbox {
    border-color: rgba(235, 235, 245, 0.34);
    background: rgba(255, 255, 255, 0.05);
  }

  .meal-name {
    color: rgba(245, 245, 247, 0.96);
  }

  .meal-qty {
    color: rgba(235, 235, 245, 0.66);
  }

  .meal-item.checked .meal-name {
    color: rgba(235, 235, 245, 0.42);
  }

  .meal-item.checked .meal-qty {
    color: rgba(235, 235, 245, 0.32);
  }

  .meal-divider-line {
    background: rgba(255, 255, 255, 0.18);
  }

  .meal-divider-label {
    color: rgba(235, 235, 245, 0.52);
  }
}
