/* Shared meal-log primitives. Global (not scoped) so MealCell and AddFoodIntake
   reuse one source instead of duplicating the rules in two .razor.css files. */

:root {
    --meal-log-pad-y: 4px;
    --meal-log-pad-x: 8px;   /* horizontal cell padding; reused for dish header/recap alignment */
    --meal-log-font-size: 0.85rem;
    --meal-log-amount-width: 3.6ch;   /* numeric column; ch resolves against --meal-log-font-size at the usage site */
}

.meal-log-input,
.meal-log-value {
    padding: var(--meal-log-pad-y) var(--meal-log-pad-x);
}

/* The slot selector keeps MudBlazor's own specificity (0,3,0);
   meal-log.css loads after MudBlazor.min.css so ties resolve here. */
.meal-log-value,
.meal-log-input .mud-input-slot.mud-input-root {
    font-size: var(--meal-log-font-size);
    line-height: 22px;
    letter-spacing: normal;
    text-rendering: optimizeLegibility;
    font-variant-numeric: tabular-nums;
}

.meal-log-value {
    display: inline-block;   /* so the vertical padding counts (inline ignores it) */
}

.meal-log-input .mud-input-slot.mud-input-root {
    padding: 0;   /* box padding lives on .meal-log-input; the slot itself is flush */
}

.meal-log-name-autocomplete-list .mud-typography {
    font-size: var(--meal-log-font-size);
}

.meal-log-name-autocomplete-list .mud-list-item {
    padding-top: 4px;
    padding-bottom: 4px;
}

.meal-log-name-edit {
    flex: 1 1 auto;
    min-width: 0;
}

/* read-only entry name (display counterpart of meal-log-name-edit): fills the row, wraps long names */
.meal-log-name {
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.meal-log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meal-log-amount-group {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}

/* Take MudPopover marker div out of flex flows */
.meal-log-amount-group .mud-popover-cascading-value {
    position: absolute;
}

.meal-log-unit-picker .mud-toggle-item {
    text-transform: none;   /* Mud's button typography uppercases labels */
    min-width: 30px;
}

.meal-log-unit {
    font-size: var(--meal-log-font-size);
    min-width: 1em;
    color: var(--mud-palette-text-secondary);
}

/* numeric value cell — width + right align; no cell padding (overrides the shared 4px 8px) */
.meal-log-amount {
    flex: 0 0 auto;
    width: var(--meal-log-amount-width);
    padding: 0;
    text-align: right;
    color: var(--mud-palette-text-primary);
}

.meal-log-amount input {
    text-align: right;
}

/* read the number as text: no resting underline, faint on hover, accent on focus */
.meal-log-amount .mud-input-underline::before {
    border-bottom-color: transparent;
}

.meal-log-amount .mud-input-underline:hover::before {
    border-bottom-color: var(--mud-palette-lines-inputs);
}

.meal-log-amount .mud-input-underline::after {
    border-bottom-color: var(--mud-palette-primary);
}
