// Inspired by Bootstrap's button system but extended with more variants

// Soft buttons

// scss-docs-start btn-variant-loops
@each $color, $value in $theme-colors {
    $bg: tint-color($value, 80%);
    $text-color: shade-color($value, 60%);

    .blue-btn-soft-#{$color} {
        @if $color == "light" {
            $text-color: color-contrast($value);
        }

        @include button-variant(
            $bg,
            $bg,
            $text-color,
            $hover-background: shade-color($bg, $btn-hover-bg-shade-amount),
            $hover-border: shade-color($bg, $btn-hover-border-shade-amount),
            $active-background: shade-color($bg, $btn-active-bg-shade-amount),
            $active-border: shade-color($bg, $btn-active-border-shade-amount)
        );
    }
}

@include color-mode(dark) {
    @each $color, $value in $theme-colors {
        $bg: shade-color($value, 80%);
        $text-color: tint-color($value, 60%);

        .blue-btn-soft-#{$color} {
            @if $color == "dark" {
                $text-color: color-contrast($value);
            }

            @include button-variant(
                $bg,
                $bg,
                $text-color,
                $hover-background: tint-color($bg, $btn-hover-bg-tint-amount),
                $hover-border: tint-color($bg, $btn-hover-border-tint-amount),
                $active-background: tint-color($bg, $btn-active-bg-tint-amount),
                $active-border: tint-color($bg, $btn-active-border-tint-amount)
            );
        }
    }
}

// Plain buttons

// scss-docs-start btn-variant-loops
@each $color, $value in $theme-colors {
    $bg: tint-color($value, 80%);
    $text-color: $value;

    $active-background: if(
        $color == $color-contrast-light,
        shade-color($value, $btn-active-bg-shade-amount),
        tint-color($value, $btn-active-bg-tint-amount)
    );

    .blue-btn-plain-#{$color} {
        &:not(:hover) {
            box-shadow: none;
            background-image: none;
        }

        @if $color == "light" {
            $text-color: color-contrast($value);
        }

        // More contrast for secondary plain button
        @if $color == "secondary" {
            $text-color: shade-color($value, 60%);
        }

        @include button-variant(
            transparent,
            transparent,
            $text-color,
            $hover-background: tint-color($value, 80%),
            $hover-border: tint-color($value, 80%),
            $hover-color: if($color == "light", color-contrast($value), shade-color($value, 60%)),
            $active-background: shade-color($bg, $btn-hover-bg-shade-amount),
            $active-border: shade-color($bg, $btn-hover-border-shade-amount),
            $disabled-background: transparent,
            $disabled-border: transparent,
            $disabled-color: $text-color
        );
    }
}

@include color-mode(dark) {
    @each $color, $value in $theme-colors {
        $bg: shade-color($value, 80%);
        $text-color: tint-color($value, 40%);

        .blue-btn-plain-#{$color} {
            @if $color == "dark" {
                $text-color: color-contrast($value);
            }

            // More contrast for secondary plain button
            @if $color == "secondary" {
                $text-color: tint-color($value, 60%);
            }

            @include button-variant(
                transparent,
                transparent,
                $text-color,
                $hover-background: tint-color($bg, $btn-hover-bg-tint-amount),
                $hover-border: tint-color($bg, $btn-hover-border-tint-amount),
                $active-background: tint-color($bg, $btn-active-bg-tint-amount),
                $active-border: tint-color($bg, $btn-active-border-tint-amount)
            );
        }
    }
}
