/**
 * 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;
 *   }
 * }
 */
/**
 * Convert a pixels given value into rem
 * 
 * @param pixels - Value in pixels to be converted (i.e. px)
 * @param context (optional) - Baseline value
 */
/**
 * 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.
 */
:host {
  /**
   * @prop --size: Size of the checkbox icon
   *
   * @prop --checkbox-background-checked: Background of the checkbox icon when checked
   *
   * @prop --border-color: Border color of the checkbox icon
   * @prop --border-radius: Border radius of the checkbox icon
   * @prop --border-width: Border width of the checkbox icon
   * @prop --border-style: Border style of the checkbox icon
   * @prop --border-color-checked: Border color of the checkbox icon when checked
   *
   * @prop --transition: Transition of the checkbox icon
   *
   * @prop --checkmark-color: Color of the checkbox checkmark when checked
   * @prop --checkmark-width: Stroke width of the checkbox checkmark
   */
  display: inline-block;
  position: relative;
  cursor: pointer;
  user-select: none;
}

:host(.in-item) {
  flex: 1 1 0;
  width: 100%;
  height: 100%;
}

/**
 * Checkbox can be slotted
 * in components such as item and
 * toolbar which is why we do not
 * limit the below behavior to just ion-item.
 */
:host([slot=start]),
:host([slot=end]) {
  flex: initial;
  width: auto;
}

.checkbox-wrapper {
  display: flex;
  flex-grow: 1;
  align-items: center;
  justify-content: space-between;
  height: inherit;
  cursor: inherit;
}

.label-text-wrapper {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

/**
 * If no label text is placed into the slot
 * then the element should be hidden otherwise
 * there will be additional margins added.
 */
.label-text-wrapper-hidden {
  display: none;
}

/**
 * The native input must be hidden with display instead of visibility or
 * aria-hidden to avoid accessibility issues with nested interactive elements.
 */
input {
  display: none;
}

.native-wrapper {
  display: flex;
  align-items: center;
}

.checkbox-icon {
  position: relative;
}

.checkbox-icon path {
  opacity: 0;
}

.checkbox-bottom {
  display: flex;
  justify-content: space-between;
  white-space: normal;
}

/**
 * Error text should only be shown when .ion-invalid is
 * present on the checkbox. Otherwise the helper text should
 * be shown.
 */
.checkbox-bottom .error-text {
  display: none;
}

.checkbox-bottom .helper-text {
  display: block;
}

:host(.ion-touched.ion-invalid) .checkbox-bottom .error-text {
  display: block;
}

:host(.ion-touched.ion-invalid) .checkbox-bottom .helper-text {
  display: none;
}

/**
 * Label is on the left of the checkbox in LTR and
 * on the right in RTL.
 */
:host(.checkbox-label-placement-start) .checkbox-wrapper {
  flex-direction: row;
}

/**
 * Label is on the right of the checkbox in LTR and
 * on the left in RTL.
 */
:host(.checkbox-label-placement-end) .checkbox-wrapper {
  flex-direction: row-reverse;
  justify-content: start;
}

/**
 * Label is on the left of the checkbox in LTR and
 * on the right in RTL. Label also has a fixed width.
 */
:host(.checkbox-label-placement-fixed) .label-text-wrapper {
  flex: 0 0 100px;
  width: 100px;
  min-width: 100px;
  max-width: 200px;
}

/**
 * Label is on top of the checkbox.
 */
:host(.checkbox-label-placement-stacked) .checkbox-wrapper {
  flex-direction: column;
  text-align: center;
}

:host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper {
  transform-origin: left top;
}
:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper, :host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-start .label-text-wrapper {
  transform-origin: right top;
}

@supports selector(:dir(rtl)) {
  :host(.checkbox-label-placement-stacked.checkbox-alignment-start:dir(rtl)) .label-text-wrapper {
    transform-origin: right top;
  }
}

:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper {
  transform-origin: center top;
}
:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper, :host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-center .label-text-wrapper {
  transform-origin: calc(100% - center) top;
}

@supports selector(:dir(rtl)) {
  :host(.checkbox-label-placement-stacked.checkbox-alignment-center:dir(rtl)) .label-text-wrapper {
    transform-origin: calc(100% - center) top;
  }
}

:host(.checkbox-justify-space-between) .checkbox-wrapper {
  justify-content: space-between;
}

:host(.checkbox-justify-start) .checkbox-wrapper {
  justify-content: start;
}

:host(.checkbox-justify-end) .checkbox-wrapper {
  justify-content: end;
}

:host(.checkbox-alignment-start) .checkbox-wrapper {
  align-items: start;
}

:host(.checkbox-alignment-center) .checkbox-wrapper {
  align-items: center;
}

:host(.checkbox-justify-space-between),
:host(.checkbox-justify-start),
:host(.checkbox-justify-end),
:host(.checkbox-alignment-start),
:host(.checkbox-alignment-center) {
  display: block;
}

:host(.checkbox-checked) .checkbox-icon,
:host(.checkbox-indeterminate) .checkbox-icon {
  border-color: var(--border-color-checked);
  background: var(--checkbox-background-checked);
}

:host(.checkbox-checked) .checkbox-icon path,
:host(.checkbox-indeterminate) .checkbox-icon path {
  opacity: 1;
}

:host(.checkbox-disabled) {
  pointer-events: none;
}

:host {
  /**
   * @prop --checkmark-height: Stroke height of the checkbox checkmark
   *
   * @prop --focus-ring-color: Color of the focus ring
   * @prop --focus-ring-width: Width of the focus ring
   * @prop --focus-ring-offset: Offset of the focus ring
   */
  --border-width: var(--token-border-size-025, var(--token-scale-025, 1px));
  --border-style: var(--token-border-style-solid, solid);
  --border-color: var(--token-primitives-neutral-800, #626262);
  --checkmark-width: var(--token-scale-400, 16px);
  --checkmark-height: var(--checkmark-width);
  --focus-ring-color: var(--token-border-focus-default, var(--token-primitives-blue-400, #b5c0f7));
  --focus-ring-width: var(--token-border-size-050, var(--token-scale-050, 2px));
  --focus-ring-offset: var(--token-space-050, var(--token-scale-050, 2px));
  --size: var(--token-scale-600, 24px);
  --checkbox-background: var(--token-bg-input-default, var(--token-primitives-base-white, #ffffff));
  --checkbox-background-checked: var(--token-bg-primary-base-default, var(--token-semantics-primary-base, var(--token-semantics-primary-700, var(--token-primitives-blue-700, #105cef))));
  --border-color-checked: var(--token-semantics-primary-base, var(--token-semantics-primary-700, var(--token-primitives-blue-700, #105cef)));
  --checkmark-color: var(--token-bg-surface-default, var(--token-primitives-base-white, #ffffff));
  --transition: none;
  z-index: 2;
}
:host::after {
  right: 0;
  left: 0;
  top: 50%;
  position: absolute;
  height: 100%;
  min-height: var(--token-scale-1200, 48px);
  transform: translateY(-50%);
  content: "";
  cursor: pointer;
  z-index: 1;
}
:host .native-wrapper {
  position: relative;
}

.label-text-wrapper {
  color: var(--token-text-default, var(--token-primitives-neutral-1200, #242424));
}

:host(.in-item) .label-text-wrapper {
  margin-top: var(--token-space-250, var(--token-scale-250, 10px));
  margin-bottom: var(--token-space-250, var(--token-scale-250, 10px));
}

:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper {
  margin-top: var(--token-space-250, var(--token-scale-250, 10px));
  margin-bottom: var(--token-space-400, var(--token-scale-400, 16px));
}

:host(.in-item.checkbox-label-placement-stacked) .native-wrapper {
  margin-bottom: var(--token-space-250, var(--token-scale-250, 10px));
}

input {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  -webkit-appearance: none;
  -moz-appearance: none;
}

.native-wrapper {
  border-radius: var(--border-radius);
  flex-shrink: 0;
  justify-content: center;
  width: var(--size);
  height: var(--size);
  transition: var(--transition);
  border-width: var(--border-width);
  border-style: var(--border-style);
  border-color: var(--border-color);
  background: var(--checkbox-background);
  box-sizing: border-box;
}

.checkbox-icon {
  width: var(--checkmark-width);
  height: var(--checkmark-height);
}

.checkbox-icon path {
  fill: var(--checkmark-color);
}

.checkbox-bottom {
  font-size: var(--token-font-size-350, 14px);
  font-weight: var(--token-font-weight-regular, 400);
  letter-spacing: var(--token-font-letter-spacing-0, 0%);
  line-height: var(--token-font-line-height-600, var(--token-scale-600, 24px));
  text-decoration: none;
  text-transform: none;
}

.checkbox-bottom .error-text {
  color: var(--token-semantics-danger-800, var(--token-primitives-red-800, #bf2222));
}

.checkbox-bottom .helper-text {
  color: var(--token-text-subtlest, var(--token-primitives-neutral-800, #626262));
}

:host(.checkbox-label-placement-start) .label-text-wrapper {
  /**
   * The margin between the label and
   * the checkbox should be on the end
   * when the label sits at the start.
   */
  -webkit-margin-start: 0;
  margin-inline-start: 0;
  -webkit-margin-end: var(--token-space-400, var(--token-scale-400, 16px));
  margin-inline-end: var(--token-space-400, var(--token-scale-400, 16px));
}

/**
 * The margin between the label and
 * the checkbox should be on the start
 * when the label sits at the end.
 */
:host(.checkbox-label-placement-end) .label-text-wrapper {
  -webkit-margin-start: var(--token-space-400, var(--token-scale-400, 16px));
  margin-inline-start: var(--token-space-400, var(--token-scale-400, 16px));
  -webkit-margin-end: 0;
  margin-inline-end: 0;
}

:host(.checkbox-label-placement-fixed) .label-text-wrapper {
  /**
   * The margin between the label and
   * the checkbox should be on the end
   * when the label sits at the start.
   */
  -webkit-margin-start: 0;
  margin-inline-start: 0;
  -webkit-margin-end: var(--token-space-400, var(--token-scale-400, 16px));
  margin-inline-end: var(--token-space-400, var(--token-scale-400, 16px));
}

:host(.checkbox-label-placement-stacked) .label-text-wrapper {
  transform: scale(0.75);
  /**
   * The margin between the label and
   * the checkbox should be on the bottom
   * when the label sits at the top.
   */
  margin-left: 0;
  margin-right: 0;
  margin-bottom: var(--token-space-400, var(--token-scale-400, 16px));
  /**
   * Label text should not extend
   * beyond the bounds of the checkbox.
   */
  max-width: 133.3333333333%;
}

:host(.checkbox-size-small) {
  --size: var(--token-scale-400, 16px);
}

:host(.checkbox-checked) .native-wrapper,
:host(.checkbox-indeterminate) .native-wrapper {
  border-color: var(--border-color-checked);
  background: var(--checkbox-background-checked);
}

:host(.ion-invalid) {
  --focus-ring-color: var(--token-border-focus-error, var(--token-primitives-red-400, #faa1a1));
}

:host(.ion-invalid:not(.checkbox-checked)) .native-wrapper,
:host(.ion-invalid:not(.checkbox-checked).checkbox-disabled) .native-wrapper {
  border-color: var(--token-border-danger-default, var(--token-semantics-danger-800, var(--token-primitives-red-800, #bf2222)));
}

:host(.checkbox-disabled) .native-wrapper:after {
  right: 0;
  left: 0;
  top: 0;
  bottom: 0;
  position: absolute;
  background-color: var(--token-state-disabled, rgba(255, 255, 255, 0.6));
  content: "";
  pointer-events: none;
  right: unset;
  left: unset;
  top: unset;
  bottom: unset;
  width: inherit;
  height: inherit;
}

:host(.checkbox-disabled.checkbox-checked) .native-wrapper {
  border-width: var(--token-border-size-0, var(--token-scale-0, 0px));
  background-color: var(--token-bg-primary-base-default, var(--token-semantics-primary-base, var(--token-semantics-primary-700, var(--token-primitives-blue-700, #105cef))));
}

@media (any-hover: hover) {
  :host(:hover) .native-wrapper {
    background-color: var(--token-primitives-neutral-100, #f3f3f3);
  }
  :host(:hover.checkbox-checked) .native-wrapper,
  :host(:hover.checkbox-checked) .checkbox-icon,
  :host(:hover.checkbox-indeterminate) .native-wrapper,
  :host(:hover.checkbox-indeterminate) .checkbox-icon {
    background-color: var(--token-semantics-primary-800, var(--token-primitives-blue-800, #0f54da));
  }
}
:host(.ion-focused:not(.checkbox-disabled)) .native-wrapper {
  outline-offset: var(--focus-ring-width);
  outline: var(--focus-ring-width) var(--token-border-style-solid, solid) var(--focus-ring-color);
}

:host(.ion-activated) .native-wrapper {
  background-color: var(--token-bg-input-press, var(--token-primitives-neutral-200, #eae9e9));
}

:host(.ion-activated.checkbox-checked) .native-wrapper,
:host(.ion-activated.checkbox-checked) .checkbox-icon,
:host(.ion-activated.checkbox-indeterminate) .native-wrapper,
:host(.ion-activated.checkbox-indeterminate) .checkbox-icon {
  background-color: var(--token-bg-primary-base-press, var(--token-semantics-primary-900, var(--token-primitives-blue-900, #0d4bc3)));
}

:host(.ion-activated.ion-invalid:not(.checkbox-checked)) {
  background-color: var(--token-bg-input-press, var(--token-primitives-neutral-200, #eae9e9));
}
:host(.ion-activated.ion-invalid:not(.checkbox-checked)) .native-wrapper {
  border-color: var(--token-border-danger-press, var(--token-semantics-danger-1000, var(--token-primitives-red-1000, #761515)));
}

:host(.checkbox-shape-soft) {
  --border-radius: var(--token-border-radius-100, var(--token-scale-100, 4px));
}

:host(.checkbox-size-small.checkbox-shape-soft) {
  --border-radius: var(--token-border-radius-025, var(--token-scale-050, 2px));
}

:host(.checkbox-shape-rectangular) {
  --border-radius: var(--token-border-radius-0, var(--token-scale-0, 0px));
}

.checkbox-wrapper {
  min-height: var(--token-scale-1200, 48px);
}