/* Inspired by: m3.material.io/components/progress-indicators/overview */

.loader {
    width: 24px;
    overflow: visible;
    transform: rotate(-90deg);
    transform-origin: center;
    --active: #ff7300;
    --track: #ededed;
    --duration: 5s;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% {
        rotate: 0deg;
    }

    100% {
        rotate: 360deg;
    }
}

.active {
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-dashoffset: 360;
    animation: active-animation var(--duration) ease-in-out infinite;
}

@keyframes active-animation {
    0% {
        stroke-dasharray: 0 0 0 360 0 360;
    }

    12.5% {
        stroke-dasharray: 0 0 270 90 270 90;
    }

    25% {
        stroke-dasharray: 0 270 0 360 0 360;
    }

    37.5% {
        stroke-dasharray: 0 270 270 90 270 90;
    }

    50% {
        stroke-dasharray: 0 540 0 360 0 360;
    }

    50.001% {
        stroke-dasharray: 0 180 0 360 0 360;
    }

    62.5% {
        stroke-dasharray: 0 180 270 90 270 90;
    }

    75% {
        stroke-dasharray: 0 450 0 360 0 360;
    }

    87.5% {
        stroke-dasharray: 0 450 270 90 270 90;
    }

    87.501% {
        stroke-dasharray: 0 90 270 90 270 90;
    }

    100% {
        stroke-dasharray: 0 360 1 360 0 360;
    }
}

.track {
    stroke: var(--bg-3);
    stroke-linecap: round;
    stroke-dashoffset: 360;
    animation: track-animation var(--duration) ease-in-out infinite;
}

@keyframes track-animation {
    0% {
        stroke-dasharray: 0 20 320 40 320 40;
    }

    12.5% {
        stroke-dasharray: 0 290 50 310 50 310;
    }

    25% {
        stroke-dasharray: 0 290 320 40 320 40;
    }

    37.5% {
        stroke-dasharray: 0 560 50 310 50 310;
    }

    37.501% {
        stroke-dasharray: 0 200 50 310 50 310;
    }

    50% {
        stroke-dasharray: 0 200 320 40 320 40;
    }

    62.5% {
        stroke-dasharray: 0 470 50 310 50 310;
    }

    62.501% {
        stroke-dasharray: 0 110 50 310 50 310;
    }

    75% {
        stroke-dasharray: 0 110 320 40 320 40;
    }

    87.5% {
        stroke-dasharray: 0 380 50 310 50 310;
    }

    100% {
        stroke-dasharray: 0 380 320 40 320 40;
    }
}

.loadingspinner {
    position: fixed;
    width: 100%;
    height: 100%;
    top: -46.5%;
    left: 40%;
    background: var(--bg-1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: 0.15s;
    opacity: 1;
    pointer-events: none;
}

.loadingspinner.hidden {
    opacity: 0;
    pointer-events: none;
}