@import "mixins/mixins";
@import "common/var";
@import "mixins/button";

// 通用的css
.border-img {
    width: 98px;
    height: 98px;
    border: 1px $--border-color-base dashed;
    &:hover {
        border: 1px $--color-primary dashed;
    }
}
// 图片头部和提示样式
@include b(upload) {
    @include e(header) {
        display: flex;
        align-items: center;
    }
    @include e(header-num) {
        font-size: 12px;
        color: $--color-text-secondary;
        padding: 0 8px;
        @include m(top-right) {
            display: flex;
            justify-content: flex-end;
        }
    }
    @include e(body) {
        display: flex;
        flex-wrap: wrap;
        @include m(column) {
            flex-direction: column;
        }
    }
    @include e(tip) {
        color: $--color-text-secondary;
        font-size: 12px;
        @include m(bottom) {
            margin-top: 16px;
        }
        @include m(right) {
            margin-left: 12px;
        }
        @include m(top) {
            margin-bottom: 8px;
        }
    }
}
// 图片上传样式
@include b(upload-item) {
    position: relative;
    @extend .border-img;
    @include e(img) {
        width: 100%;
        height: 100%;
    }
    @include e(hover) {
        display: none;
    }
    &:hover {
        @include e(hover) {
          display: block;
        }
    }
    @include e(del) {
        position: absolute;
        cursor: pointer;
        height: 16px;
        width: 16px;
        border-radius: 16px;
        background: $--color-primary;
        display: flex;
        justify-content: center;
        align-items: center;
        @include button-variant($--button-primary-font-color, $--button-primary-background-color, $--button-primary-border-color);
        & > i {
            font-size: 12px;
            color: $--color-white;
        }
        @include m(left-top) {
            top: -8px;
            left: -8px;
        }
        @include m(right-top) {
            top: -8px;
            right: -8px;
        }
    }
    @include e(btn) {
        width: 100%;
        height: 24px;
        display: flex;
        font-size: 12px;
        line-height: 18px;
        position: absolute;
        bottom: 0px;
        cursor: pointer;
    }
    @include e(btn-text) {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-grow: 1;
        background: $--color-primary;
        color: $--color-white;
        @include button-variant($--button-primary-font-color, $--button-primary-background-color, $--button-primary-border-color);
        @include m(cropper) {
            border-left: 1px solid $--color-white;
        }
    }
}
@include b(upload-btn) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-repeat: no-repeat;
    background-color: $--background-color-hover;
    background-size: 100%;
    cursor: pointer;
    border-radius: $--border-radius-base;
    @extend .border-img;
    @include m(none) {
        display: none;
    }
    @include e(icon) {
        width: 24px;
        height: 24px;
    }
    @include e(text) {
        color: $--color-text-primary;
        font-size: 12px;
        line-height: 14px;
        margin-top: 8px;
    }
    @include e(input) {
        display: none;
    }
}
// 多张图片特殊样式
@include b(upload-list) {
    display: flex;
    flex-wrap: wrap;
    @include e(item) {
        @include m(space) {
            margin: 0 16px 16px 0;
        }
    }
}

// 图片剪裁
@include b(cropper) {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    padding: 12px 20px 22px 20px;
    box-sizing: border-box;
}
@include b(cropper-clipping) {
    @include e(picture) {
        width: 300px;
        height: 240px;
        position: relative;
        overflow: hidden;
    }
    @include e(picture-img) {
        position: absolute;
        display: block;
        cursor: move;
        user-select: none;
    }
    @include e(picture-shade) {
        position: absolute;
        box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.18);
        background-color: rgba(241, 242, 243, 0.8);
        @include m(left) {
            top: 0;
            left: 0;
        }
        @include m(right) {
            bottom: 0;
            right: 0;
        }
    }
    @include e(range) {
        width: 300px;
        text-align: center;
        position: relative;
        margin-top: 30px;
    }
    @include e(range-input) {
        display: block;
        margin: 0 auto;
        width: 80%;
        background: transparent;
        appearance: none;
        cursor: pointer;
        position: relative;
        z-index: 1;
        border: none;
        &:focus {
            outline: none;
        }
    }
    @include e(range-track) {
        width: 80%;
        height: 5px !important;
        border-radius: 6px;
        background: gainsboro;
        /* z-index: 80000001; */
        position: absolute;
        left: 30px;
        top: 7px;
    }
    @include e(range-icon) {
        position: absolute;
        top: 0;
        width: 18px;
        height: 18px;
        border-radius: 100%;
        background-color: rgba(0, 0, 0, 0.08);
        &:hover {
            -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12);
            box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12);
            cursor: pointer;
            background-color: rgba(0, 0, 0, 0.14);
        }
        &::before {
            position: absolute;
            content: '';
            display: block;
            left: 3px;
            top: 8px;
            width: 12px;
            height: 2px;
            background-color: #fff;
        }
        @include m(plus) {
            left: 0;
        }
        @include m(minus) {
            right: 0;
            &::after {
                position: absolute;
                content: '';
                display: block;
                top: 3px;
                left: 8px;
                width: 2px;
                height: 12px;
                background-color: #fff;
            }
        }
    }
}
@include b(cropper-preview) {
    @include e(title) {
        margin-bottom: 12px;
    }
}
