@import "../../themes/ionic.globals.ios";

// iOS Button
// --------------------------------------------------

// deprecated
$button-ios-margin:                                 null !default;

/// @prop - Margin top of the button
$button-ios-margin-top:                             .4rem !default;

/// @prop - Margin end of the button
$button-ios-margin-end:                             .2rem !default;

/// @prop - Margin bottom of the button
$button-ios-margin-bottom:                          .4rem !default;

/// @prop - Margin start of the button
$button-ios-margin-start:                           .2rem !default;

// deprecated
$button-ios-padding:                                null !default;

/// @prop - Padding top of the button
$button-ios-padding-top:                            0 !default;

/// @prop - Padding end of the button
$button-ios-padding-end:                            1em !default;

/// @prop - Padding bottom of the button
$button-ios-padding-bottom:                         $button-ios-padding-top !default;

/// @prop - Padding start of the button
$button-ios-padding-start:                          $button-ios-padding-end !default;

/// @prop - Height of the button
$button-ios-height:                                 2.8em !default;

/// @prop - Border radius of the button
$button-ios-border-radius:                          4px !default;

/// @prop - Font size of the button text
$button-ios-font-size:                              1.6rem !default;

/// @prop - Background color of the button
$button-ios-background-color:                       color($colors-ios, primary) !default;

/// @prop - Text color of the button
$button-ios-text-color:                             color-contrast($colors-ios, $button-ios-background-color) !default;

/// @prop - Background color of the activated button
$button-ios-background-color-activated:             color-shade($button-ios-background-color) !default;

/// @prop - Opacity of the activated button
$button-ios-opacity-activated:                      1 !default;

/// @prop - Opacity of the button on hover
$button-ios-opacity-hover:                          .8 !default;


// iOS Large Button
// --------------------------------------------------

// deprecated
$button-ios-large-padding:                          null !default;

/// @prop - Padding top of the large button
$button-ios-large-padding-top:                      0 !default;

/// @prop - Padding end of the large button
$button-ios-large-padding-end:                      1em !default;

/// @prop - Padding bottom of the large button
$button-ios-large-padding-bottom:                   $button-ios-large-padding-top !default;

/// @prop - Padding start of the large button
$button-ios-large-padding-start:                    $button-ios-large-padding-end !default;

/// @prop - Height of the large button
$button-ios-large-height:                           2.8em !default;

/// @prop - Font size of the large button
$button-ios-large-font-size:                        2rem !default;


// iOS Small Button
// --------------------------------------------------

// deprecated
$button-ios-small-padding:                          null !default;

/// @prop - Padding top of the small button
$button-ios-small-padding-top:                      0 !default;

/// @prop - Padding end of the small button
$button-ios-small-padding-end:                      .9em !default;

/// @prop - Padding bottom of the small button
$button-ios-small-padding-bottom:                   $button-ios-small-padding-top !default;

/// @prop - Padding start of the small button
$button-ios-small-padding-start:                    $button-ios-small-padding-end !default;

/// @prop - Height of the small button
$button-ios-small-height:                           2.1em !default;

/// @prop - Font size of the small button
$button-ios-small-font-size:                        1.3rem !default;

/// @prop - Font size of an icon in the small button
$button-ios-small-icon-font-size:                   1.3em !default;


// iOS Outline Button
// --------------------------------------------------

/// @prop - Border width of the outline button
$button-ios-outline-border-width:                   1px !default;

/// @prop - Border style of the outline button
$button-ios-outline-border-style:                   solid !default;

/// @prop - Border radius of the outline button
$button-ios-outline-border-radius:                  $button-ios-border-radius !default;

/// @prop - Border color of the outline button
$button-ios-outline-border-color:                   $button-ios-background-color !default;

/// @prop - Text color of the outline button
$button-ios-outline-text-color:                     $button-ios-background-color !default;

/// @prop - Background color of the outline button
$button-ios-outline-background-color:               transparent !default;

/// @prop - Text color of the activated outline button
$button-ios-outline-text-color-activated:           color-contrast($colors-ios, $button-ios-background-color) !default;

/// @prop - Background color of the activated outline button
$button-ios-outline-background-color-activated:     $button-ios-background-color !default;

/// @prop - Opacity of the activated outline button
$button-ios-outline-opacity-activated:              1 !default;


// iOS Clear Button
// --------------------------------------------------

/// @prop - Border color of the clear button
$button-ios-clear-border-color:                     transparent !default;

/// @prop - Background color of the clear button
$button-ios-clear-background-color:                 transparent !default;

/// @prop - Background color of the activated clear button
$button-ios-clear-background-color-activated:       $button-ios-clear-background-color !default;

/// @prop - Opacity of the activated clear button
$button-ios-clear-opacity-activated:                .4 !default;

/// @prop - Text color of the clear button on hover
$button-ios-clear-text-color-hover:                 $button-ios-background-color !default;

/// @prop - Opacity of the clear button on hover
$button-ios-clear-opacity-hover:                    .6 !default;


// iOS Round Button
// --------------------------------------------------

// deprecated
$button-ios-round-padding:                          null !default;

/// @prop - Padding top of the round button
$button-ios-round-padding-top:                      $button-round-padding-top !default;

/// @prop - Padding end of the round button
$button-ios-round-padding-end:                      $button-round-padding-end !default;

/// @prop - Padding bottom of the round button
$button-ios-round-padding-bottom:                   $button-round-padding-bottom !default;

/// @prop - Padding start of the round button
$button-ios-round-padding-start:                    $button-round-padding-start !default;

/// @prop - Border radius of the round button
$button-ios-round-border-radius:                    $button-round-border-radius !default;


// iOS Decorator Button
// --------------------------------------------------

/// @prop - Font weight of the strong button
$button-ios-strong-font-weight:                     600 !default;


// iOS Default Button
// --------------------------------------------------

.button-ios {
  @include border-radius($button-ios-border-radius);

  height: $button-ios-height;

  font-size: $button-ios-font-size;

  color: $button-ios-text-color;
  background-color: $button-ios-background-color;

  @include deprecated-variable(margin, $button-ios-margin) {
    @include margin($button-ios-margin-top, $button-ios-margin-end, $button-ios-margin-bottom, $button-ios-margin-start);
  }

  @include deprecated-variable(padding, $button-ios-padding) {
    @include padding($button-ios-padding-top, $button-ios-padding-end, $button-ios-padding-bottom, $button-ios-padding-start);
  }
}

.button-ios.activated {
  background-color: $button-ios-background-color-activated;
  opacity: $button-ios-opacity-activated;
}

.button-ios:hover:not(.disable-hover) {
  opacity: $button-ios-opacity-hover;
}


// iOS Default Button Color Mixin
// --------------------------------------------------

@mixin ios-button-default($color-name, $color-base, $color-contrast) {
  $bg-color: $color-base;
  $bg-color-activated: color-shade($bg-color);
  $fg-color: $color-contrast;

  .button-ios-#{$color-name} {
    color: $fg-color;
    background-color: $bg-color;
  }

  .button-ios-#{$color-name}.activated {
    background-color: $bg-color-activated;
  }
}


// iOS Button Sizes
// --------------------------------------------------

.button-large-ios {
  height: $button-ios-large-height;

  font-size: $button-ios-large-font-size;

  @include deprecated-variable(padding, $button-ios-large-padding) {
    @include padding($button-ios-large-padding-top, $button-ios-large-padding-end, $button-ios-large-padding-bottom, $button-ios-large-padding-start);
  }
}

.button-small-ios {
  height: $button-ios-small-height;

  font-size: $button-ios-small-font-size;

  @include deprecated-variable(padding, $button-ios-small-padding) {
    @include padding($button-ios-small-padding-top, $button-ios-small-padding-end, $button-ios-small-padding-bottom, $button-ios-small-padding-start);
  }
}

.button-small-ios[icon-only] ion-icon {
  font-size: $button-ios-small-icon-font-size;
}

// iOS Block Button
// --------------------------------------------------

.button-block-ios {
  @include margin-horizontal(0);
}

// iOS Full Button
// --------------------------------------------------

.button-full-ios {
  @include margin-horizontal(0);
  @include border-radius(0);

  border-right-width: 0;
  border-left-width: 0;
}

// iOS Outline Button
// --------------------------------------------------

.button-outline-ios {
  @include border-radius($button-ios-outline-border-radius);

  border-width: $button-ios-outline-border-width;
  border-style: $button-ios-outline-border-style;
  border-color: $button-ios-outline-border-color;
  color: $button-ios-outline-text-color;
  background-color: $button-ios-outline-background-color;
}

.button-outline-ios.activated {
  color: $button-ios-outline-text-color-activated;
  background-color: $button-ios-outline-background-color-activated;
  opacity: $button-ios-outline-opacity-activated;
}

// iOS Outline Button Color Mixin
// --------------------------------------------------

@mixin ios-button-outline($color-name, $color-base, $color-contrast) {

  .button-outline-ios-#{$color-name} {
    border-color: $color-base;
    color: $color-base;
    background-color: $button-ios-outline-background-color;
  }

  .button-outline-ios-#{$color-name}.activated {
    color: $color-contrast;
    background-color: $color-base;
  }

}


// iOS Clear Button
// --------------------------------------------------

.button-clear-ios {
  border-color: $button-ios-clear-border-color;
  color: $button-ios-background-color;
  background-color: $button-ios-clear-background-color;
}

.button-clear-ios.activated {
  background-color: $button-ios-clear-background-color-activated;
  opacity: $button-ios-clear-opacity-activated;
}

.button-clear-ios:hover:not(.disable-hover) {
  color: $button-ios-clear-text-color-hover;
  opacity: $button-ios-clear-opacity-hover;
}


// iOS Clear Button Color Mixin
// --------------------------------------------------

@mixin ios-button-clear($color-name, $color-base, $color-contrast) {
  $fg-color: $color-base;

  .button-clear-ios-#{$color-name} {
    border-color: $button-ios-clear-border-color;
    color: $fg-color;
    background-color: $button-ios-clear-background-color;
  }

  .button-clear-ios-#{$color-name}.activated {
    opacity: $button-ios-clear-opacity-activated;
  }

  .button-clear-ios-#{$color-name}:hover:not(.disable-hover) {
    color: $fg-color;
  }
}


// iOS Round Button
// --------------------------------------------------

.button-round-ios {
  @include border-radius($button-ios-round-border-radius);

  @include deprecated-variable(padding, $button-ios-round-padding) {
    @include padding($button-ios-round-padding-top, $button-ios-round-padding-end, $button-ios-round-padding-bottom, $button-ios-round-padding-start);
  }
}


// Generate iOS Button Colors
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
  @include ios-button-default($color-name, $color-base, $color-contrast);
  @include ios-button-outline($color-name, $color-base, $color-contrast);
  @include ios-button-clear($color-name, $color-base, $color-contrast);
}


// iOS strong Button
// --------------------------------------------------

.button-strong-ios {
  font-weight: $button-ios-strong-font-weight;
}
