// Make checkmark the same color as Bootstrap's success buttons
$success: $brand-success;
$success-border: rgba($success, 0.2);

// Styles adapted from https://github.com/sweetalert2/sweetalert2/blob/master/src/sweetalert2.scss (MIT Licensed)
.AnimatedIcon {
    position: relative;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin: 1.25em auto 1.875em;
    border: 4px solid transparent;
    border-radius: 50%;
    line-height: 80px;
    cursor: default;
    box-sizing: content-box;
    user-select: none;
}

.AnimatedIcon--success {
    border-color: $success;
}

.AnimatedIcon__ring { // Ring
    position: absolute;
    top: -4px;
    left: -4px;
    width: 80px;
    height: 80px;
    border: 4px solid $success-border;
    border-radius: 50%;
    z-index: 2;
    box-sizing: content-box;
}

.AnimatedIcon__fix { // Hide corners left from animation
    position: absolute;
    background-color: rgb(255, 255, 255);
    top: 8px;
    left: 26px;
    width: 7px;
    height: 90px;
    transform: rotate(-45deg);
    z-index: 1;
}

.AnimatedIcon__line {
    display: block;
    position: absolute;
    height: 5px;
    border-radius: 2px;
    background-color: $success;
    z-index: 2;
}

.AnimatedIcon__line-tip {
    animation: animate-success-tip 0.75s;
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
}

.AnimatedIcon__line-long {
    animation: animate-success-long 0.75s;
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
}

.AnimatedIcon__circular-line { // Emulate moving circular line
    position: absolute;
    width: 60px;
    height: 120px;
    transform: rotate(45deg);
    border-radius: 50%;
    background-color: rgb(255, 255, 255);
}

.AnimatedIcon__circular-line-left {
    top: -7px;
    left: -33px;
    transform: rotate(-45deg);
    transform-origin: 60px 60px;
    border-radius: 120px 0 0 120px;
}

.AnimatedIcon__circular-line-right {
    animation: rotate-placeholder 4.25s ease-in;
    top: -11px;
    left: 30px;
    transform: rotate(-45deg);
    transform-origin: 0 60px;
    border-radius: 0 120px 120px 0;
}

// Animations

@keyframes animate-success-tip {
    0% {
        top: 19px;
        left: 1px;
        width: 0;
    }

    54% {
        top: 17px;
        left: 2px;
        width: 0;
    }

    70% {
        top: 35px;
        left: -6px;
        width: 50px;
    }

    84% {
        top: 48px;
        left: 21px;
        width: 17px;
    }

    100% {
        top: 45px;
        left: 14px;
        width: 25px;
    }
}

@keyframes animate-success-long {
    0% {
        top: 54px;
        right: 46px;
        width: 0;
    }

    65% {
        top: 54px;
        right: 46px;
        width: 0;
    }

    84% {
        top: 35px;
        right: 0;
        width: 55px;
    }

    100% {
        top: 38px;
        right: 8px;
        width: 47px;
    }
}

@keyframes rotate-placeholder {
    0% {
        transform: rotate(-45deg);
    }

    5% {
        transform: rotate(-45deg);
    }

    12% {
        transform: rotate(-405deg);
    }

    100% {
        transform: rotate(-405deg);
    }
}
