/**
 * 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
// --------------------------------------------------
// Button styles

$CommandButton-height: 40px;
$CommandButton-md-height: 44px;
$CommandButton-padding: 8px;
$CommandButtonIcon-size: 16px;
$CommandButtonIcon-md-size: 20px;

.ms-CommandButton {
  @include ms-baseFont;
  display: inline-block;
  position: relative;
  vertical-align: top;

  &.is-hidden {
    display: none;
  }

  &:disabled,
  &.is-disabled {
    .ms-CommandButton-button {
      cursor: default;

      &:hover {
        background-color: $ms-color-themeLighterAlt;
      }

      .ms-CommandButton-label {
        color: $ms-color-neutralTertiary;
      }

      .ms-CommandButton-icon {
        color: $ms-color-neutralTertiary;
      }
    }
  }

  .ms-ContextualMenu {
    display: none;
  }
}

//== Mixins: Base button, focus, and icon alignments
//
@mixin ms-CommandButton-iconBase {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@mixin ms-CommandBar-focusRectangle {
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 1px solid $ms-color-neutralPrimary;
  position: absolute;
  z-index: 10;
  content: '';
  outline: none;
}

@mixin ms-CommandBarButton-buttonBase {
  @include ms-u-normalize;
  color: $ms-color-neutralPrimary;
  font-size: $ms-font-size-m;
  font-weight: $ms-font-weight-regular;
  // background-color: $ms-color-themeLighterAlt;
  // border: 1px solid $ms-color-themeLighterAlt;
  cursor: pointer;
  display: inline-block;
  height: $CommandButton-height;
  line-height: $CommandButton-height;
  outline: 1px solid transparent;
  padding: 0 $CommandButton-padding;
  position: relative;
  vertical-align: top;
  background: transparent;

  &:hover {
    background-color: $ms-color-neutralLight;

    .ms-CommandButton-label {
      color: $ms-color-neutralDark;
    }
  }

  &:active {
    background-color: $ms-color-neutralLight;
  }

  &:focus::before {
    @include ms-CommandBar-focusRectangle;
  }

  &:focus {
    outline: 0;
  }

  @media only screen and (max-width: $ms-screen-md-max) {
    height: $CommandButton-md-height;

    .ms-CommandButton-icon {
      font-size: $CommandButtonIcon-md-size;
    }

    .ms-CommandButton-label {
      line-height: $CommandButton-md-height;
    }
  }
}

.ms-CommandButton-button,
.ms-CommandButton-splitIcon {
  @include ms-CommandBarButton-buttonBase;
}

.ms-CommandButton-button {
  border: 0;
  margin: 0;
}

// Add space between adjacent command buttons.
.ms-CommandButton + .ms-CommandButton {
  margin-left: 8px;

  @media only screen and (max-width: $ms-screen-md-max) {
    margin-left: 4px;
  }
}

.ms-CommandButton-icon {
  display: inline-block;
  margin-right: $CommandButton-padding;
  position: relative;
  font-size: $CommandButtonIcon-size;
  min-width: 16px;
  height: 100%;

  .ms-Icon {
    @include ms-CommandButton-iconBase;
  }
}

.ms-CommandButton-label {
  font-size: $ms-font-size-m;
  font-weight: $ms-font-weight-regular;
  color: $ms-color-neutralPrimary;
  line-height: $CommandButton-height;
  height: 100%;
  display: inline-block;
  vertical-align: top;

  &:hover {
    color: $ms-color-neutralDark;
  }
}

.ms-CommandButton-dropdownIcon,
.ms-CommandButton-splitIcon {
  display: inline-block;
  position: relative;
  color: $ms-color-neutralPrimary;
  font-size: $ms-font-size-s;
  font-weight: $ms-font-weight-semilight;
  min-width: 12px;
  height: 100%;
  vertical-align: top;
  margin-left: 8px;

  .ms-Icon {
    line-height: normal;
    padding-top: $CommandButton-padding * 2;
  }

  &:focus::before {
    @include ms-CommandBar-focusRectangle;
  }

  @media only screen and (max-width: $ms-screen-md-max) {
    display: none;
  }
}

.ms-CommandButton-splitIcon {
  margin-left: -2px;
  width: 27px;
  border: 0;

  .ms-Icon {
    margin-left: -1px;
    position: relative;
    padding-top: 16px;

    &::after {
      position: absolute;
      content: ' ';
      width: 1px;
      height: 16px;
      top: 12px;
      left: -8px;
      border-left: 1px solid $ms-color-neutralTertiaryAlt;
    }
  }
}

//= Modifier: No Label modifier
//
.ms-CommandButton.ms-CommandButton--noLabel {
  .ms-CommandButton-icon {
    margin-right: 0;
  }

  .ms-CommandButton-label {
    display: none;
  }

  .ms-CommandButton-button {
    padding: 0 12px;
  }
}

//= Modifier: Inline modifier
//
.ms-CommandButton.ms-CommandButton--inline {
  .ms-CommandButton-button {
    background: none;
  }
}

//= Modifier: Action Button modifier
//
.ms-CommandButton.ms-CommandButton--actionButton {
  .ms-CommandButton-button {
    width: 50px;
    height: $CommandButton-height;
  }

  .ms-CommandButton-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    padding-right: 0;
  }
}

@mixin ms-CommandButton-pivotLine {
  content: '';
  height: 2px;
  position: absolute;
  left: 0;
  right: 0;
  background-color: $ms-color-themePrimary;
  bottom: 0;
  z-index: $ms-zIndex-middle;
}

//= Modifier: Pivot Button modifier
//
.ms-CommandButton.ms-CommandButton--pivot {

  &.is-active::before {
    @include ms-CommandButton-pivotLine;
  }

  &:hover {
    &::before {
      @include ms-CommandButton-pivotLine;
    }
  }
}

.ms-CommandButton.ms-CommandButton--textOnly,
.ms-CommandButton.ms-CommandButton--pivot {

  .ms-CommandButton-label {
    display: inline-block;

    @media only screen and (max-width: $ms-screen-sm-max) {
      font-size: 16px;
    }
  }
}
