$btn-padding: 8px 15px;
$xs-padding: 2px 3px;
$sm-padding: 5px 10px 3px 10px;
$lg-padding: 18px 30px;

// -----------------------------------------------------------------------------
// This file contains all styles related to the button component.
// -----------------------------------------------------------------------------
button {
  background: $bg-default;
}

.btn,
button,
[class^='btn-'] {
    display: inline-block;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border: 0 solid transparent;
    padding: $btn-padding;
    letter-spacing: .5px;
    border-radius: 1.5px;

    &.tab-selected {
      border-bottom: solid 2px $link-color;
      color: $link-color;
    }

    &.bg-transparent {
        color: darken($link-color, 5);
    }
    &:hover {
        text-decoration: none;
    }
    &.has-label {
      text-align: left;
      padding: 5px 0 5px 15px;
      clear: both;

      .btn-label {
        @extend .pull-right;
        text-align: center;
        min-width:60px;
        padding: 6px 10px 4px 10px;
        border-radius : 0 3px 3px 0;
        background: rgba($accent-two, .3);
        margin-top: -5px;
      }

      .clip {
        max-width: calc(100% - 75px);
        display: inline-block;
        vertical-align: middle;
      }
    }

    &.more-actions {
        background: lighten($link-color,35);
        &.bg-transparent:hover {
            color: lighten($link-color,20);
        }
        &:focus {
            outline: 0;
        }
        &:hover {
          background: lighten($link-color,10);
        }
    }
}


//icon button
.icon-btn {
    padding: 0;
    display: inline-flex;
    align-items: center;

    &.btn-sm {
      padding: 0;
    }

    .darken {
      padding: 6px 10px 4px 10px;
    }

    span:nth-child(2) {
      padding: 5px 10px 4px 10px;
      margin-top: 1px;
    }
}

.dropdown-menu {
    max-width: 200px;
    &.hidden {
        display: none;
    }
    li {
        a {
            text-decoration: none;
        }
    }
}

//btn sizes
.btn-xs,
.btn-group-xs > .btn,
.btn-xs .btn-label {
    padding: $xs-padding;
    font-size: .65em;
    // line-height: 1.5em;
}

.btn-sm,
.btn-group-sm .btn,
.btn-sm .btn-label {
    padding: $sm-padding;
    font-size: 0.87em;

}
.btn-group-sm .btn {
  margin-left: -3px;
}

.btn-lg,
.btn-group-lg > .btn,
.btn-lg .btn-label {
    padding: $lg-padding;
    font-size: 1.2em;
}

//diabled
.btn-disabled,
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn {
    @extend .bg-disabled;
    cursor: not-allowed;

    &:hover {
      background-color: $bg-disabled!important;
      color: darken($bg-disabled, 30)!important;
    }
}

.btn-disabled-transparent {
  background-color: transparent !important;

  a {
    &:before {
      display: none;
    }

    border-bottom: none;
    padding: 0;
  }
  cursor: not-allowed;

  &:hover {
    background: $bg-disabled;
  }
}

//button group
[class^='btn-group'] {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    padding: 0;


    .btn:first-child {
      border-radius: 2px 0 0 2px;
      margin-left: 2px;
    }

    .btn:not(:first-child) {
      margin-right: 1px;
    }

    .btn:last-child {
      border-radius: 0 2px 2px 0;
    }

     .btn,   .btn-xs{
        position: relative;
        display: inline-block;

      > &:first-child {
          border-radius: 1.5px 0 0 1.5px;
          margin-left: 2px;
      }
      > &:last-child {
          border-radius: 0 1.5px 1.5px 0;
      }

        &.active {
            @extend .bg-primary;
        }
        &:focus {
            z-index: 2;
        }
    }
    &.no-space {

    }
    &.action-menu {
        .btn {
            font-size: .75em;
            margin-left: -6px;
            .dropdown {
                &:first-child {
                    margin-left: 0;
                }
                &:last-child {
                    position: relative;
                    &:before {
                        content: "";
                        background: rgba(0, 0, 0, .5);
                        position: absolute;
                        left: 0;
                        right: 0;
                        bottom: 0;
                        top: 0;
                    }
                }
            }
        }
    }
}

.copy-btn.small {
  color: inherit;
}

.button-toggle {
  .switch input {
    position: absolute;
    opacity: 0;
  }

  .switch {
    display: inline-block;
    font-size: 13px;
    height: 1em;
    width: 2em;
    background: $contrasted-dark-default;
    border-radius: 1em;

    div {
      height: 1em;
      width: 1em;
      border-radius: 1em;
      background: #FFF;
      box-shadow: 0 0.1em 0.3em rgba(0,0,0,0.3);
      -webkit-transition: all 300ms;
      -moz-transition: all 300ms;
      transition: all 300ms;
    }

    input:checked + div {
      background: $healthy-circle-color;
      -webkit-transform: translate3d(100%, 0, 0);
      -moz-transform: translate3d(100%, 0, 0);
      transform: translate3d(100%, 0, 0);
    }
  }

  &.large {
    .switch {
      font-size: 20px;
    }
  }
}
