//Radio buttons
//TODO need fallback for ie8

$radio-button-size: rem-calc(16);
input[type=radio] {
  cursor: pointer;
  opacity: 0;
  position: absolute;

  & ~ .description {
    cursor: pointer;
    vertical-align: baseline;
    text-transform: none;
    line-height: 2;
    * {
      display: inline;
    }

    &:before {
      content: ' ';
      cursor: pointer;
      text-align: center;
      line-height: $radio-button-size;
      width: $radio-button-size;
      height: $radio-button-size;
      margin-right: $radio-button-size/2;
      border-radius: $radio-button-size/2;
      background-color: #FFF;

      -webkit-box-shadow: inset 0px 0px 0px $radio-button-size * .3 #FFF, 0px 0px 0px 1px $avalara-medium-gray;
      -moz-box-shadow: inset 0px 0px 0px $radio-button-size * .3 #FFF, 0px 0px 0px 1px $avalara-medium-gray;
      box-shadow: inset 0px 0px 0px $radio-button-size * .3 #FFF, 0px 0px 0px 1px $avalara-medium-gray;
    }
  }

  &:checked + .description {
    &:before {
      background-color: $avalara-dark-gray;
    }
  }

  &:disabled {

    & ~ .description:before {

      -webkit-box-shadow: inset 0px 0px 0px $radio-button-size * .3 #FFF, 0px 0px 0px 1px $avalara-disabled-gray;
      -moz-box-shadow: inset 0px 0px 0px $radio-button-size * .3 #FFF, 0px 0px 0px 1px $avalara-disabled-gray;
      box-shadow: inset 0px 0px 0px $radio-button-size * .3 #FFF, 0px 0px 0px 1px $avalara-disabled-gray;
    }

    &:checked ~ .description:before {
      background-color: $avalara-disabled-gray;
    }

  }

}

.radio-container {
  position: relative;
  margin-bottom: rem-calc(4);
  margin-top: rem-calc(8);
  padding-top: rem-calc(2);
  height: rem-calc(18);

  &:last-of-type {
    margin-bottom: rem-calc(20);
  }

  .description {
    margin-left: rem-calc(26);
    font-size: 1rem;
    color: $avalara-dark-gray;
    letter-spacing: normal;
  }

  .description:before {
    left: 0;
    position: absolute;
    top: 7px;
  }

  &:last-child {
    padding-bottom: 8px;
    margin-bottom: 2px;
  }
}

ul.inline-list {
  .radio-container {
    display:inline;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    margin-left: rem-calc(26) - $radio-button-size;

    input[type=radio] {

      & ~ .description {
        &:before {
          top: -2px;
        }
      }
    }
  }
}
