/* @docs */
$notification-close-btn-position: 1rem !default;
$notification-notices-padding: 2em !default;
$notification-notices-zindex: $zindex-toast !default;
$notification-notices-max-width: 600px !default;
$notification-notices-space: 1.5rem !default;
$notification-icon-margin-right: 0.5rem !default;
/* @docs */

/* @bootstrap docs */
// $alert-padding-y:               $spacer;
// $alert-padding-x:               $spacer;
// $alert-margin-bottom:           1rem;
// $alert-border-radius:           var(--#{$prefix}border-radius);
// $alert-link-font-weight:        $font-weight-bold;
// $alert-border-width:            var(--#{$prefix}border-width);
// $alert-bg-scale:                -80%;
// $alert-border-scale:            -70%;
// $alert-color-scale:             40%;
// $alert-dismissible-padding-r:   $alert-padding-x * 3; // 3x covers width of x plus default padding on either side
/* @bootstrap docs */

/* @bootstrap docs */
// $toast-max-width:                   350px;
// $toast-padding-x:                   .75rem;
// $toast-padding-y:                   .5rem;
// $toast-font-size:                   .875rem;
// $toast-color:                       null;
// $toast-background-color:            rgba(var(--#{$prefix}body-bg-rgb), .85);
// $toast-border-width:                var(--#{$prefix}border-width);
// $toast-border-color:                var(--#{$prefix}border-color-translucent);
// $toast-border-radius:               var(--#{$prefix}border-radius);
// $toast-box-shadow:                  var(--#{$prefix}box-shadow);
// $toast-spacing:                     $container-padding-x;

// $toast-header-color:                var(--#{$prefix}secondary-color);
// $toast-header-background-color:     rgba(var(--#{$prefix}body-bg-rgb), .85);
// $toast-header-border-color:         $toast-border-color;
/* @bootstrap docs */

.notifictation {
    display: flex;

    .icon {
        margin-right: $notification-icon-margin-right;
    }

    .notifictation-wrapper:has(+ .btn-close) {
        padding-right: calc(
            $notification-close-btn-position + $alert-padding-x
        );
    }
}

.alert {
    & > button {
        background-color: transparent;
        border: 0;
        position: absolute;
        top: $notification-close-btn-position;
        right: $notification-close-btn-position;
    }

    // Colors variants
    @each $name, $color in $theme-colors {
        &.variant-#{$name} {
            @extend .alert-#{$name};

            > .btn-close {
                filter: unset;
            }
        }
    }

    // default color variant light
    &:not([class*="variant-"]) {
        @extend .alert-light;
    }
}

.toast {
    @extend .show;
    padding: var(--#{$prefix}toast-padding-x) var(--#{$prefix}toast-padding-y);
    margin-bottom: var(--#{$prefix}alert-margin-bottom);

    // Color variants
    @each $name, $color in $theme-colors {
        &.variant-#{$name} {
            --#{$prefix}toast-color: var(--#{$prefix}#{$name}-contrast);
            --#{$prefix}toast-bg: var(--#{$prefix}#{$name});
        }
    }
}

.notifictations {
    --#{$prefix}notification-notices-padding: #{$notification-notices-padding};
    --#{$prefix}notification-notices-zindex: #{$notification-notices-zindex};
    --#{$prefix}notification-notices-max-width: #{$notification-notices-max-width};

    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    pointer-events: none;
    padding: var(--#{$prefix}notification-notices-padding);
    z-index: var(--#{$prefix}notification-notices-zindex);

    .alert {
        pointer-events: auto;
        max-width: var(--#{$prefix}notification-notices-max-width);

        &.position {
            &-top,
            &-bottom {
                align-self: center;
            }

            &-top-right,
            &-bottom-right {
                align-self: flex-end;
            }

            &-top-left,
            &-bottom-left {
                align-self: flex-start;
            }
        }
    }

    &.position {
        &-top {
            flex-direction: column;
        }

        &-bottom {
            flex-direction: column-reverse;

            > .div:first-child {
                margin-bottom: 0;
            }
        }
    }
}
