@import "./checkbox";
@import "./checkbox.md.vars";

// Material Design Checkbox
// --------------------------------------------------

:host {
  --size: #{$checkbox-md-icon-size};

  // Border
  --border-radius: calc(var(--size) * .125);
  --border-width: #{$checkbox-md-icon-border-width};
  --border-style: #{$checkbox-md-icon-border-style};
  --border-color: #{$checkbox-md-icon-border-color-off};

  // Background
  --background: #{$checkbox-md-icon-background-color-off};
  --transition: #{background $checkbox-md-transition-duration $checkbox-md-transition-easing};
}

// Material Design Checkbox Inner Checkmark: Checked
// -----------------------------------------

:host(.checkbox-checked) .checkbox-inner {
  @include position(calc(var(--size) * .05), null, null, calc(var(--size) * .3));

  position: absolute;

  width: calc(var(--size) * .3125);
  height: calc(var(--size) * .625);

  transform: rotate(45deg);

  border-width: calc(var(--size) * .125);
  border-top-width: 0;
  border-left-width: 0;
  border-style: $checkbox-md-icon-checkmark-style;
}


// Material Design Checkbox: Disabled
// -----------------------------------------

// TODO
// .item-md.item-checkbox-disabled ion-label {

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


// Material Design Checkbox Keyboard Focus
// -----------------------------------------

:host(.checkbox-key) .checkbox-icon::after {
  @include border-radius(50%);
  @include position(-12px, null, null, -12px);

  display: block;
  position: absolute;

  width: 36px;
  height: 36px;

  background: $checkbox-md-background-color-focused;

  content: "";
  opacity: .2;
}


// Material Design Checkbox Within An Item
// -----------------------------------------

:host(.in-item) {
  @include margin($checkbox-md-item-start-margin-top, $checkbox-md-item-start-margin-end, $checkbox-md-item-start-margin-bottom, $checkbox-md-item-start-margin-start);

  display: block;
  position: static;
}

:host(.in-item[slot="end"]) {
  @include margin($checkbox-md-item-end-margin-top, $checkbox-md-item-end-margin-end, $checkbox-md-item-end-margin-bottom, $checkbox-md-item-end-margin-start);
}

// REVIEW
// .checkbox-md + .item-inner ion-label {
//   @include margin-horizontal(0, null);
// }
