@import "./base/var";
@import "./mixins/index.scss";

@include c(image) {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
    text-align: center;
    font-size: $--font-size-default;

    @include m(status) {
        background-color: $--background-color-base;
    }

    @include e((loading, error)) {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: $--color-text-empty;
    }

    @include m(no-clientwidth) {
        @include e((loading, error), false) {
            position: static;
            transform: none;
        }
    }

    @include e(inner) {
        width: 100%;
        height: 100%;
        vertical-align: top;
    }
    @include e(fill) {
        object-fit: fill;
    }
    @include e(contain) {
        object-fit: contain;
    }
    @include e(cover) {
        object-fit: cover;
    }
    @include e(none) {
        object-fit: none;
    }
    @include e(scale-down) {
        object-fit: scale-down;
    }
}


@include c(image-preview) {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: $--modal-cover-background-color;

    @include e(wrap) {
        width: 100%;
        height: 100%;
    }

    @include e(close) {
        i {
            font-size: $--image-preview-icon-font-size;
        }
        position: absolute;
        z-index: 1;
        top: $--modal-vertical-padding;
        right: $--modal-horizontal-padding;
        cursor: pointer;
        color: $--color-text-default;
        &:hover {
            color: $--color-text-title;
        }
    }


    @include e(body) {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    @include e(image) {
        transition: all $--animation-time ease-in-out;
    }

    @include e(footer) {
        position: absolute;
        bottom: 40px;
        left: 50%;
        transform: translateX(-50%);
        background-color: rgba(0, 0, 0, 0.6);
        padding: 4px 20px;
        border-radius: 60px;

        i {
            font-size: $--image-preview-action-icon-font-size;
            color: #ffffff;
            margin: 0 10px;
            opacity: 0.7;

            &:hover {
                opacity: 1;
            }
        }
    }

    @include e(refresh-left){
        transform: rotateY(180deg);
    }

    @include e((left, right)) {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        font-size: $--image-preview-icon-font-size;
        cursor: pointer;
        transition: all $--animation-time ease-in-out;
        color: #ffffff;
        opacity: 0.7;
        z-index: 1;
        &:hover {
            opacity: 0.9;
        }
    }
    @include e(left) {
        left: 20px;
    }
    @include e(right) {
        right: 20px;
    }
}
