/* =====================================================================
   LetsEat shared component styles.

   Collection modules (Dishes, Ingredients, Recipes, Groups, …) share the
   same card, collection shell and edit-form chrome. These used to be
   copy-pasted into each module's scoped .razor.css under a per-module
   prefix (dish-card / ingredient-card / recipe-card …); they now live here
   once under the neutral `le-` prefix. Loaded globally from index.html, so
   the class names resolve without Blazor CSS-isolation scoping.

   Everything reads design tokens from letseat-tokens.css — never hard-code
   a colour here.
   ===================================================================== */

/* ---------- Collection card (Dishes / Ingredients / Recipes) ---------- */
.le-card {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.le-card__hero {
  position: relative;
  width: 100%;
  height: 150px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Per-item warm gradient fallbacks (token-based) shown only when there is no image */
.le-card__hero--g0 { background-image: linear-gradient(135deg, var(--primary), var(--gold-strong)); }
.le-card__hero--g1 { background-image: linear-gradient(135deg, var(--gold), var(--primary)); }
.le-card__hero--g2 { background-image: linear-gradient(135deg, var(--danger), var(--primary)); }
.le-card__hero--g3 { background-image: linear-gradient(135deg, var(--green), var(--gold)); }
.le-card__hero--g4 { background-image: linear-gradient(135deg, var(--gold-strong), var(--gold)); }

.le-card__glyph {
  font-size: 52px;
  color: rgba(255, 255, 255, .92);
}

.le-card__favorite {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .92);
  color: var(--text-muted);
  cursor: pointer;
}

.le-card__favorite .filled {
  color: var(--danger);
}

.le-card__category {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 9px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, .32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--on-media);
  font-size: 11px;
  font-weight: 700;
}

.le-card__content {
  padding: 13px 14px 12px;
}

.le-card__title {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  cursor: pointer;
}

.le-card__rating {
  margin-top: 8px;
}

.le-card__actions {
  padding: 8px 12px 12px;
  border-top: 1px solid var(--border);
}

/* ---------- Collection shell (page-level count row) ---------- */
.le-collection-shell {
  display: grid;
  gap: 16px;
}

.le-collection-shell__count {
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
}

/* ---------- Entity edit form chrome (create/edit pages) ---------- */
.le-edit-header {
  display: grid;
  gap: 8px;
}

.le-edit-header__back {
  justify-self: start;
  padding-left: 0;
}

.le-edit-header__title {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.le-edit-form,
.le-edit-shell {
  display: grid;
  gap: 20px;
}

.le-edit-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.le-edit-card__header,
.le-edit-card__header-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.le-edit-card__header {
  margin-bottom: 18px;
}

.le-edit-card__header--split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.le-edit-card__icon {
  color: var(--primary);
}

.le-edit-input {
  width: 100%;
}

.le-edit-rating-block {
  display: grid;
  gap: 12px;
}

.le-edit-favorite {
  border: 0;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.le-edit-favorite .material-symbols-rounded {
  color: var(--text-muted);
  transition: color .15s ease;
}

.le-edit-favorite .filled {
  color: var(--danger);
}

.le-edit-recipes-list {
  padding-top: 4px;
}

.le-edit-recipes-link {
  color: var(--primary);
}

.le-edit-footer {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

/* Both actions share the row equally and together fill the available width. */
.le-edit-footer__cancel,
.le-edit-footer__save {
  flex: 1 1 0;
  min-width: 0;
}

/* Two-class selector keeps parity with the original scoped `::deep` rule's
   specificity so it still wins over MudButton's own text-variant colours. */
.le-edit-footer .le-edit-footer__cancel {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-strong);
}

@media (max-width: 720px) {
  .le-edit-card {
    padding: 18px;
  }
}

/* ---------- Recipe editor section header ----------
   Shared by RecipeIngredientsEditor / RecipeCookingStepsEditor /
   RecipeNutritionInfoEditor (previously three identical scoped copies). */
.recipe-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-editor-header__icon {
  font-size: 21px;
  color: var(--primary);
}

.recipe-editor-header__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-strong);
}

/* ---------- Mealplans icon (kebab) menu button ----------
   Shared by CourseView / MealView / DishOptionItem (previously triplicated). */
.mealplans-menu-trigger {
  display: inline-flex;
  align-items: center;
}

.mealplans-menu-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.mealplans-menu-btn:hover {
  background: var(--surface-3);
  color: var(--text-strong);
}

.mealplans-menu-btn .material-symbols-rounded {
  font-size: 20px;
}

/* =====================================================================
   Design-system primitives
   Small, composable building blocks that were previously re-implemented
   per component. Compose a base class with an optional modifier, e.g.
   <span class="le-avatar le-avatar--sm">AB</span>. See letseat-tokens.css
   for the colours.
   ===================================================================== */

/* ---------- Avatar (circular initials badge) ----------
   Default 36px. --sm 28px, --lg 64px. --plain drops the primary fill so a
   per-user hue can be set inline (white text is intentional there). */
.le-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  background: var(--primary);
  color: var(--on-primary);
}

.le-avatar--sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  font-size: 12px;
}

.le-avatar--lg {
  width: 64px;
  height: 64px;
  min-width: 64px;
  font-size: 24px;
}

.le-avatar--plain {
  background: transparent;
  color: var(--on-media);
}

/* ---------- Eyebrow (uppercase micro-label) ---------- */
.le-eyebrow {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.le-eyebrow--accent {
  color: var(--primary);
}

/* ---------- Pill (rounded tag) ----------
   Base geometry only; pair with a le-tone-* class for colour. Padding can be
   overridden by the call site's own class where a tighter/looser pill is needed. */
.le-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- Tone (tint background + matching text) ----------
   Shape-agnostic colour pairs. Single source for the tint→text mapping used by
   pills (MealView, Home) and icon tiles (Home stat / action cards). */
.le-tone-primary,
.le-tone-coral { background: var(--primary-tint); color: var(--primary); }
.le-tone-green { background: var(--green-tint); color: var(--green); }
.le-tone-gold { background: var(--gold-tint); color: var(--gold-strong); }
.le-tone-info { background: var(--info-tint); color: var(--info); }
.le-tone-danger { background: var(--danger-tint); color: var(--danger); }
.le-tone-neutral { background: var(--surface-3); color: var(--text-strong); }
.le-tone-muted { background: var(--surface-3); color: var(--text-muted); }

/* ---------- Dashed "add" tile ----------
   Shared dashed placeholder used by the empty-day and add-course boxes; call
   sites set their own padding and inner layout. (Other dashed affordances —
   assign chips, add buttons, the image drop-zone — diverge too much in
   radius/padding/state to share and are kept bespoke.) */
.le-add-tile {
  border: 1.5px dashed var(--border-strong);
  border-radius: 13px;
  background: transparent;
}

/* ====================================================================
   Dialog primitives (le-dialog*) — shared chrome for pop-up dialogs.
   The header lives in MudBlazor's <TitleContent>, the footer in
   <DialogActions>; the header/footer dividers and the confirm variant's
   hidden title bar are in mudblazor-overrides.css (they reach MudBlazor
   internals). Everything below is app-owned content markup.
   Used by: AddMealView, AddCourseDialog, AddDishOptionDialog,
   MealPlanView and the shared ConfirmDialog.
   ==================================================================== */

/* Body grid inside <DialogContent> */
.le-dialog__body {
  display: grid;
  gap: 18px;
}

/* Header row (icon + title on the left, close button on the right) */
.le-dialog__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.le-dialog__title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.le-dialog__title-wrap h2,
.le-dialog__title {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.le-dialog__title-icon {
  color: var(--primary);
  flex: none;
}

/* Rounded-square close button (top-right of the header) */
.le-dialog__close {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  flex: none;
}

.le-dialog__close:hover {
  background: var(--surface-3);
  color: var(--text-strong);
}

.le-dialog__close .material-symbols-rounded {
  font-size: 22px;
}

/* Info note banner (blue) */
.le-dialog__note {
  padding: 14px 16px;
  border-radius: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--info-tint);
  color: var(--info);
}

.le-dialog__note .material-symbols-rounded {
  flex: none;
}

/* Labelled section */
.le-dialog__section {
  display: grid;
  gap: 10px;
}

.le-dialog__label {
  color: var(--text-strong);
  font-weight: 700;
}

.le-dialog__label-req {
  color: var(--primary);
  margin-left: 2px;
}

/* ---------- Choice tile grid (vertical icon-over-label tiles) ---------- */
.le-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.le-choice {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  min-height: 84px;
  padding: 14px 8px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}

.le-choice .material-symbols-rounded {
  font-size: 26px;
}

.le-choice:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.le-choice:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.le-choice--active {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 700;
}

.le-choice--active .material-symbols-rounded {
  color: var(--primary);
}

/* ---------- Search input (icon + text field) ---------- */
.le-search {
  position: relative;
}

.le-search__input {
  width: 100%;
  height: 48px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0 16px 0 44px;
  font: inherit;
  color: var(--text-strong);
}

.le-search__input::placeholder {
  color: var(--text-muted);
}

.le-search__input:focus {
  outline: none;
  border-color: var(--primary);
}

.le-search__icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 21px;
  pointer-events: none;
}

/* ---------- Single-select list (dish options, …) ---------- */
.le-select-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 360px;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.le-select-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.le-select-row:hover {
  background: var(--surface-2);
}

.le-select-row--active {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.le-select-row__tile {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex: none;
  display: inline-grid;
  place-items: center;
  color: var(--on-media);
  overflow: hidden;
}

.le-select-row__tile .material-symbols-rounded {
  font-size: 24px;
}

.le-select-row__tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.le-select-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.le-select-row__name {
  display: block;
  font-weight: 700;
  color: var(--text-strong);
  font-size: 15px;
}

.le-select-row__desc {
  display: block;
  max-width: 100%;
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.le-select-row__radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: none;
  display: inline-grid;
  place-items: center;
}

.le-select-row--active .le-select-row__radio {
  border-color: var(--primary);
}

.le-select-row--active .le-select-row__radio::after {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
}

.le-select-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Preview card (e.g. calendar-week preview) ---------- */
.le-preview {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 16px 18px;
  display: grid;
  gap: 4px;
}

.le-preview__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.le-preview__label .material-symbols-rounded {
  font-size: 18px;
  color: var(--primary);
}

.le-preview__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
}

.le-preview__range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-weight: 600;
  font-size: 14px;
}

.le-preview__range .material-symbols-rounded {
  font-size: 18px;
}

/* ---------- Confirmation body (icon tile + title + message) ----------
   Rendered inside <DialogContent>; the confirm variant hides MudBlazor's
   default title bar (see mudblazor-overrides.css). */
.le-confirm {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.le-confirm__icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  flex: none;
  display: inline-grid;
  place-items: center;
}

.le-confirm__icon .material-symbols-rounded {
  font-size: 24px;
}

.le-confirm__body {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.le-confirm__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
}

.le-confirm__text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .le-choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
