$prefix: 'notification';
$size-notification-content: 400px;

:global(.#{$prefix}) {
    --space-xs: 8px;
    --close-width: 32px;
    --close-icon-width: 16px;
    --color-close-icon: #787878;

    position: fixed;
    z-index: 1001;

    :global(.#{$prefix}-notice) {
        position: relative;
        display: block;
        margin: var(--space-xs);

        :global(.#{$prefix}-notice-close) {
            position: absolute;
            top: 0;
            right: var(--space-xs);
            z-index: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            width: var(--close-width);
            height: calc(var(--close-width) + var(--close-icon-width));
            margin-left: auto;
            color: var(--color-close-icon);
            cursor: pointer;

            svg {
                width: var(--close-icon-width);
                height: auto;
                transition: transform 0.16s;
            }

            &:focus,
            &:hover {
                svg {
                    transform: scale(1.1);
                }
            }
        }
    }
}

:global {
    .#{$prefix}-fade {
        overflow: hidden;
        transition: all 0.3s;
    }

    .#{$prefix}-fade-appear,
    .#{$prefix}-fade-enter,
    .#{$prefix}-fade-leave.#{$prefix}-fade-leave-active {
        opacity: 0;
    }

    .#{$prefix}-fade-leave,
    .#{$prefix}-fade-appear.#{$prefix}-fade-appear-active,
    .#{$prefix}-fade-enter.#{$prefix}-fade-enter-active {
        opacity: 1;
    }

    .#{$prefix}-top {
        .#{$prefix}-fade-appear,
        .#{$prefix}-fade-enter {
            transform: translateY(-50%);
        }

        .#{$prefix}-fade-leave.#{$prefix}-fade-leave-active {
            transform: translateY(-10%);
        }
    }

    .#{$prefix}-topRight,
    .#{$prefix}-bottomRight {
        .#{$prefix}-fade-appear,
        .#{$prefix}-fade-enter {
            transform: translateX(50%);
        }

        .#{$prefix}-fade-leave.#{$prefix}-fade-leave-active {
            transform: translateX(10%);
        }
    }

    .#{$prefix}-topLeft,
    .#{$prefix}-bottomLeft {
        .#{$prefix}-fade-appear,
        .#{$prefix}-fade-enter {
            transform: translateX(-50%);
        }

        .#{$prefix}-fade-leave.#{$prefix}-fade-leave-active {
            transform: translateX(-10%);
        }
    }

    .#{$prefix}-top,
    .#{$prefix}-bottom {
        .#{$prefix}-fade-leave {
            transform: translateY(0);
        }
        .#{$prefix}-fade-appear.#{$prefix}-fade-appear-active,
        .#{$prefix}-fade-enter.#{$prefix}-fade-enter-active {
            transform: translateY(0);
        }
    }

    .#{$prefix}-bottom {
        .#{$prefix}-fade-appear,
        .#{$prefix}-fade-enter {
            transform: translateY(50%);
        }

        .#{$prefix}-fade-leave.#{$prefix}-fade-leave-active {
            transform: translateY(10%);
        }
    }

    .#{$prefix}-topLeft,
    .#{$prefix}-topRight,
    .#{$prefix}-bottomLeft,
    .#{$prefix}-bottomRight {
        .#{$prefix}-fade-leave {
            transform: translateX(0);
        }
        .#{$prefix}-fade-appear.#{$prefix}-fade-appear-active,
        .#{$prefix}-fade-enter.#{$prefix}-fade-enter-active {
            transform: translateX(0);
        }
    }
}

.#{$prefix} {
    &-content {
        position: relative;
        display: block;
        width: $size-notification-content;
        max-width: calc(100vw - var(--space-2xl));
        padding: var(--space-m);
        color: var(--color-typo-primary);
        line-height: 1.5;
        background: var(--color-bg-default);
        border: 1px solid var(--color-control-bg-border-default);
        border-radius: var(--radius-m);
    }

    &-closable {
        padding-right: var(--space-2xl);
    }

    &-with-icon {
        padding-left: var(--space-4xl);
        svg {
            position: absolute;
            top: var(--space-m);
            left: var(--space-m);
            width: var(--space-xl);
            height: auto;
        }
    }

    &-message {
        font-size: var(--size-text-m);
    }

    &-description {
        margin-top: var(--space-xs);
        font-size: var(--size-text-s);
    }

    &-icon {
        &-success {
            color: var(--color-typo-success);
        }
        &-info {
            color: var(--color-typo-normal);
        }
        &-error {
            color: var(--color-typo-alert);
        }
        &-warning {
            color: var(--color-typo-caution);
        }
    }
}
