/* Material 3 "filled" text field (as in the Laravel app): tonal fill, rounded top corners, an indicator line
   that thickens and takes the primary colour on focus, and a label that sits in the field and floats to the
   top once it has focus or content. */
.ez_field__box {
  position: relative;
  display: flex;
}

.ez_input {
  inline-size: 100%;
  min-block-size: var(--ez-field-height, 3.5rem);
  padding: 1.5rem var(--ez-space-4) var(--ez-space-1);
  background: var(--ez-color-surface-container);
  color: var(--ez-color-text-primary);
  border: 0;
  border-block-end: 1px solid var(--ez-color-border);
  border-radius: var(--ez-radius-field) var(--ez-radius-field) 0 0;
  caret-color: var(--ez-color-action-primary);
  transition: background var(--ez-duration-fast), border-color var(--ez-duration-fast), box-shadow var(--ez-duration-fast);
}

.ez_input:hover {
  background: var(--ez-color-surface-container-high);
  border-block-end-color: var(--ez-color-text-primary);
}

.ez_input:focus,
.ez_input:focus-visible {
  outline: none;
  background: var(--ez-color-surface-container-high);
  border-block-end-color: var(--ez-color-action-primary);
  box-shadow: inset 0 -2px 0 var(--ez-color-action-primary);
}

.ez_input[aria-invalid="true"] {
  border-block-end-color: var(--ez-color-danger);
  box-shadow: inset 0 -2px 0 var(--ez-color-danger);
}

.ez_input:disabled {
  background: var(--ez-color-surface-variant);
  color: var(--ez-color-text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.ez_input::placeholder {
  color: transparent;
}

.ez_input--number {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

/* Floating label */
.ez_field__box .ez_field__label {
  position: absolute;
  inset-inline: var(--ez-space-4);
  inset-block-start: 1rem;
  overflow: hidden;
  color: var(--ez-color-text-muted);
  font-weight: var(--ez-font-weight-regular);
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  transition: inset-block-start var(--ez-duration-fast), font-size var(--ez-duration-fast), color var(--ez-duration-fast);
}

.ez_input:focus ~ .ez_field__label,
.ez_input:not(:placeholder-shown) ~ .ez_field__label,
.ez_input:-webkit-autofill ~ .ez_field__label,
.ez_input--float ~ .ez_field__label {
  inset-block-start: var(--ez-space-1);
  font-size: var(--ez-font-size-xs);
}

.ez_input:focus ~ .ez_field__label {
  color: var(--ez-color-action-primary);
}

.ez_input[aria-invalid="true"] ~ .ez_field__label {
  color: var(--ez-color-danger);
}

.ez_input:-webkit-autofill {
  -webkit-text-fill-color: var(--ez-color-text-primary);
  box-shadow: inset 0 0 0 100px var(--ez-color-surface-container);
}

/* Select: the same field with a drawn chevron */
.ez_input--select {
  appearance: none;
  padding-inline-end: var(--ez-space-7);
  text-overflow: ellipsis;
}

.ez_field__box--select::after {
  content: "";
  position: absolute;
  inset-inline-end: var(--ez-space-4);
  inset-block-start: 50%;
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-inline-end: 2px solid var(--ez-color-text-muted);
  border-block-end: 2px solid var(--ez-color-text-muted);
  pointer-events: none;
  transform: translateY(-75%) rotate(45deg);
}

/* Dense variant for table cells and the top bar, where the label lives in a column header or is implied */
.ez_input--compact {
  min-block-size: var(--ez-control-height-md);
  padding: var(--ez-space-1) var(--ez-space-3);
}

.ez_input--compact.ez_input--select {
  appearance: auto;
  padding-inline-end: var(--ez-space-2);
}

.ez_checkbox,
.ez_radio {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  accent-color: var(--ez-color-action-primary);
}

/* Multi-line text: the same filled field, taller, resizable downwards only */
.ez_input--area {
  min-block-size: 6rem;
  padding-block-start: 1.75rem;
  resize: vertical;
  line-height: 1.4;
}

/* A bare date field in a page's title row (the day picker on a list page). */
.ez_pillinput {
  min-block-size: var(--ez-control-height-md);
  padding-inline: var(--ez-space-4);
  background: var(--ez-color-surface-container);
  color: var(--ez-color-text-primary);
  border: 1px solid var(--ez-color-border);
  border-radius: var(--ez-radius-pill);
  font: inherit;
}
