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

$namespace: 'dbj';

@include b(upload-image) {
  width: 224px;
  height: 224px;
  overflow: hidden;

  .el-upload {
    width: 100%;
    height: 100%;
  }

  @include e(content) {
    width: 100%;
    height: 100%;
    background: $--background-color-light;
    position: relative;
  }

  @include e(img) {
    width: 100%;
    height: 100%;
    object-fit: scale-down;
  }

  @include e(mask) {
    position: absolute;
    z-index: 100;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: $--background-color-light;
    display: flex;
    flex-flow: column nowrap;
    align-items: center;
    justify-content: center;
  }

  @include e(icon) {
    width: 24px;
    height: 24px;
    background: $--color-primary;
    color: $--color-white;
    font-size: 24px;
    border-radius: 50%;
    &:hover {
      background: $--color-primary-hover;
    }
    &:click {
      background: $--color-primary-active;
    }
  }

  @include e(title) {
    color: $--color-text-primary;
    line-height: 32px;
    font-size: 14px;
    font-weight: bold;
  }

  @include e(tip) {
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    color: $--color-text-secondary;
    padding: 0 8px;
    margin: 0;
  }

  @include e(loading) {
    font-size: 12px;
    color: $--color-text-secondary;
    .dot {
      display: inline-block;
      vertical-align: middle;
      animation: loading-dot 2s infinite steps(3, start);
      overflow: hidden;
    }
  }

  @include m(replace) {
    .dbj-upload-image__mask {
      background: rgba(0,0,0,0.60);
      display: none;
    }
    &:hover {
      .dbj-upload-image__mask {
        display: flex;
      }
      .dbj-upload-image__title {
        color: $--color-white;
      }
      .dbj-upload-image__tip {
        color: $--color-white;
      }
    }
  }

  @include m(loading) {
    &.dbj-upload-image--replace {
      .dbj-upload-image__mask {
        display: flex;
      }
      .dbj-upload-image__loading {
        color: $--color-white;
      }
    }
    .dbj-upload-image__icon,
    .dbj-upload-image__title,
    .dbj-upload-image__tip {
      display: none;
    }
  }
}

$namespace: 'el';
