/**
 * Office UI Fabric JS 1.5.0
 * The JavaScript front-end framework for building experiences for Office 365.
 **/
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project root for license information.

//
// Office UI Fabric
// --------------------------------------------------
// CheckBox styles

$ms-checkbox-field-size: 20px;
$ms-checkbox-transition-duration: 200ms;
$ms-checkbox-transition-timing: cubic-bezier(.4, 0, .23, 1);


.ms-CheckBox {
  box-sizing: border-box;
  color: $ms-color-neutralPrimary;
  font-family: $ms-font-family-base;
  font-size: $ms-font-size-m;
  font-weight: $ms-font-weight-regular;
  min-height: 36px;
  position: relative;

  .ms-Label {
    font-size: $ms-font-size-m;
    padding: 0 0 0 26px;
    cursor: pointer;
    display: inline-block;
  }
}

// The hidden input
.ms-CheckBox-input {
  position: absolute;
  opacity: 0;
}

// The checkbox square container
.ms-CheckBox-field::before {
  content: '';
  display: inline-block;
  border: 2px solid $ms-color-neutralTertiary;
  width: $ms-checkbox-field-size;
  height: $ms-checkbox-field-size;
  cursor: pointer;
  font-weight: normal;
  position: absolute;
  box-sizing: border-box;
  transition-property: background, border, border-color;
  transition-duration: $ms-checkbox-transition-duration;
  transition-timing-function: $ms-checkbox-transition-timing;
}

// The check mark icon
.ms-CheckBox-field::after {
  @include ms-Icon--CheckMark;
  font-family: 'FabricMDL2Icons';
  display: none;
  position: absolute;
  font-weight: 900;
  background-color: transparent;
  font-size: $ms-font-size-s-plus;
  top: 0;
  color: $ms-color-white;
  line-height: $ms-checkbox-field-size;
  width: $ms-checkbox-field-size;
  text-align: center;

  @media screen and (-ms-high-contrast: active) {
    color: $ms-color-black;
  }

  @media screen and (-ms-high-contrast: black-on-white) {
    color: $ms-color-white;
  }
}

// The checkbox field
.ms-CheckBox-field {
  display: inline-block;
  cursor: pointer;
  margin-top: 8px;
  position: relative;
  outline: 0;
  vertical-align: top;

  &:hover,
  &:focus {
    &::before {
      border-color: $ms-color-neutralSecondaryAlt;
    }

    .ms-Label {
      color: $ms-color-black;
    }
  }

  //== State: A disabled checkbox
  //
  &.is-disabled {
    cursor: default;

    &::before {
      background-color: $ms-color-neutralTertiaryAlt;
      border-color: $ms-color-neutralTertiaryAlt;
      color: $ms-color-neutralTertiaryAlt;

      @media screen and (-ms-high-contrast: active) {
        border-color: $ms-color-contrastBlackDisabled;
      }

      @media screen and (-ms-high-contrast: black-on-white) {
        border-color: $ms-color-contrastWhiteDisabled;
      }
    }

    .ms-Label {
      color: $ms-color-neutralTertiary;

      @media screen and (-ms-high-contrast: active) {
        color: $ms-color-contrastBlackDisabled;
      }

      @media screen and (-ms-high-contrast: black-on-white) {
        color: $ms-color-contrastWhiteDisabled;
      }
    }
  }

  //== State: A checkbox in focus
  //
  &.in-focus {
    &::before {
      border-color: $ms-color-neutralSecondaryAlt;
    }

    &.is-disabled::before {
      border-color: $ms-color-neutralTertiaryAlt;
    }

    &.is-checked::before {
      border-color: $ms-color-themeDarkAlt;
    }
  }
}

//== State: When the checkbox is checked
//
.ms-CheckBox-field.is-checked {
  &::before {
    border: 10px solid $ms-color-themePrimary;
    background-color: $ms-color-themePrimary;

    @media screen and (-ms-high-contrast: active) {
      border-color: $ms-color-contrastBlackSelected;
    }

    @media screen and (-ms-high-contrast: black-on-white) {
      border-color: $ms-color-contrastWhiteSelected;
    }
  }

  &::after {
    display: block;
  }

  &:hover,
  &:focus {
    &::before {
      border-color: $ms-color-themeDarkAlt;
    }
  }
}
