/**
 * Convert a font size to a dynamic font size.
 * Fonts that participate in Dynamic Type should use
 * dynamic font sizes.
 * @param size - The initial font size including the unit (i.e. px or pt)
 * @param unit (optional) - The unit to convert to. Use this if you want to
 * convert to a unit other than $baselineUnit.
 */
/**
 * Convert a font size to a dynamic font size but impose
 * a maximum font size.
 * @param size - The initial font size including the unit (i.e. px or pt)
 * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
 * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
 * convert to a unit other than $baselineUnit.
 */
/**
 * Convert a font size to a dynamic font size but impose
 * a minimum font size.
 * @param size - The initial font size including the unit (i.e. px or pt)
 * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
 * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
 * convert to a unit other than $baselineUnit.
 */
/**
 * Convert a font size to a dynamic font size but impose
 * maximum and minimum font sizes.
 * @param size - The initial font size including the unit (i.e. px or pt)
 * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
 * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
 * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
 * convert to a unit other than $baselineUnit.
 */
/**
 * A heuristic that applies CSS to tablet
 * viewports.
 *
 * Usage:
 * @include tablet-viewport() {
 *   :host {
 *     background-color: green;
 *   }
 * }
 */
/**
   * A heuristic that applies CSS to mobile
   * viewports (i.e. phones, not tablets).
   *
   * Usage:
   * @include mobile-viewport() {
   *   :host {
   *     background-color: blue;
   *   }
   * }
   */
:host {
  --container-box-shadow: none;
  --container-box-shadow-color: none;
  --container-border-color: var(--cpsl-color-input-border-active);
  --container-border-error-color: var(--cpsl-color-input-border-error);
  --container-background-color: var(--cpsl-color-input-surface-default);
  --container-background-color-disabled: var(--cpsl-color-input-surface-disabled);
  --container-border-width: 1px;
  --container-border-radius: var(--cpsl-border-radius-input);
  --container-padding-top: 0px;
  --container-padding-bottom: 0px;
  --container-padding-end: 12px;
  --container-padding-start: 12px;
  --container-height: 48px;
  --container-gap: 8px;
  --input-background-color: var(--cpsl-color-input-surface-default);
  --input-background-color-disabled: var(--cpsl-color-input-surface-disabled);
  --input-color: var(--cpsl-color-text-primary);
  --input-placeholder-color: var(--cpsl-color-text-secondary);
  --input-font-size: var(--cpsl-font-size-body-m);
  --input-font-weight: 400;
  --optional-label-color: var(--cpsl-color-text-secondary);
  --label-color: var(--cpsl-color-text-primary);
  --label-font-size: var(--cpsl-font-size-body-s);
  --label-margin-bottom: 0px;
  --helper-text-color: var(--cpsl-color-text-secondary);
  --helper-text-error-color: var(--cpsl-color-text-error);
  --helper-text-icon-color: var(--cpsl-color-text-secondary);
  --helper-text-icon-error-color: var(--cpsl-color-text-error);
  --helper-text-icon-size: 16px;
  --helper-text-font-size: var(--cpsl-font-size-body-xs);
  --helper-text-margin-top: 0px;
  --button-padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--cpsl-font-family, inherit);
}

:host(.contrast-text) {
  --input-color: var(--cpsl-color-contrast);
}

:host(:not(.has-value)) {
  --container-border-color: var(--cpsl-color-input-border-placeholder);
  --input-color: var(--cpsl-color-text-secondary);
}

:host(.disabled) {
  --container-background-color: var(--container-background-color-disabled);
  --input-background-color: var(--input-background-color-disabled);
  --input-color: var(--cpsl-color-text-disabled);
  --container-border-color: transparent;
}

:host(.focused) {
  --container-box-shadow: 0px 0px 0px 2px var(--container-box-shadow-color);
  --container-border-color: var(--cpsl-color-input-border-active);
  --container-background-color: var(--cpsl-color-input-surface-default);
}

.input-container {
  -webkit-padding-start: var(--container-padding-start);
  padding-inline-start: var(--container-padding-start);
  -webkit-padding-end: var(--container-padding-end);
  padding-inline-end: var(--container-padding-end);
  padding-top: var(--container-padding-top);
  padding-bottom: var(--container-padding-bottom);
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: var(--container-height);
  gap: var(--container-gap);
  border-style: var(--container-border-style, solid);
  border-width: var(--container-border-width);
  border-color: var(--container-border-color);
  border-radius: var(--container-border-radius);
  background: var(--container-background-color);
  box-shadow: var(--container-box-shadow);
}
.input-container.textarea {
  height: auto;
  min-height: var(--container-height);
}

.error-container {
  border-color: var(--container-border-error-color);
}

.native-input {
  flex: 1;
  min-width: 0;
  border: none;
  height: 100%;
  box-sizing: border-box;
  font-size: var(--input-font-size);
  font-weight: var(--input-font-weight);
  color: var(--input-color);
  background: var(--input-background-color);
  width: var(--input-width, auto);
  text-align: var(--input-text-align, left);
  resize: none;
  font-family: var(--cpsl-font-family, inherit);
}
.native-input:focus, .native-input:focus-visible {
  outline: none;
}
.native-input::placeholder {
  color: var(--input-placeholder-color);
  opacity: 1; /* Firefox */
}
.native-input::-moz-selection {
  /* Code for Firefox */
  color: var(--cpsl-color-text-inverted);
  background: var(--cpsl-color-background-64);
}
.native-input::selection {
  color: var(--cpsl-color-text-inverted);
  background: var(--cpsl-color-background-64);
}

.label {
  display: inline-block;
  color: var(--label-color);
  font-size: var(--label-font-size);
  font-weight: 500;
  margin-bottom: var(--label-margin-bottom);
}

.optional-label {
  display: inline-block;
  color: var(--optional-label-color);
  font-size: var(--label-font-size);
  font-weight: 500;
}

.helper-text-container {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--helper-text-color);
  font-size: var(--helper-text-font-size);
  font-weight: 500;
  margin-top: var(--helper-text-margin-top);
}
.helper-text-container cpsl-icon {
  --height: var(--helper-text-icon-size);
  --width: var(--helper-text-icon-size);
  --icon-color: var(--helper-text-icon-color);
}

.error-text {
  color: var(--helper-text-error-color);
}
.error-text cpsl-icon {
  --icon-color: var(--helper-text-icon-error-color);
}

:host ::slotted([slot=start]) {
  flex: 0 0 auto;
}
:host ::slotted([slot=end]) {
  flex: 0 0 auto;
}
:host ::slotted(cpsl-icon) {
  --icon-color: var(--input-color);
}
:host ::slotted(cpsl-button) {
  width: calc(var(--container-height) - var(--button-padding) * 2);
  height: calc(var(--container-height) - var(--button-padding) * 2);
  --button-border-radius: calc(var(--container-border-radius) - 4px);
  --button-padding-top: 4px;
  --button-padding-start: 4px;
  --button-padding-end: 4px;
  --button-padding-bottom: 4px;
}
:host slot[name=end]::slotted(cpsl-button) {
  margin-right: calc((var(--container-padding-end) - var(--button-padding)) * -1);
}
:host slot[name=start]::slotted(cpsl-button) {
  margin-left: calc((var(--container-padding-end) - var(--button-padding)) * -1);
}