@import "./mixins/variables";
@import "./mixins/mixins";

.u-checkbox {
  position: relative;
  z-index: 1;
  vertical-align: middle;
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  //height: $checkbox-label-height;
  margin: 0;
  padding: 0;
  word-wrap: break-word;
  word-break: break-all;
  text-align: left;

  &.is-upgraded {
    padding-left: $checkbox-button-size + $checkbox-padding;
  }
}

.u-checkbox-input {
  line-height: $checkbox-label-height;

  .u-checkbox.is-upgraded & {
    // Hide input element, while still making it respond to focus.
    position: absolute;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    -ms-appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    border: none;
  }
}

.u-checkbox-outline {
  position: absolute;
  top: $checkbox-top-offset;
  left: 0;

  display: inline-block;

  box-sizing: border-box;
  width: $checkbox-button-size;
  height: $checkbox-button-size;
  margin: 0;

  cursor: pointer;
  overflow: hidden;

  border: 1px solid $checkbox-off-color;
  border: 1px solid $checkbox-off-color-IE8 \9;
  border-radius: 2px;

  z-index: 2;

  .u-checkbox.is-checked & {
    border: 1px solid $checkbox-color;
  }

  fieldset[disabled] .u-checkbox &,
  .u-checkbox.is-disabled & {
    border: 1px solid $checkbox-disabled-color;
    cursor: auto;
  }
}

.u-checkbox-focus-helper {
  position: absolute;
  top: $checkbox-top-offset;
  left: 0;

  display: inline-block;

  box-sizing: border-box;
  width: $checkbox-button-size;
  height: $checkbox-button-size;
  border-radius: 50%;

  background-color: transparent;

  .u-checkbox.is-focused & {
    box-shadow: 0 0 0px ($checkbox-button-size / 2) rgba(0, 0, 0, 0.1);
    background-color: rgba(0, 0, 0, 0.1);
  }

  .u-checkbox.is-focused.is-checked & {
    box-shadow: 0 0 0px ($checkbox-button-size / 2) $checkbox-focus-color;
    background-color: $checkbox-focus-color;
  }
}

.u-checkbox-tick-outline {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  mask: url("#{$checkbox-image-path}/tick-mask.svg?embed");

  background: transparent;
  @include material-animation-default(0.28s);
  transition-property: background;

  .u-checkbox.is-checked & {
    background: $checkbox-color url("#{$checkbox-image-path}/tick.svg?embed");
  }

  fieldset[disabled] .u-checkbox.is-checked &,
  .u-checkbox.is-checked.is-disabled & {
    background: $checkbox-disabled-color;
    // mask: url("#{$checkbox-image-path}/tick-mask.svg?embed");
  }

  // fieldset[disabled] .u-checkbox &,
  // .u-checkbox.is-disabled & {
  //   background: $checkbox-disabled-color;
  //   mask:none;
  //   -webkit-mask:none;
  // }


}

.u-checkbox-label {
  position: relative;
  cursor: pointer;
  font-size: $checkbox-label-font-size;
  line-height: $checkbox-label-height;
  margin: 0;

  fieldset[disabled] .u-checkbox &,
  .u-checkbox.is-disabled & {
    color: $checkbox-disabled-color;
    cursor: auto;
  }
}

//.u-checkbox__ripple-container {
//  position: absolute;
//  z-index: 2;
//  top: -(($checkbox-ripple-size - $checkbox-label-height) / 2);
//  left: -(($checkbox-ripple-size - $checkbox-button-size) / 2);
//
//  box-sizing: border-box;
//  width: $checkbox-ripple-size;
//  height: $checkbox-ripple-size;
//  border-radius: 50%;
//
//  cursor: pointer;
//
//  overflow: hidden;
//  -webkit-mask-image: -webkit-radial-gradient(circle, white, black);
//
//  & .mdl-ripple {
//    background: $checkbox-color;
//  }
//
//  fieldset[disabled] .u-checkbox &,
//  .u-checkbox.is-disabled & {
//    cursor: auto;
//  }
//
//  fieldset[disabled] .u-checkbox & .mdl-ripple,
//  .u-checkbox.is-disabled & .mdl-ripple {
//    background: transparent;
//  }
//}


.u-checkbox-primary {
  @include checkbox-styles-variant($checkbox-primary-bg);
}

// Modifier: `checkbox-success`
// -------------------------

.u-checkbox-success {
  @include checkbox-styles-variant($checkbox-success-bg);
}

// Modifier: `checkbox-info`
// -------------------------

.u-checkbox-info {
  @include checkbox-styles-variant($checkbox-info-bg);
}

// Modifier: `checkbox-warning`
// -------------------------

.u-checkbox-warning {
  @include checkbox-styles-variant($checkbox-warning-bg);
}

// Modifier: `checkbox-danger`
// -------------------------

.u-checkbox-danger {
  @include checkbox-styles-variant($checkbox-danger-bg);
}

// Modifier: `checkbox-dark`
// -------------------------

.u-checkbox-dark {
  @include checkbox-styles-variant($checkbox-dark-bg);
}