@import "../mixins.scss";

// CONTAINER
.hm-notifications-container {
    box-sizing: border-box;
    position: fixed;
    width: 450px;
    padding: var(--hm-section-padding);
    pointer-events: none;

    &.hm-notifications-container-top-left {
        left: 0;
        top: 0;
    }

    &.hm-notifications-container-top-right {
        right: 0;
        top: 0;
    }

    &.hm-notifications-container-bottom-left {
        left: 0;
        bottom: 0;
    }

    &.hm-notifications-container-bottom-right {
        right: 0;
        bottom: 0;
    }
}

@media only screen and (max-width: 550px) {
    .hm-notifications-container {
        width: calc(100vw - 35px);
    }
}

// NOTIFICATION
.hm-notification {
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    pointer-events: all;

    font-size: var(--hm-font-size);
    font-family: var(--hm-font-family);

    margin-bottom: var(--hm-flex-gap);
    padding: var(--hm-section-padding);
    border-radius: var(--hm-section-border-radius);

    display: flex;
    gap: var(--hm-flex-gap);
    align-items: center;

    &.hm-thwhite {
        background-color: var(--hm-thwhite-section-bg-color);
        color: var(--hm-thwhite-font-color-contrast);
        box-shadow: var(--hm-component-shadow);
    }

    &.hm-thblack {
        background-color: var(--hm-thblack-section-bg-color);
        color: var(--hm-thblack-font-color-contrast);
        box-shadow: var(--hm-component-shadow);
    }

    &.hm-notification-show {
        animation-duration: 0.3s;
    }

    &.hm-destination-top-left,
    &.hm-destination-bottom-left {
        &:only-child {
            &.hm-notification-show {
                animation-name: hm-notification-show-first-element-left;
            }
        }

        &:not(:only-child) {
            &.hm-notification-show {
                animation-name: hm-notification-show-subsequent-elements-left;
            }
        }
    }

    &.hm-destination-top-right,
    &.hm-destination-bottom-right {
        &:only-child {
            &.hm-notification-show {
                animation-name: hm-notification-show-first-element-right;
            }
        }

        &:not(:only-child) {
            &.hm-notification-show {
                animation-name: hm-notification-show-subsequent-elements-right;
            }
        }
    }

    &.hm-notification-close {
        animation-name: hm-notification-close;
        animation-duration: 0.3s;
        animation-fill-mode: forwards;
    }

    .hm-text-container {
        flex: 100;
        max-height: 100px;
        overflow-y: scroll;

        @include hideScrollbars;

        p {
            margin: 0;
            font-size: var(--hm-text-font-size);

            &.hm-description {
                font-size: var(--hm-description-font-size);
                margin-top: 2px;
            }
        }
    }
}

// ANIMATIONS FOR LEFT SIDE
@keyframes hm-notification-show-first-element-left {
    0% {
        opacity: 0;
        translate: -50% 0%;
    }

    100% {
        opacity: 1;
        translate: 0% 0%;
    }
}

@keyframes hm-notification-show-subsequent-elements-left {
    0% {
        opacity: 0;
        height: 0px;
        padding-top: 0;
        padding-bottom: 0;
        translate: -50% 50%;
    }

    100% {
        opacity: 1;
        height: min(120px, calc(var(--hm-text-height) + 2 * var(--hm-section-padding)));
        translate: 0% 0%;
    }
}

// ANIMATIONS FOR RIGHT SIDE
@keyframes hm-notification-show-first-element-right {
    0% {
        opacity: 0;
        translate: 50% 0%;
    }

    100% {
        opacity: 1;
        translate: 0% 0%;
    }
}

@keyframes hm-notification-show-subsequent-elements-right {
    0% {
        opacity: 0;
        height: 0px;
        padding-top: 0;
        padding-bottom: 0;
        translate: 50% 50%;
    }

    100% {
        opacity: 1;
        height: min(120px, calc(var(--hm-text-height) + 2 * var(--hm-section-padding)));
        translate: 0% 0%;
    }
}

// CLOSE ANIMATION
@keyframes hm-notification-close {
    0% {
        opacity: 1;
        height: min(120px, calc(var(--hm-text-height) + 2 * var(--hm-section-padding)));
    }

    100% {
        opacity: 0;
        height: 0px;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}
