/* Classes named in docs/dev_conventions/UI_Visual_Rules.md §4: what MudBlazor has no parameter for.
   This file holds only those rules; a change here and in that document goes together. */

/* Medium weight on a text or a link. */
.pd-medium {
  font-weight: 500;
}

/* Description under the title of an option or an item. */
.pd-description {
  font-size: .8125rem;
}

/* Amounts: fixed-width digits, right-aligned inside a table cell. */
.pd-amount {
  font-variant-numeric: tabular-nums;
}

.mud-table-cell.pd-amount {
  text-align: right;
}

/* Outlined + Dense field inside a table: 36px instead of 40px. The selectors match the specificity
   of MudBlazor's own dense rule, so these win by loading later; the phone rule below does the same. */
.pd-field-table .mud-input > input.mud-input-root-margin-dense,
.pd-field-table .mud-input > div.mud-input-slot.mud-input-root-margin-dense {
  padding-top: 8.5px;
  padding-bottom: 8.5px;
}

/* Emphasis stays at medium weight; the browser default is bold. */
strong,
b {
  font-weight: 500;
}

/* Page margins (AppShell's main content): 24px on top and 32px at the sides from sm up. On a phone nothing changes:
   16px, which is what the shell already gave. The two classes keep the specificity above MudBlazor's own padding. */
.mud-main-content.pd-page {
  padding: 16px;
}

@media (min-width: 600px) {
  .mud-main-content.pd-page {
    padding: 24px 32px;
  }
}

/* Selected row or option: primary at UX's --shapp-tint-soft (8% on light, 14% on dark). light-dark() follows the
   color-scheme MudBlazor sets on the page, so it also holds inside popovers and dialogs. */
:root {
  --shapp-selected-bg: light-dark(
    color-mix(in srgb, var(--mud-palette-primary) 8%, transparent),
    color-mix(in srgb, var(--mud-palette-primary) 14%, transparent));
}

/* A list item MudBlazor marks as selected, and any row or option a screen marks with pd-selected
   (MudTable RowClassFunc returns "pd-selected"). */
.mud-selected-item,
.pd-selected {
  background-color: var(--shapp-selected-bg);
}

/* A selected row keeps its background under the mouse: MudTable's Hover gray would hide that it is selected. Same
   selector as MudBlazor's hover, one class heavier. */
@media (hover: hover) and (pointer: fine) {
  .mud-table-hover .mud-table-container .mud-table-root .mud-table-body .mud-table-row.pd-selected:hover {
    background-color: var(--shapp-selected-bg);
  }
}

/* Group header of a table (MudTable GroupHeaderClass) or of an expansion panel (HeaderClass): UX's --shapp-group-bg,
   #f9f9f9 on light and white at 3% on dark. */
:root {
  --shapp-group-bg: light-dark(#f9f9f9, rgba(255, 255, 255, 0.03));
}

.pd-group {
  background-color: var(--shapp-group-bg);
}

/* Breadcrumbs: secondary text at the caption size. The last one carries no link (disabled), so it only drops
   MudBlazor's disabled color. */
.mud-breadcrumbs .mud-breadcrumb-item > a,
.mud-breadcrumbs .mud-breadcrumb-item.mud-disabled > a {
  color: var(--mud-palette-text-secondary);
  font-size: .75rem;
  line-height: 1.66;
  letter-spacing: .03333em;
}

/* The ones before the last are links, and look like it. */
.mud-breadcrumbs .mud-breadcrumb-item:not(.mud-disabled) > a {
  text-decoration: underline;
}

/* Status icon at the start of a field's help text ("No other product has this name"), inside HelperTextContent. */
.mud-icon-root.pd-help-icon {
  font-size: .875rem;
  margin-inline-end: 4px;
  vertical-align: text-bottom;
}

/* A value chip is never narrower than a touch target. */
.mud-chip.mud-chip-size-medium {
  min-width: 44px;
}

/* Phone (MudBlazor xs): buttons, action links and dense fields reach the 44px touch target. Icon buttons, tabs
   and the date picker's toolbar buttons keep their size. Breadcrumbs are not action links: they are not pd-medium. */
@media (max-width: 599.98px) {
  /* A dialog, panel or step title is 18px on a phone; weight and spacing stay the h6's. */
  .mud-typography-h6 {
    font-size: 1.125rem;
  }

  /* A back link (pd-back, "‹ Products") is a small caption, but still something to tap. */
  .mud-link.pd-medium,
  .mud-link.pd-back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .mud-button-root.mud-button:not(.mud-button-year):not(.mud-button-date) {
    min-height: 44px;
  }

  .mud-input > input.mud-input-root.mud-input-root-margin-dense,
  .mud-input > div.mud-input-slot.mud-input-root.mud-input-root-margin-dense {
    padding-top: 12.5px;
    padding-bottom: 12.5px;
  }
}
