$unchecked-background-gradient-top: #CBCBCB;
$unchecked-background-gradient-bottom: #FFFFFF;

$checked-background-gradient-top: #3160ab;
$checked-background-gradient-bottom: #082c67;

$switch-background-gradient-top: #D4D4D4;
$switch-background-gradient-bottom: #FFFFFF;
$switch-border-color: #C4C4C4;

$checked-text-color: #FFFFFF;
$unchecked-text-color: #666;

$width: 70px;
$height: $width * 0.26;
$switch-border-width: 1px;
$switch-width: $width * 0.46 - $switch-border-width;

div.iCheckBox {
  width: $width;
  height: $height;
  display: inline-block;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  background: -moz-linear-gradient(top, $unchecked-background-gradient-top, $unchecked-background-gradient-bottom);
  background: -webkit-linear-gradient(top, $unchecked-background-gradient-top, $unchecked-background-gradient-bottom);
  background: -o-linear-gradient(top, $unchecked-background-gradient-top, $unchecked-background-gradient-bottom);
  background: linear-gradient(to bottom, $unchecked-background-gradient-top, $unchecked-background-gradient-bottom);
  box-shadow: 0 0 2px rgba(0, 0, 0, .4), inset 0 0 2px rgba(0, 0, 0, .8);

  transition: opacity .3s;

  .sw {
    width: 50%;
    height: 100%;
    background: -moz-linear-gradient(top, $switch-background-gradient-top, $switch-background-gradient-bottom);
    background: -webkit-linear-gradient(top, $switch-background-gradient-top, $switch-background-gradient-bottom);
    background: -o-linear-gradient(top, $switch-background-gradient-top, $switch-background-gradient-bottom);
    background: linear-gradient(to bottom, $switch-background-gradient-top, $switch-background-gradient-bottom);
    border-radius: 3px;
    display: inline-block;
    position: absolute;
    border: $switch-border-width solid $switch-border-color;
    text-align: center;

    [class^="icon-"],
    [class*=" icon-"] {
      font-size: 130%;
      position: relative;
      top: -6%;
    }
  }

  .txt {
    width: $width - $switch-width - 2 * $switch-border-width;
    height: $height;
    line-height: $height;
    display: inline-block;
    position: absolute;
    left: $switch-width + 2 * $switch-border-width;
    font-size: $height / 2;
    font-weight: bold;
    text-align: center;
    color: $unchecked-text-color;
    overflow: hidden;
  }

  &.checked {
    background: -moz-linear-gradient(top, $checked-background-gradient-top, $checked-background-gradient-bottom);
    background: -webkit-linear-gradient(top, $checked-background-gradient-top, $checked-background-gradient-bottom);
    background: -o-linear-gradient(top, $checked-background-gradient-top, $checked-background-gradient-bottom);
    background: linear-gradient(to bottom, $checked-background-gradient-top, $checked-background-gradient-bottom);
    .sw {
      left: $width - $switch-width - 2 * $switch-border-width;
    }

    .txt {
      left: 0;
      color: $checked-text-color;
    }
  }

  &.disabled {
    opacity: 0.5;
  }
}

div.iCheckBox:hover {
  opacity: .8;

  &.disabled {
    opacity: 0.5;
  }
}