/* Module repas — écrans utilisateur (U1→U6).
   Cartes plat cliquables (pattern .abs-type : bord 2px accent + fond #EFF0FF),
   semaine de menus, steppers, récapitulatifs, historique. */

/* ===== U1 — Semaine de menus ===== */
.meal-days {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Jour ouvert à la commande : ligne riche avec vignettes */
.meal-dayrow {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 16px 20px;
  /* La ligne « à emporter » se pose sous la journée : sans le retour à la
     ligne, elle s'alignerait à droite du bouton comme une colonne de plus. */
  flex-wrap: wrap;
}

/* Commande à emporter d'un jour. Une bande à part sous le menu plutôt qu'une
   marque sur les vignettes : le choix du midi porte déjà une coche sur ces
   mêmes vignettes, et deux informations différentes au même endroit ne se
   distinguent plus. */
.meal-takeaway {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--gray-200);
  font-size: var(--text-sm);
}
.meal-takeaway__tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: var(--status-warning-bg);
  color: var(--status-warning-fg);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}
.meal-takeaway__tag .lucide { width: 12px; height: 12px; }
/* Sur la page de commande, la bande vit seule dans sa carte : elle n'a pas de
   menu au-dessus dont il faudrait la séparer. */
.meal-takeaway-card { padding: 14px 20px; margin-bottom: 18px; }
.meal-takeaway-card .meal-takeaway { margin-top: 0; padding-top: 0; border-top: 0; }
.meal-takeaway-card .meal-takeaway + .meal-takeaway {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--gray-200);
}
.meal-takeaway__items {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
}
.meal-takeaway__price {
  flex: none;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
/* Journée close : la ligne est une pastille fine, une bande barrée d'un filet
   y ferait tache. Une mention en ligne suffit — le détail vit dans « Mes
   commandes ». */
.meal-dayrow__extra {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 2px 12px 2px 9px;
  border-radius: var(--radius-full);
  background: #fff;
  border: 1px solid var(--gray-200);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.meal-dayrow__extra .lucide { width: 12px; height: 12px; color: var(--text-muted); }
.meal-dayrow__extra-price { font-weight: var(--weight-semibold); color: var(--text-primary); }
.meal-dayrow--today { border-color: #C9CCEC; }
.meal-dayrow__date {
  flex: none;
  width: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.meal-dayrow__wd {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.meal-dayrow__num {
  font-size: 24px;
  font-weight: var(--weight-semibold);
  line-height: 1.15;
}
.meal-dayrow--today .meal-dayrow__num {
  color: var(--accent);
  background: #EFF0FF;
  border-radius: var(--radius-full);
  width: 38px;
  text-align: center;
}
.meal-dayrow__menu {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-width: 0;
}
.meal-dayrow__cat {
  min-width: 0;
  padding: 2px 20px;
  border-left: 1px solid var(--gray-150);
}
.meal-dayrow__cat:first-child {
  border-left: 0;
  padding-left: 0;
}
.meal-dayrow__options {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  margin-top: 8px;
}
.meal-dayrow__option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}
.meal-dayrow__or {
  flex: none;
  width: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}
.meal-dayrow__none {
  margin-top: 12px;
  padding-left: 23px;
  color: var(--gray-300);
  font-size: var(--text-sm);
}
.meal-dish-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 14px 4px 5px;
  background: var(--gray-50);
  border: 1px solid var(--gray-150);
  border-radius: var(--radius-full);
  min-width: 0;
}
.meal-dish-chip__thumb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.meal-dish-chip__thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
}
.meal-dish-chip__thumb--empty .lucide {
  width: 14px;
  height: 14px;
  color: var(--gray-300);
}
.meal-dish-chip__title {
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
/* Liseré : plat commandé par l'utilisateur (jour encore visible en riche) */
.meal-dish-chip.is-ordered {
  border: 2px solid var(--accent);
  background: #EFF0FF;
  margin: -1px;
}
.meal-dish-chip.is-ordered .meal-dish-chip__title {
  font-weight: var(--weight-semibold);
}
.meal-dish-chip__check {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}
.meal-dayrow__action {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.meal-dayrow__deadline {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Jour passé / sans menu : ligne discrète */
.meal-dayrow--slim {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  background: var(--gray-50);
}
.meal-dayrow--slim.meal-dayrow--today { border: 1px solid #C9CCEC; }
.meal-dayrow__slimdate {
  flex: none;
  width: 150px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  text-transform: capitalize;
}
.meal-dayrow__slimtext {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.meal-dayrow__slimtext .lucide {
  width: 14px;
  height: 14px;
  flex: none;
}
.meal-dayrow__slimlink {
  flex: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-decoration: none;
}
.meal-dayrow__slimlink:hover { text-decoration: underline; }

.meal-day__group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.meal-day__dish-icon {
  width: 13px;
  height: 13px;
  flex: none;
}
.meal-day__dish-icon--entry { color: #4CA65A; }
.meal-day__dish-icon--main { color: var(--accent); }
.meal-day__dish-icon--dessert { color: #B26AC2; }
/* ===== U1 — Mes commandes ===== */
.meal-orders__empty {
  color: var(--gray-500);
  font-size: var(--text-sm);
}
.meal-orders__link { color: inherit; }
.meal-orders__link:hover { color: var(--accent); }
.meal-orders__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.meal-iconbtn {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-150);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--gray-500);
  transition: border-color 0.16s ease, color 0.16s ease;
  padding: 0;
}
.meal-iconbtn:hover {
  border-color: var(--status-danger-fg);
  color: var(--status-danger-fg);
}

/* ===== U2 / U3 — Sections et cartes plat ===== */
.meal-section { margin-bottom: 26px; }
.meal-section__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.meal-section__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin: 0;
}
.meal-section__count {
  font-size: var(--text-sm);
  color: var(--gray-500);
}
.meal-section__empty {
  font-size: var(--text-sm);
  color: var(--gray-500);
  background: var(--surface-sunken);
  border: 1px solid #ECEEF2;
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  margin: 0;
}
.meal-dishes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.meal-dish {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--gray-150);
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

/* Badge « le plus commandé », posé sur la photo. Fond plein plutôt que teinte
   claire : il se superpose à des photos quelconques, et seul un aplat garantit
   que le texte reste lisible. L'ambre le distingue de l'indigo de sélection —
   deux informations différentes ne doivent pas porter la même couleur. */
.meal-dish__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: var(--status-warning-fg);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}
.meal-dish__badge .lucide {
  width: 13px;
  height: 13px;
}
.meal-dish:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-card);
}
.meal-dish.is-selected {
  border: 2px solid var(--accent);
  background: #EFF0FF;
  margin: -1px;
}
.meal-dish:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.meal-dish--static { cursor: default; }
.meal-dish--static:hover {
  border-color: var(--gray-150);
  box-shadow: none;
}
.meal-dish--static.is-selected:hover { border-color: var(--accent); }
.meal-dish__photo {
  width: 100%;
  height: 132px;
  object-fit: cover;
  display: block;
  flex: none;
}
.meal-dish__photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--gray-100), var(--gray-150));
}
.meal-dish__photo--empty .lucide {
  width: 28px;
  height: 28px;
  color: var(--gray-300);
}
.meal-dish__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 13px 15px 14px;
}
.meal-dish__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}
.meal-dish__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meal-dish__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
}
.meal-dish__allergens {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.meal-allergen {
  width: 24px;
  height: 24px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  color: var(--gray-500);
}
.meal-allergen img {
  width: 15px;
  height: 15px;
  object-fit: contain;
}
.meal-allergen .lucide {
  width: 13px;
  height: 13px;
}
.meal-dish__price {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
}
.meal-dish.is-selected .meal-dish__price { color: var(--accent); }

/* ===== U3 — Stepper de quantité ===== */
.meal-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  padding: 6px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
}
.meal-dish.is-selected .meal-stepper { background: #fff; }
.meal-stepper__btn {
  width: 30px;
  height: 30px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-150);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--text-secondary);
  padding: 0;
  transition: border-color 0.16s ease, color 0.16s ease;
}
.meal-stepper__btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.meal-stepper__btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.meal-stepper__btn .lucide {
  width: 14px;
  height: 14px;
}
.meal-stepper__count {
  min-width: 24px;
  text-align: center;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

/* ===== U2 / U3 — Barre de commande ===== */
.meal-orderbar {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 20px;
  margin-top: 8px;
}
.meal-orderbar__total {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.meal-orderbar__label {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.meal-orderbar__value {
  font-size: 26px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}
.meal-orderbar__hint {
  font-size: var(--text-sm);
  color: var(--gray-500);
}
.meal-orderbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Récapitulatif (modales, rappel de commande) ===== */
.meal-summary {
  list-style: none;
  margin: 0;
  padding: 0;
}
.meal-summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #F4F5F9;
  font-size: var(--text-base);
}
.meal-summary__row:last-child { border-bottom: 0; }
.meal-summary__row--total {
  border-bottom: 0;
  padding-top: 12px;
}
.meal-summary__row--total .meal-summary__label {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.meal-summary__label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.meal-summary__value {
  font-weight: var(--weight-medium);
  text-align: right;
}
.meal-summary__value.is-empty { color: var(--gray-400); }
.meal-summary__price {
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.meal-summary__row--total .meal-summary__price { font-size: var(--text-xl); }

/* ===== U4 — Étoiles ===== */
.meal-stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.meal-stars__star {
  display: inline-flex;
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 1;
}
.meal-stars__star svg {
  width: 16px;
  height: 16px;
}
.meal-stars--input { gap: 4px; }
.meal-stars--input .meal-stars__star {
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: transform 0.16s ease;
}
.meal-stars--input .meal-stars__star:hover { transform: scale(1.1); }
.meal-stars--input .meal-stars__star:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.meal-stars--input .meal-stars__star svg {
  width: 28px;
  height: 28px;
}
.meal-stars__star.is-on,
.meal-stars__star.active { color: #E8A33D; }
.meal-stars__star.is-on svg,
.meal-stars__star.active svg { fill: #E8A33D; stroke: #E8A33D; }
.meal-stars__star.is-off,
.meal-stars__star.inactive { color: var(--gray-200); }
.meal-stars__star.is-off svg,
.meal-stars__star.inactive svg { fill: var(--gray-150); stroke: var(--gray-300); }

/* ===== U5 — Historique ===== */
.meal-total { max-width: 440px; }
.meal-table__total td {
  font-weight: var(--weight-semibold);
  border-top: 1px solid #ECEEF2;
}

/* ===== Responsive ===== */
@media (max-width: 767.98px) {
  .meal-dayrow {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .meal-dayrow__date {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    width: auto;
  }
  .meal-dayrow__action { align-items: stretch; }
  .meal-dayrow__menu { grid-template-columns: 1fr; gap: 12px; }
  .meal-dayrow__cat,
  .meal-dayrow__cat:first-child {
    border-left: 0;
    padding: 0;
  }
  /* Jours passés : une seule ligne compacte — on annule le passage en
     colonne du .meal-dayrow riche, et le détail des plats (inutile sur
     petit écran) est masqué pour ne pas faire déborder la pilule */
  .meal-dayrow--slim {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 16px;
  }
  .meal-dayrow__slimdate { width: auto; flex: none; }
  .meal-dayrow__slimtext--dishes { display: none; }
  .meal-dayrow__slimlink { margin-left: auto; }
  .meal-dish-chip__title { max-width: 200px; }
  .meal-dishes { grid-template-columns: 1fr; }
  .meal-orderbar { position: static; }
  .meal-orderbar__actions { width: 100%; }
  .meal-orderbar__actions .btn { flex: 1; }
}

/* ── Écran de notation ─────────────────────────────────────────────────
   Une colonne unique et centrée : il n'y a qu'une chose à y faire. Les plats
   qu'on a mangés viennent en tête, en photos — un titre seul ne rappelle pas
   ce qu'on avait dans l'assiette deux heures plus tôt. */
/* 900 px : le titre du jour et le bouton de retour tiennent sur une ligne, et
   trois plats gardent une vignette lisible. */
.meal-review { max-width: 900px; margin: 0 auto; }
.meal-review__plates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.meal-plate {
  margin: 0;
  background: #fff;
  border: 1px solid var(--gray-150);
  border-radius: 18px;
  overflow: hidden;
}
.meal-plate .meal-dish__photo { height: 116px; border-radius: 0; }
.meal-plate__body { display: block; padding: 12px 14px 14px; }
.meal-plate__course {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.meal-plate__course--entry { color: #1E8E45; }
.meal-plate__course--main { color: #C0791B; }
.meal-plate__course--dessert { color: #C13B63; }
.meal-plate__title {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.meal-review__card { text-align: center; }
.meal-review__label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
}
.meal-review__rate { margin-bottom: var(--space-4); }
/* Les étoiles sont l'objet de la page : elles doivent se viser du pouce. */
.meal-stars--xl { justify-content: center; gap: 8px; }
.meal-stars--xl .meal-stars__star svg { width: 40px; height: 40px; }
.meal-review__comment { margin-bottom: var(--space-4); text-align: left; }
.meal-review__comment .form-control.is-required { border-color: var(--status-warning-fg); }
.meal-review__required {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--status-warning-fg);
}
.meal-review__required svg { width: 15px; height: 15px; flex: none; }
