/* Shared phone control: the international prefix is visible but not editable. */
.shx-phone-field {
  --shx-phone-prefix-width: 2.5rem;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.shx-phone-field__prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--shx-phone-prefix-width);
  width: var(--shx-phone-prefix-width);
  box-sizing: border-box;
  padding: .375rem .5rem;
  border: var(--bs-border-width, 1px) solid var(--input-border-color, var(--bs-border-color, #ced4da));
  border-inline-end: 0;
  border-start-start-radius: var(--border-radius, var(--bs-border-radius, .375rem));
  border-end-start-radius: var(--border-radius, var(--bs-border-radius, .375rem));
  background: var(--input-bg, var(--bs-tertiary-bg, #f8f9fa));
  color: var(--text-muted-color, var(--bs-secondary-color, #6c757d));
  font-weight: 600;
}

.shx-phone-field > input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  border-start-start-radius: 0 !important;
  border-end-start-radius: 0 !important;
}

/* Keep the native floating-input height, padding and focus/label selectors.
 * Only the phone label's horizontal origin changes to clear the prefix. */
.shx-phone-field.form-floating > label {
  inset-inline-start: var(--shx-phone-prefix-width);
  inset-inline-end: 0;
  max-width: calc(100% - var(--shx-phone-prefix-width));
  transform: scale(.85) translateY(-.5rem) translateX(.15rem);
  opacity: .65;
}

.shx-phone-field.form-floating > input {
  padding-top: 1.625rem;
  padding-bottom: .625rem;
}

.shx-phone-field.form-floating > input::placeholder {
  opacity: 1;
  color: var(--text-muted-color, var(--bs-secondary-color, #6c757d));
}

.shx-phone-field > input:focus {
  position: relative;
  z-index: 1;
}

.shx-phone-field:focus-within .shx-phone-field__prefix {
  border-color: var(--input-focus-border, var(--bs-primary, #0d6efd));
}

.field-has-errors .shx-phone-field__prefix,
.shx-ui-form-field--invalid .shx-phone-field__prefix,
.shx-phone-field:has(> input.is-invalid) .shx-phone-field__prefix {
  border-color: var(--alert-danger-border, var(--bs-danger, #dc3545));
}

.shx-phone-field:has(> input:disabled) .shx-phone-field__prefix,
.shx-phone-field:has(> input[readonly]) .shx-phone-field__prefix {
  background: var(--input-disabled-bg, var(--bs-secondary-bg, #e9ecef));
}

.shx-phone-field:has(> input:disabled) .shx-phone-field__prefix {
  opacity: .65;
}
