/** Modern 3-Stripe Loading Animation **/

#Loading {
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#Loading.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#LoadingImage {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    z-index: 2001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#LoadingImage.active {
    opacity: 1;
    visibility: visible;
}

.LoadingStripes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 120px;
}

.LoadingStripeWrapper {
    display: flex;
    height: 14px;
    color: #888;
    animation-duration: 1.5s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.LoadingStripeBody {
    height: 14px;
    background-color: currentColor;
    border-radius: 2px 0 0 2px;
}

.LoadingStripeTail {
    width: 11px;
    height: 14px;
    flex-shrink: 0;
    margin-left: -1px;
}

.LoadingStripe1 .LoadingStripeBody {
    width: 53px;
    animation: stripe1width 1.5s ease-in-out infinite;
}

.LoadingStripe1 {
    animation: stripe1brightness 1.5s ease-in-out infinite;
}

.LoadingStripe2 .LoadingStripeBody {
    width: 98px;
    animation: stripe2width 1.5s ease-in-out infinite 0.2s;
}

.LoadingStripe2 {
    animation: stripe2brightness 1.5s ease-in-out infinite 0.2s;
}

.LoadingStripe3 .LoadingStripeBody {
    width: 83px;
    animation: stripe3width 1.5s ease-in-out infinite 0.4s;
}

.LoadingStripe3 {
    animation: stripe3brightness 1.5s ease-in-out infinite 0.4s;
}

@keyframes stripe1width {
    0%, 100% {
        width: 53px;
    }
    50% {
        width: 75px;
    }
}

@keyframes stripe2width {
    0%, 100% {
        width: 98px;
    }
    50% {
        width: 83px;
    }
}

@keyframes stripe3width {
    0%, 100% {
        width: 83px;
    }
    50% {
        width: 104px;
    }
}

@keyframes stripe1brightness {
    0%, 100% {
        filter: brightness(0.7);
    }
    50% {
        filter: brightness(1.3);
    }
}

@keyframes stripe2brightness {
    0%, 100% {
        filter: brightness(0.75);
    }
    50% {
        filter: brightness(1.25);
    }
}

@keyframes stripe3brightness {
    0%, 100% {
        filter: brightness(0.72);
    }
    50% {
        filter: brightness(1.28);
    }
}

/** Circle Loading Animation **/
.LoadingCircle {
    position: relative;
    width: 90px;
    height: 90px;
}

.LoadingCircleOuter {
    position: absolute;
    width: 90px;
    height: 90px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(
        transparent 0deg,
        transparent 240deg,
        var(--red) 300deg,
        var(--red) 360deg
    );
    -webkit-mask: radial-gradient(circle, transparent 0, transparent calc(50% - 4px), black calc(50% - 4px), black 50%, transparent 50%);
    mask: radial-gradient(circle, transparent 0, transparent calc(50% - 4px), black calc(50% - 4px), black 50%, transparent 50%);
    animation: spin 1.2s linear infinite;
}

.LoadingCircleInner {
    position: absolute;
    width: 66px;
    height: 66px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(
        #888 0deg,
        #888 60deg,
        transparent 120deg,
        transparent 360deg
    );
    -webkit-mask: radial-gradient(circle, transparent 0, transparent calc(50% - 4px), black calc(50% - 4px), black 50%, transparent 50%);
    mask: radial-gradient(circle, transparent 0, transparent calc(50% - 4px), black calc(50% - 4px), black 50%, transparent 50%);
    animation: spincounterpulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes spincounter {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(-360deg);
    }
}

@keyframes spinpulse {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        opacity: 0.7;
    }
    50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1.08);
        opacity: 1;
    }
    75% {
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1);
        opacity: 1;
    }
}

@keyframes spincounterpulse {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) rotate(-180deg) scale(0.94);
        opacity: 1;
    }
    75% {
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) rotate(-360deg) scale(1);
        opacity: 1;
    }
}

@media (prefers-color-scheme: dark) {
    #Loading {
        background-color: rgba(0, 0, 0, 0.55);
    }

    @keyframes stripe1brightness {
        0%, 100% {
            filter: brightness(1);
        }
        50% {
            filter: brightness(0.6);
        }
    }

    @keyframes stripe2brightness {
        0%, 100% {
            filter: brightness(1);
        }
        50% {
            filter: brightness(0.65);
        }
    }

    @keyframes stripe3brightness {
        0%, 100% {
            filter: brightness(1);
        }
        50% {
            filter: brightness(0.62);
        }
    }

}
