@import "mixins/mixins";
@import "common/var";
@import "cropper-content";
@include b(upload) {
    display: inline-block;
    // text-align: center;
    cursor: pointer;
    outline: none;
    @include e(input) {
        display: none;
    }
    @include e(text) {
        color: $--color-text-regular;
        font-size: $--font-size-body-3;
        font-weight: $--font-weight-400;
        line-height: 22px;
        margin-top: 8px;
    }
    @include e(tip) {
        font-size: $--font-size-body-1;
        margin-top: 8px;
        font-weight: $--font-weight-400;
        color: $--color-text-placeholder;
        line-height: 18px;  //单行文本行高18px
        &__paragraph{   // 段落行高20px
            line-height: 20px;
        }
    }
    // .el-icon-plus {
    //     font-size: $--font-size-title-1;
    //     // color: $--color-text-secondary;
    // }
    @include e(picture-card) {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 432px;

        .el-upload--picture-card {
            margin: 0 8px 8px 0;
        }

    }

    iframe {
        position: absolute;
        z-index: -1;
        top: 0;
        left: 0;
        opacity: 0;
        filter: alpha(opacity=0);
    }
    &:focus {
        border-color: $--color-primary;
        color: $--color-primary;
        .el-upload-dragger {
            background: $--border-color-base;
            // border-radius: 4px;
            border-radius: $--border-radius-medium;
            border: $--border-1 solid $--color-border-4;
        }
    }
}

@include b(upload-dragger) {
    background: $--color-secondary;
    // border-radius: 4px;
    border-radius: $--border-radius-medium;
    border: $--border-1 dashed $--color-border-3;
    box-sizing: border-box;
    width: 400px;
    height: 204px;
    padding: 57px 16px 0;
    text-align: center;
    cursor: pointer;
    position: relative;
    &:hover{
        width: 400px;
        height: 204px;
        background: $--border-color-base;
        // border-radius: 4px;
        border-radius: $--border-radius-medium;
        border: $--border-1 dashed $--color-border-4;
    }
    .el-upload__tip {
        margin-top: 4px;
    }
    .el-icon-plus {
        font-size: $--font-size-title-1;
        color: $--color-text-secondary;
    }
    @include when(dragover) {
        background-color: rgba(var(--modblue-6), .06);
        border: 2px dashed $--color-primary;
    }
}

@include b(upload-list) {
    min-width: 400px;
    margin: 0;
    padding: 0;
    list-style: none;

    @include e(item) {
        // transition: all .5s cubic-bezier(.55, 0, .1, 1);
        font-size: $--font-size-body-3;
        color: $--color-text-regular;
        line-height: 36px;
        margin-top: 12px;
        position: relative;
        box-sizing: border-box;
        // border-radius: 4px;
        border-radius: $--border-radius-medium;
        width: 100%;
        background: $--color-secondary;

        &-svg {
            display: flex;
            align-content: center;
            margin: auto 12px;
        }
        &-text {
            flex: 1;
            max-width: 420px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-right: 12px;
            display: flex;
            align-items: center;
            &-label{
                position: relative;
                min-width: 0;
                &-name{
                    text-overflow: ellipsis;
                    overflow: hidden;
                    white-space: nowrap;
                    display: block;
                }
                .error-tooltip {
                    // margin-left: 4px;
                    position: absolute;
                    right: 0;
                    top: 50%;
                    transform: translateY(-50%);
                    i {
                        color: $--color-danger;
                        font-size: $--font-size-body-1;
                    }
                }
            }
            &-fail{
                padding-right: 18px;
            }
        }
        &-status-label {
            margin-right: 12px;
            width: 48px;
        }
        &:first-child {
            margin-top: 16px;
        }
        & .el-icon-success {
            color: $--color-success;
        }
        .icon-remove {
            position: absolute;
            right: -24px;
            top: 12px;
            cursor: pointer;
            font-size: $--font-size-body-1;
            color: $--color-text-secondary;
            z-index: 2;
            &:hover{
                &:after{
                    content: '';
                    position: absolute;
                    top: -4px;
                    left: -4px;
                    display: block;
                    width: 20px;
                    height: 20px;
                    border-radius: 50%;
                    background: $--color-fill-3;
                    z-index: -2;
                }
            }
        }
        & .el-icon-close-tip {
            position: absolute;
            top: 5px;
            right: 5px;
            font-size: $--font-size-body-1;
            cursor: pointer;
            opacity: 1;
            color: $--color-primary;
        }
        &:hover {
            //background-color: $--background-color-base;
            .el-icon-delete {
                display: inline-block;
            }
        }
        @include when(success) {
            .el-upload-list__item-status-label {
                display: flex;
                justify-content: flex-end;
            }
            .el-upload-list__item-name:hover,
            .el-upload-list__item-name:focus {
                // color: $--link-hover-color;
                cursor: pointer;
            }
            &:focus:not(:hover) {
                /* 键盘focus */
                .el-icon-close-tip {
                    display: inline-block;
                }
            }
            &:not(.focusing):focus,
            &:active {
                /* click时 */
                outline-width: 0;
                .el-icon-close-tip {
                    display: none;
                }
            }
        }
    }
    @include e(item-name) {
        color: $--color-text-regular;
        display: flex;
        align-items: center;
        line-height: 36px;
    }
    @include e(item-status-label) {
        a {
            font-size: $--font-size-body-1;
            font-weight: $--font-weight-400;
            color: $--primary-6;
        }
    }
    @include e(item-delete) {
        position: absolute;
        right: 10px;
        top: 0;
        font-size: $--font-size-body-1;
        color: $--color-text-secondary;
    }
    @include m(picture) {
        .el-upload-list__item {
            background-color: $--color-secondary;
            border: $--border-1 solid $--color-secondary;
            // border-radius: 4px;
            border-radius: $--border-radius-medium;
            box-sizing: border-box;
            margin-top: 12px;
            padding: 7px;
            height: 56px;

            .icon-remove {
                position: absolute;
                right: -24px;
                top: 22px;
                cursor: pointer;
                font-size: $--font-size-body-1;
                color: $--color-text-secondary;
            }
            &:hover {
                .el-upload-list__item-status-label {
                    background: transparent;
                    // box-shadow: none;
                    top: -2px;
                    right: -12px;
                }
            }
        }
        .el-upload-list__item-thumbnail {
            vertical-align: middle;
            width: 40px;
            height: 40px;
            margin-right: 8px;
            object-fit: cover;
        }
        .el-upload-list__item-name {
            line-height: 40px;
        }
    }
}

.el-upload-loading {
    @include m(basic) {
        position: relative;
        top: -7px;
    }
    @include m(per) {
        position: absolute;
        z-index: 10;
        top: 0;
        left: 0;
    }
}



.el-upload-loading {
    .el-progress-circle svg path:nth-child(1) {
        stroke: $--primary-3 !important;
    }
}

@include b(img-upload) {
    width: 200px;
    height: 112px;
    background-color: $--color-secondary;
    // border-radius: 4px;
    border-radius: $--border-radius-medium;
    border: $--border-1 dashed $--color-border-3;
    padding: 33px 16px;
    text-align: center;
    .el-icon-plus {
        font-size: $--font-size-title-1;
        color: $--color-text-secondary;
    }
    &:hover {
        background-color: $--border-color-base;
        border: $--border-1 dashed $--color-secondary-active;
    }
}

.el-upload-picture__item {
    //margin: 0 0 8px 8px;
    margin: 0 8px 8px 0;
    // &:nth-last-of-type(2){
    //     margin-right: 16px;
    // }
    &-wrap {
        position: relative;
        .el-upload-picture__item-thumbnail {
            width: 200px;
            height: 112px;
            object-fit: cover;
            // border-radius: 4px;
            border-radius: $--border-radius-medium;
        }
        .el-upload-picture__item-modal {
            position: absolute;
            top: 0;
            left: 0;
            width: 200px;
            height: 112px;
            background-color: rgba(0,0,0,0.6);
            // border-radius: 4px;
            border-radius: $--border-radius-medium;
            display: flex;
            justify-content: center;
            align-items: center;
            &.modal-uploading {
                background-color: $--color-secondary;
            }

            .el-upload-loading--basic {
                top: 0;
            }
            .retry {
                cursor: pointer;
                color: $--color-white;
            }
            .btn-list {
                i {
                    font-size: $--font-size-title-1;
                    color: $--color-white;
                    cursor: pointer;
                }
                .el-icon-delete {
                    margin-left: 32px;
                }
            }
            .modal-tooltip {
                position: absolute;
                right: 12px;
                color: $--danger-5;
                bottom: 12px;
            }
        }
    }
}

@include b(upload__picture-wall) {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;

    .el-upload--picture-wall {
        //margin: 0 0 8px 8px;
        margin: 0 0 8px 0;
    }

    .el-upload-picture__item-thumbnail {
        width: 112px;
        height: 112px;
        object-fit: cover;
    }
    .el-img-upload {
        width: 112px;
    }
    .el-upload-picture__item-modal {
        width: 112px;
    }
    .el-icon-plus {
        font-size: $--font-size-title-1;
        color: $--color-text-secondary;
    }
}
