/**
 * 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 {
  /**
   * @prop --size: Size of the checkbox icon
   *
   * @prop --checkbox-background: Background 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
   */
  --checkbox-background-checked: var(--ion-color-primary, #0054e9);
  --border-color-checked: var(--ion-color-primary, #0054e9);
  --checkmark-color: var(--ion-color-primary-contrast, #fff);
  --transition: none;
  display: inline-block;
  position: relative;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}

: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;
}

:host(.ion-color) {
  --checkbox-background-checked: var(--ion-color-base);
  --border-color-checked: var(--ion-color-base);
  --checkmark-color: var(--ion-color-contrast);
}

.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;
}

:host(.in-item) .label-text-wrapper,
:host(.in-item:not(.checkbox-label-placement-stacked):not([slot])) .native-wrapper {
  margin-top: 10px;
  margin-bottom: 10px;
}

:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper {
  margin-top: 10px;
  margin-bottom: 16px;
}

:host(.in-item.checkbox-label-placement-stacked) .native-wrapper {
  margin-bottom: 10px;
}

/**
 * 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;
}

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

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

.checkbox-icon {
  border-radius: var(--border-radius);
  position: relative;
  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 path {
  fill: none;
  stroke: var(--checkmark-color);
  stroke-width: var(--checkmark-width);
  opacity: 0;
}

: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;
}

/**
 * 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;
}

: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: 16px;
  margin-inline-end: 16px;
}

/**
 * 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;
}

/**
 * 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: 16px;
  margin-inline-start: 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: 16px;
  margin-inline-end: 16px;
}

/**
 * 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;
}

: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: 16px;
  /**
   * Label text should not extend
   * beyond the bounds of the checkbox.
   */
  max-width: calc(100% / 0.75);
}

: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-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;
}

/**
 * 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;
 *   }
 * }
 */
/**
 * 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 {
  --border-radius: 50%;
  --border-width: 0.125rem;
  --border-style: solid;
  --border-color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.23);
  --checkbox-background: var(--ion-item-background, var(--ion-background-color, #fff));
  --size: min(1.375rem, 55.836px);
  --checkmark-width: 1.5px;
}

:host(.checkbox-disabled) {
  opacity: 0.3;
}