.loading {
    position: relative;

    &::before {
        content: "";
        position: absolute;
        background: rgba(255, 255, 255, 0.7);
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 1;
    }

    &::after {
        content: "";
        position: absolute;
        height: 30px;
        width: 30px;
        top: 50%;
        left: 50%;
        border-radius: 50%;
        background-image: conic-gradient(transparent 5deg, var(--color-primary) 360deg);
        mask: radial-gradient(
            farthest-side,
            transparent calc(100% - 1.3px),
            var(--color-primary) 0
        );
        animation: loader-spin 0.5s linear infinite;
        z-index: 2;
    }
}

.rtl {
    .loading {
        &::after {
            left: 50%;
            right: unset;
        }
    } 
}

.btn-loading {
    color: transparent !important; 

    &::after { 
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        border-radius: 50%;
        height: 16px;
        width: 16px;
        background-image: conic-gradient(transparent 5deg, #fff 360deg);
        mask: radial-gradient(
            farthest-side,
            transparent calc(100% - 1.3px),
            #fff 0
        );
        animation: loader-spin 0.5s linear infinite;
    }
}

.rtl {
    .btn-loading {
        &::after {
            left: 50%;
            right: unset;
        }
    } 
}

/*rtl:begin:ignore*/
@keyframes loader-spin {
    from {
        transform:  translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
/*rtl:end:ignore*/

@keyframes tab-loader {
    0% {
        left: 0;
        width: 20px;
    }

    50% {
        left: calc(100% - 20px);
        width: 20px;
    }

    100% {
        left: 0;
        width: 20px;
    }
}
