// 
// buttons.scss
//

// Button shadow

@mixin button-shadow($color) {
    box-shadow: $btn-box-shadow rgba($color, 0.5);
}

// Button Shadows
@each $color, $value in $theme-colors {
    .btn-#{$color} {
        @include button-shadow($value);
    }
}

.btn {
    .mdi {
        &:before {
            margin-top: -1px;
        }
    }

    i {
        display: inline-block;
    }
}

//
// light button
// 
.btn-light,
.btn-white {
    color: #{map-get($grays, "900")};
}

.btn-white {
    border-color: #{map-get($grays, "300")};

    &:hover, &:focus{
        background-color: #{map-get($grays, "100")};
        border-color: #{map-get($grays, "100")};
    }

    &:focus,
    &.focus {
        box-shadow: 0 0 0 $btn-focus-width #{rgba(map-get($grays, "300"), .3)};
    }
}

//
// Link buttons
//
// Make a button look and behave like a link
.btn-link {
    font-weight: $font-weight-normal;
    color: $link-color;
    background-color: transparent;
    &:hover {
        color: $link-hover-color;
        text-decoration: $link-hover-decoration;
        background-color: transparent;
        border-color: transparent;
    }
    &:focus,
    &.focus {
        text-decoration: $link-hover-decoration;
        border-color: transparent;
        box-shadow: none;
    }
    &:disabled,
    &.disabled {
        color: $btn-link-disabled-color;
        pointer-events: none;
    } // No need for an active state here
} 
//
// Alternate buttons
//
@each $color,
$value in $theme-colors {
    .btn-outline-#{$color} {
        @include button-outline-variant($value);
    }
}

// 
// Button labels
//

.btn-label {
    margin: -.55rem .9rem -.55rem -.9rem;
    padding: .6rem .9rem;
    background-color: #{rgba(map-get($grays, "900"),0.1)};
}

.btn-label-right {
    margin: (-$btn-padding-y) (-$btn-padding-x) (-$btn-padding-y) ($btn-padding-x);
    padding: ($btn-padding-y) ($btn-padding-x);
    background-color: #{rgba(map-get($grays, "900"),0.1)};
    display: inline-block;
}

// 
// Button Extra Small Size
// 

.btn-xs {
    padding: .2rem .6rem;
    font-size: .75rem;
    border-radius: .15rem;
}

//
// Soft Buttons
// 

@mixin button-variant-soft($bg) {
    color: $bg;
    background-color: rgba($bg, 0.18);
    border-color: rgba($bg, 0.12);

    &:hover {
        color: $white;
        background-color: $bg;
    }

    &:focus,
    &.focus {
        box-shadow: 0 0 0 $btn-focus-width rgba($bg, .3);
    }
}

@each $color, $value in $theme-colors {
    .btn-soft-#{$color} {
        @include button-variant-soft($value);
    }
  }


// btn bordered

@mixin button-bordered-variant($bg) {
    background-color: $bg;
    color: $white !important;
    border-bottom: 2px solid darken($bg, 7%);
}

@each $color, $value in $theme-colors {
    .btn-bordered-#{$color} {
      @include button-bordered-variant($value);
    }
}

.btn-bordered-dark {
    color: #{map-get($grays, "200")} !important;
}


// dark mode
body[data-layout-color="dark"] {
    // .btn-light,
    // .btn-white {
    //     color: #{map-get($dark-grays, "800")};
    //     background-color: #{map-get($dark-grays, "300")};
    //     border-color: #{map-get($dark-grays, "300")};
    // }

    // .btn-white {
    //     border-color: #{map-get($dark-grays, "300")};

    //     &:hover, &:focus{
    //         background-color: #{map-get($dark-grays, "300")};
    //         border-color: #{map-get($dark-grays, "300")};
    //     }

    //     &:focus,
    //     &.focus {
    //         box-shadow: 0 0 0 $btn-focus-width #{rgba(map-get($dark-grays, "300"), .3)};
    //     }
    // }
    .btn-label {
        background-color: #{rgba(map-get($dark-grays, "800"),0.1)};
    }
    
    .btn-label-right {
        background-color: #{rgba(map-get($dark-grays, "800"),0.1)};
    }
    .btn-bordered-dark {
        color: #{map-get($dark-grays, "200")} !important;
    }
    @each $color, $value in $dark-theme-colors {
        .btn-#{$color} {
            @include button-shadow($value);
        }
        .btn-outline-#{$color} {
            @include button-outline-variant($value);
        }
        .btn-soft-#{$color} {
            @include button-variant-soft($value);
        }
        .btn-bordered-#{$color} {
            @include button-bordered-variant($value);
        }
    }

    .btn-light,
    .btn-white {
        background-color: #{map-get($dark-grays, "300")};
        border-color: #{map-get($dark-grays, "300")};
        color: #{map-get($dark-grays, "900")};
    }
    .btn-dark {
        background-color: #{map-get($dark-grays, "900")};
        border-color: #{map-get($dark-grays, "900")};
        color: #{map-get($dark-grays, "100")};
    }
    .btn-secondary {
        background-color: #{map-get($dark-grays, "400")};
        border-color: #{map-get($dark-grays, "400")};
        color: #{map-get($dark-grays, "900")};
    }

    .btn-outline-light {
        border-color: #{map-get($dark-grays, "300")};
        color: #{map-get($dark-grays, "300")};
        &:hover,
        &.active,
        &:active,
        &:focus {
                color: #{map-get($dark-grays, "900")} !important;
                background-color: #{map-get($dark-grays, "300")};
        }
    }
    .btn-outline-dark {
        border-color: #{map-get($dark-grays, "900")};
        color: #{map-get($dark-grays, "900")};
        &:hover,
        &.active,
        &:active,
        &:focus {
                color: #{map-get($dark-grays, "100")} !important;
                background-color: #{map-get($dark-grays, "900")};
        }
    }
    .btn-outline-secondary {
        border-color: #{map-get($dark-grays, "400")};
        color: #{map-get($dark-grays, "400")};
        &:hover,
        &.active,
        &:active,
        &:focus {
                color: #{map-get($dark-grays, "300")} !important;
                background-color: #{map-get($dark-grays, "400")};
        }
    }
}



