// This file has lots of modifiers and is somewhat nesty by nature
//sass-lint:disable nesting-depth

.euiButton {
  // sass-lint:disable no-important
  // remove for all states
  box-shadow: none !important;

  // Added exclusion of the `ghost` type of button
  // so as not to override those specific styles from default theme
  // And the only style that needs to change is the non-filled version
  &.euiButton-isDisabled:not(.euiButton--ghost) {
    &,
    &:hover {
      $backgroundColorSimulated: mix($euiPageBackgroundColor, $euiButtonColorDisabled, 90%);
      background-color: transparentize($euiButtonColorDisabled, .9);
      color: makeDisabledContrastColor($euiButtonColorDisabled, $backgroundColorSimulated);
    }
  }
}

.euiButton--small {
  // Use a moderately smaller radius on small buttons
  // so that they don't appear completely rounded
  border-radius: $euiBorderRadius * (2 / 3);
}

// Change the hollow (bordered) buttons to have a transparent background
// and no border
@each $name, $color in $euiButtonTypes {
  .euiButton--#{$name} {
    @include euiButtonDefaultStyle($color);

    @if ($name == 'ghost') {
      // Ghost is unique and ALWAYS sits against a dark background.
      $backgroundColorSimulated: mix($euiColorInk, $color, 70%);
      color: makeHighContrastColor($color, $backgroundColorSimulated);
    } @else {
      &.euiButton--fill:focus {
        outline-color: lightOrDarkTheme($euiColorInk, $euiColorGhost);
      }
    }

    &.euiButton--fill:not([class*='isDisabled']) {
      color: chooseLightOrDarkText($color, $euiColorGhost, $euiColorInk);

      &,
      &:hover,
      &:focus {
        background-color: $color;
      }
    }
  }
}

// Fix ghost/disabled look specifically
.euiButton.euiButton-isDisabled.euiButton--ghost,
// adding fill type to override default theme
.euiButton.euiButton-isDisabled.euiButton--ghost.euiButton--fill {
  &,
  &:focus {
    color: $euiButtonColorGhostDisabled;
    background-color: transparentize($euiButtonColorGhostDisabled, .9);
  }
}
