@mixin underline-input {
  background: none;
  border: 0;
  border-bottom: 1px solid;
  border-radius: 0;
  -webkit-appearance: none !important;
  vertical-align: middle;
  padding-left: 0;
  border-color: $bright-default;

  &:focus:hover {
    border: 0;
    border-bottom: 1px solid $cyan;
  }
}

.form-control {
  color: $font-color;
  outline: 0;
  vertical-align: top;
  background-color: #fff;
  filter: none !important;
  @include box-shadow(none);
  border-radius: 2px;
  border: 1px solid $bright-default;
  @include transition(all .2s linear);

  &:not(select) {
    -webkit-appearance: none !important;
  }

  @include placeholder {
    @include transition(color .2s linear);
    color: $font-color-lighter;
    font-style: $font-style-italic;
    font-size: $font-size-small;
    line-height: 20px;
  }

  &.input-lg {
    @include placeholder {
      font-size: $font-size-large;
    }
  }

  &.input-sm {
    @include placeholder {
      line-height: 18px;
    }
  }

  &:hover:not(:disabled) {
    border-color: darken($bright-default, 15%);
  }

  &:focus,
  &:focus:hover {
    outline: none;
    border: 1px solid;
    border-color: $cyan;
    @include box-shadow(none);
  }


  &.underline-input {
    @include underline-input;

    &:focus {
      border-color: $cyan;
    }
  }

  &.rounded {
    border-radius: 600px;
  }

  &.input-unstyled {
    border: 0;
    padding: 0;
    background-color: transparent;
    @include placeholder {
      font-size: 16px;
    }

    &:focus,
    &:focus:hover {
      border: 0;
    }
  }
}

.form-group {
  &.legend {
    h1, h2, h3, h4, h5, h6 {
      color: $brand-primary;
      margin-bottom: 3px;
    }
    p {
      font-size: $font-size-small;
      color: $font-color-light;
      border-bottom: 1px dotted #cacaca;
      padding-bottom: 5px;
    }
  }
}

label {
  font-weight: $font-weight-normal;
}

//input groups

.input-group-addon {
  border-radius: 2px;

  input[type="radio"],
  input[type="checkbox"] {
    margin-top: 3px;
  }
}

.input-group .btn {
  border-radius: 2px;
}

//validations

.form-validation .form-control {
  &.has-focus+.help-block {
    display:none;
  }
  &.has-visited:not(.has-focus)+.help-block {
    display:block;
  }
  &.ng-dirty.ng-invalid,
  &.ng-dirty.ng-invalid[type="checkbox"]+i {
    border-color: $lighter-red;
    &+.help-block {
      color: $lighten-red;
    }
  }
  &.ng-dirty.ng-valid {
    border-color: $lighter-green;
    &+.help-block {
      color: $lighten-green;
    }
  }
}

.has-error {
  .form-control,
  .form-control:focus {
    @include box-shadow(none);
    border-color: $lighter-red;

    &.has-focus {
      border-color: $cyan;
    }
    &.has-visited:not(.has-focus) {
      border-color: $lighter-red;
    }
  }
  .control-label,
  .help-block {
    color: $lighten-red;
  }
  .radio,
  .checkbox,
  .radio-inline,
  .checkbox-inline {
    color: $font-color;
  }
  .checkbox-custom>i,
  .checkbox-custom:hover>i {
    border-color: $lighter-red;
  }
}

.has-success {
  .form-control,
  .form-control:focus {
    @include box-shadow(none);
    border-color: $lighter-green;

    &.has-focus {
      border-color: $cyan;
    }
    &.has-visited:not(.has-focus) {
      border-color: $lighter-green;
    }
  }
  .control-label,
  .help-block {
    color: $lighten-green;
  }
  .radio,
  .checkbox,
  .radio-inline,
  .checkbox-inline {
    color: $font-color;
  }
  .checkbox-custom>i {
    border-color: $lighter-green;
  }
}

.has-warning {
  .form-control,
  .form-control:focus {
    @include box-shadow(none);
    border-color: $lighter-orange;

    &.has-focus {
      border-color: $cyan;
    }
    &.has-visited:not(.has-focus) {
      border-color: $lighter-orange;
    }
  }
  .control-label,
  .help-block {
    color: $lighten-orange;
  }
  .radio,
  .checkbox,
  .radio-inline,
  .checkbox-inline {
    color: $font-color;
  }
  .checkbox-custom>i {
    border-color: $lighter-orange;
  }
}

//custom checkbox & radio
.checkbox-custom,
.checkbox-custom-alt {
  padding-left: 20px;
  cursor: pointer;

  input {
    position: absolute;
    opacity: 0;

    &:checked {
      +i {
        border-color: $brand-primary;
        background-color: $brand-primary;

        &:before {
          top: 3px;
          left: 3px;
          width: 12px;
          height: 12px;
          background-color: #fff;
        }

      }
      +span {
        .active {
          display: inherit;
        }
      }
    }

    &[type='radio'] {
      +i,
      +i:before {
        border-radius: 50%;
      }
    }

    &[disabled] {
      +i {
        border-color: #e2e2e2;
        background-color: #f2f2f2;
      }
      +i:before {
        background-color: #e2e2e2;
      }
    }
  }

  >i {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-top: -2px;
    margin-right: 4px;
    margin-left: -20px;
    line-height: 1;
    vertical-align: middle;
    background-color: #fff;
    border: 1px solid $transparent-black-2;
    @include transition(all .2s);

    &:before {
      position: absolute;
      top: 50%;
      left: -100%;
      width: 0;
      height: 0;
      background-color: transparent;
      content: "";
      @include transition(all .2s);
      z-index: 1;
    }
  }

  >span {
    margin-left: -20px;

    .active {
      display: none;
    }
  }

  &:hover {
    >i {
      border-color: $cyan;
    }
  }

  &.checkbox-custom-sm {
    input:checked+i:before {
      top: 2px;
      left: 2px;
      width: 10px;
      height: 10px;
    }

    >i {
      width: 16px;
      height: 16px;
      margin-right: 6px;
      margin-left: -18px;
    }
  }

  &.checkbox-custom-lg {
    input:checked+i:before {
      top: 3px;
      left: 3px;
      width: 22px;
      height: 22px;
    }

    >i {
      width: 30px;
      height: 30px;
    }
  }
}

//custom checkbox & radio
.checkbox-custom-alt {

  input {

    &:checked {
      +i {
        background-color: transparent;
        border-color: #666;
        color: #666;

        &:before {
          top: 2px;
          left: 2px;
          width: auto;
          height: auto;
          background-color: transparent;
          opacity: 1;
        }

      }
    }

    &[type='radio']:checked {
      +i:before {
        left: 1px;
      }
    }

    &[disabled] {
      +i {
        border-color: #e2e2e2;
        background-color: #f2f2f2;
      }
      +i:before {
        background-color: transparent;
        color: #ccc;
      }
    }
  }

  >i {
    width: 18px;
    height: 18px;
    background-color: transparent;
    border: 2px solid #dfdfdf;

    &:before {
      content: "\f00c";
      top: 0;
      left: 0;
      @include icon;
      font-size: 11px;
      opacity: 0;
      @include transition(all .2s);
    }
  }

  &.checkbox-custom-sm {
    >i {
      &:before {
        font-size: 9px;
      }
    }
    input:checked+i:before {
      font-size: 9px;
      top: 1px;
    }
  }

  &.checkbox-custom-lg {
    input:checked+i:before {
      font-size: 18px;
      top: 4px;
      left: 4px;
    }
  }
}

// toggle switch

.onoffswitch {
  position: relative;
  width: 40px;
  height: 25px;
  @include user-select(none);

  &.green {
    .onoffswitch-inner:before {
      background-color: $green;
    }
  }
  &.red {
    .onoffswitch-inner:before {
      background-color: $red;
    }
  }
  &.cyan {
    .onoffswitch-inner:before {
      background-color: $cyan;
    }
  }
  &.orange {
    .onoffswitch-inner:before {
      background-color: $orange;
    }
  }
  &.amethyst {
    .onoffswitch-inner:before {
      background-color: $amethyst;
    }
  }
  &.greensea {
    .onoffswitch-inner:before {
      background-color: $greensea;
    }
  }
  &.dutch {
    .onoffswitch-inner:before {
      background-color: $dutch;
    }
  }
  &.hotpink {
    .onoffswitch-inner:before {
      background-color: $hotpink;
    }
  }
  &.drank {
    .onoffswitch-inner:before {
      background-color: $drank;
    }
  }
  &.blue {
    .onoffswitch-inner:before {
      background-color: $blue;
    }
  }
  &.slategray {
    .onoffswitch-inner:before {
      background-color: lighten($slategray, 10%);
    }
  }
  &.darkgray {
    .onoffswitch-inner:before {
      background-color: lighten($darkgray, 10%);
    }
  }
  &.lightred {
    .onoffswitch-inner:before {
      background-color: $lightred;
    }
  }
  &.primary {
    .onoffswitch-inner:before {
      background-color: $brand-primary;
    }
  }
  &.success {
    .onoffswitch-inner:before {
      background-color: $brand-success;
    }
  }
  &.warning {
    .onoffswitch-inner:before {
      background-color: $brand-warning;
    }
  }
  &.danger {
    .onoffswitch-inner:before {
      background-color: $brand-danger;
    }
  }
  &.info {
    .onoffswitch-inner:before {
      background-color: $brand-info;
    }
  }

  &.labeled {
    width: 46px;

    .onoffswitch-inner:before {
      content: "On";
      padding-left: 7px;
    }
    .onoffswitch-inner:after {
      content: "Off";
      padding-right: 7px;
    }
    .onoffswitch-switch {
      right: 21px;
    }
  }

  &.small {
    width: 20px;
    height: 15px;
    margin-top: 3px;
    right: -5px;

    .onoffswitch-switch {
      right: 6px;
    }

    .onoffswitch-inner:before, .onoffswitch-inner:after {
      height: 15px;
      line-height: 15px;
    }

    .onoffswitch-switch {
      width: 10px;
    }
  }

  &.medium {
    width: 30px;
    height: 20px;
    margin-top: 3px;
    right: -5px;

    .onoffswitch-switch {
      right: 11px;
    }

    .onoffswitch-inner:before, .onoffswitch-inner:after {
      height: 20px;
      line-height: 20px;
    }

    .onoffswitch-switch {
      width: 15px;
    }
  }
}

.onoffswitch-checkbox {
  display: none;
}

.onoffswitch-label {
  display: block; overflow: hidden; cursor: pointer;
  @include border-radius(50px)
}

.onoffswitch-inner {
  display: block;
  width: 200%;
  margin-left: -100%;
  @include transition(margin 0.2s ease-in 0s);
}

.onoffswitch-inner:before, .onoffswitch-inner:after {
  float: left;
  width: 50%;
  height: 25px;
  padding: 0;
  line-height: 25px;
  font-size: 9px;
  color: white;
  box-sizing: border-box;
  @include border-radius(50px);
  -webkit-transform: none;
}

.onoffswitch-inner:before {
  content: "";
  padding-left: 9px;
  background-color: rgba(0,0,0,.2);
  color: #FFFFFF;
}

.onoffswitch-inner:after {
  content: "";
  padding-right: 9px;
  background-color: rgba(0,0,0,.8);
  color: #999999;
  text-align: right;
}

.onoffswitch-switch {
  display: block;
  width: 21px;
  margin: 2px;
  background: #FFFFFF;
  @include border-radius(50px);
  position: absolute;
  top: 0;
  bottom: 0;
  right: 15px;
  @include transition( all 0.2s ease-in 0s);
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
  margin-left: 0;
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
  right: 0px;
}

fieldset[disabled] .checkbox-custom input+i {
  border-color: $transparent-black-1;
}

fieldset[disabled] .checkbox-custom input+i:before {
  background-color: $transparent-black-1;
}

.help-block {
  font-size: $font-size-small;
  color: $font-color-light;
}

//slider

.slider {
  display: inline-block;
  vertical-align: middle;
  position: relative;

  &.slider-horizontal {
    width: 210px;
    height: 20px;

    .slider-track {
      width: 100%;
      margin-top: -5px;
      top: 50%;
      left: 0;
    }

    .slider-selection {
      height: 100%;
      top: 0;
      bottom: 0;
    }

    .slider-handle {
      margin-left: -10px;
      margin-top: -8px;

      &.triangle {
        border-width: 0 10px 10px 10px;
        width: 0;
        height: 0;
        margin-top: 0;
        border-color: transparent;
        @include box-shadow(none);
        border-bottom-color: $lightred;
      }
    }

  }
  &.slider-vertical {
    height: 210px;
    width: 20px;

    .slider-track {
      height: 100%;
      left: 50%;
      top: 0;
      width: 6px;
      margin-left: -2px;
    }
    .slider-selection {
      width: 100%;
      left: 0;
      top: 0;
      bottom: 0;
    }
    .slider-handle {
      margin-left: -8px;
      margin-top: -10px;

      &.triangle {
        border-width: 10px 0 10px 10px;
        width: 1px;
        height: 1px;
        margin-left: 0;
        border-left-color: $lightred;
      }
    }
  }
  &.disabled {
    .slider-track {
      cursor: not-allowed;
    }
  }

  input {
    display: none;
  }

  .tooltip {
    display: none;
    &.top {
      margin-top: -22px;
    }
  }

  &:hover {
    .tooltip {
      display: block;
    }
  }

  .tooltip-inner {
    white-space: nowrap;
  }
  .hide {
    display: none;
  }

  .slider-track {
    position: absolute;
    cursor: pointer;
    background-color: #fff;
    border: 1px solid $bright-default;
    height: 6px;
    border-radius: 3px;
    @include box-shadow(none);
  }
  .slider-selection {
    position: absolute;
    box-sizing: border-box;
    background-color: $blue;
    background-image: none;
    border-radius: 3px;
  }
  .slider-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    outline: none;
    background-color: #fff;
    background-image: none;
    border: 1px solid;
    border-color: $transparent-black-1;
    @include box-shadow(1px 1px 1px $transparent-black-05);

    &.round {
      border-radius: 20px;
    }
    &.triangle {
      background: transparent none;
    }
  }
}

// angular select 2
.ui-select-bootstrap {
  >.ui-select-match {
    border-color: $bright-default!important;
    border-radius: 2px;

    .ui-select-toggle>span{
      &:first-of-type {
        color: $font-color-lighter;
        font-style: $font-style-italic;
        font-size: $font-size-small;
      }
      &:nth-of-type(2) {
        > a {
          position: absolute;
          right: 35px;
          top: 7px;
          font-size: 10px;
          padding: 2px;
          color: $font-color-lighter;

          &:hover {
            color: $brand-primary;
          }
        }
      }
    }
  }
  .ui-select-match-item {
    &.btn-primary {
      color: white;
    }
  }
  .ui-select-choices {
    top: 0px!important;
  }
}
.ui-select-choices {
  .ui-select-choices-row {
    padding: 0;
    >a {
      color: $font-color;
      font-size: $font-size-small;
    }

    &.active {
      >a {
        background: $lighter-default;
      }
    }
  }
}
.ui-select-multiple.ui-select-bootstrap {
  &.open {
    border-color: $cyan;
  }
  .ui-select-match .close {
    line-height: .8;
  }
  input.ui-select-search {
    @include placeholder {
      color: $font-color-lighter;
      font-style: $font-style-italic;
      font-size: $font-size-small;
      line-height: 20px;
      padding: 0 7px;
    }
  }
  &.underline-input {
    input.ui-select-search {
      @include placeholder {
        padding: 0;
      }
    }
  }
}

//textAngular

.ta-toolbar {
  margin-bottom: 10px;
}

.ta-root.focussed .ta-scroll-window.form-control {
  border-color: $cyan;
  @include box-shadow(none);
}

.ta-hidden-input {
  display: none;
}

//input Tags

tags-input .tags {
  border: 1px solid #ccc;
  box-shadow: none;

  &.focused,
  &.focused:hover {
    box-shadow: none;
    border-color: $cyan;
  }

  .tag-item {
    background: white;
    border-radius: 2px;
    border-color: #cfcfcf;
    font-size: 12px;
    font-family: $font-lato;

    &.selected {
      background: #f2f2f2;
      border-color: $lightred;
    }
  }
}
