@import "../styles/base/fn.wxss";

.@{wuxClassNamePrefix}-refresher {
    position: absolute;
    top: -60px;
    right: 0;
    left: 0;
    overflow: hidden;
    margin: auto;
    height: 50px;

    &--hidden {
        visibility: hidden;
    }

    &--visible {
        visibility: visible;
    }

    &__content {
        position: absolute;
        bottom: 5px;
        left: 0;
        width: 100%;
        color: #666;
        text-align: center;
        font-size: 30px;
    }

    &__content--text {
        bottom: 0;
    }

    &__text-pulling {
        font-size: 16px;
        line-height: 16px;
    }

    &__text-refreshing {
        font-size: 16px;
        line-height: 16px;
        display: none;
    }

    &__icon-pulling {
        width: 100%;
        backface-visibility: hidden;
        transform-style: preserve-3d;
        padding: 7px 0;
        animation-name: refresh-spin-back;
        animation-duration: .2s;
        animation-timing-function: linear;
        animation-fill-mode: none;
        transform: translateZ(0) rotate(0deg);
    }

    &__icon-refreshing {
        width: 100%;
        backface-visibility: hidden;
        transform-style: preserve-3d;
        padding: 7px 0;
        display: none;
        animation-duration: 1.5s;
    }

    &__icon--arrow-down {
        display: block;
        margin: 0 auto;
        width: 20px;
        height: 20px;
        background-repeat: no-repeat;
        background-position: center center;
        background-size: 20px 20px;
        background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAHdElNRQfhAhQABBG6qxTZAAABVklEQVRo3u3YvUoDQRiF4ePPTZgbEGsh23sBgqWCKQe8AVvB0tJySgPah9T2CaSxkNhY6i3YaRN1J7uz+31nAmnOVJNkM++zCcyyC2hobHnslHw5HOIZA3zgJL6xa+wX8ZcAgAGW/InsFgE2MAQQQAABBBBAAAEEEEAAAQQQYOuAjtvzcIprfOImvpYEwhFucYC7OGn/PHtfH87xuJpWcZ455vt3FjPrhCFmq+lFfGo7Iv8X3P/NZmFInv1/vr6eEfBVm1OEJJ+uZwJcJa/chLX8+nr9gDjFiCc08qM49f4CiGOW0JIf547t3Ac4giffuxH5Cb68YSf0Ebx501ZsJ/jzxmuBjcDkzRejfgKXdz2sDpd4SN6oasmKyzufljcIuWHOA3sewOLl+B1nm8w7ASaCK+8G9BKceQLQSXDnKUCWQORJQCuBytOABoHMFwASAp3X0AB+AFVjfoii8X5lAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTIwVDAwOjA0OjE3KzA4OjAwenpBPAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0yMFQwMDowNDoxNyswODowMAsn+YAAAAAASUVORK5CYII=");
    }

    &__icon--refresher {
        display: block;
        margin: 0 auto;
        width: 20px;
        height: 20px;
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
        background-repeat: no-repeat;
        background-position: 50%;
        background-size: 100%;
        transform-origin: 50%;
        animation: refresh-spin-rotate 1s steps(12, end) infinite;
    }

    &--active {
        &.@{wuxClassNamePrefix}-refresher--refreshing {
            transition: transform .2s;
            transform: scale(1);

            .@{wuxClassNamePrefix}-refresher__icon-pulling,
            .@{wuxClassNamePrefix}-refresher__text-pulling {
                display: none;
            }

            .@{wuxClassNamePrefix}-refresher__icon-refreshing,
            .@{wuxClassNamePrefix}-refresher__text-refreshing {
                display: block;
            }

            .@{wuxClassNamePrefix}-refresher--refreshing-tail {
                transform: scale(0);
            }
        }

        .@{wuxClassNamePrefix}-refresher__icon-pulling:not(.@{wuxClassNamePrefix}-refresher__icon-pulling--disabled) {
            animation-name: refresh-spin;
            transform: translateZ(0) rotate(-180deg);
        }
    }
}

.@{wuxClassNamePrefix}-loader {
    overflow: hidden;
    margin: auto;
    height: 50px;
    font-size: 15px;
    position: relative;
    text-align: center;
    display: none;

    .@{wuxClassNamePrefix}-refresher__icon--refresher{
        display: inline-block;
        margin: 0;
    }

    &__text-loading {
        margin-left: 5px;
    }

    &--hidden {
        visibility: hidden;
        display: none;
    }

    &--visible {
        visibility: visible;
        display: block;
    }

    &--end {
        visibility: visible;
        display: block;
    }

    &__content {
        position: absolute;
        width: 100%;
        top: 50%;
        transform: translateY(-50%);
        color: #666;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@keyframes refresh-spin {
    0% {
        transform: translateZ(0) rotate(0)
    }

    to {
        transform: translateZ(0) rotate(180deg)
    }
}

@keyframes refresh-spin-back {
    0% {
        transform: translateZ(0) rotate(180deg)
    }

    to {
        transform: translateZ(0) rotate(0)
    }
}

@keyframes refresh-spin-rotate {
    100% {
        transform: rotate(360deg);
    }
}
