@use './variables';

nw-toasts {
    inset: unset;
    margin: 0;
    border: 0;
    background: transparent;
    padding: 0;
}

.toasts-container {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: variables.$zindex-toast;
}
.toast {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    position: relative;
    margin: 8px auto;
    padding: 16px 24px;
    max-width: 500px;
    background: variables.get-color('gray', light);
    color: #ffffff;
    border-radius: 5px;

    &.toast-success {
        background: variables.get-color('secondary', base);
        .toast-icon {
            font-weight: normal;
        }
    }
    &.toast-error {
        background: variables.get-color('tertiary', base);
    }
    .toast-message {
        flex: 1;
        margin: 0;
        line-height: 1.2;
        font-size: 16px;
        font-weight: 600;
    }
    .toast-icon {
        font-size: 16px;
        margin-right: 16px;
        top: 1px;
        position: relative;
    }
    .close-button {
        position: relative;
        right: -12px;
        top: 1px;
        color: #ffffff;
        padding-right: 8px;
    }
    &.size-sm {
        padding: 8px 16px;

        .toast-message {
            font-size: 14px;
            font-weight: normal;
        }
        .toast-icon {
            font-size: 14px;
            margin-right: 12px;
        }
        .close-button {
            right: -6px;
            top: 0px;
            margin-left: 4px;
        }
    }
}

.toast-animate-in {
    animation: toast-slide-in 0.6s cubic-bezier(0.68, 0, 0.265, 1.75) forwards;
}

.toast-animate-out {
    animation: toast-slide-out 0.8s linear forwards;
}

@keyframes toast-slide-in {
    0% {
        opacity: 0;
        transform: translate3d(0, -100px, 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes toast-slide-out {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    80% {
        opacity: 0;
        top: 0;
        transform: translate3d(0, -500px, 0);
    }
    100% {
        opacity: 0;
        height: 0;
        transform: translate3d(0, -500px, 0);
    }
}
