@import './token.less';
@import './mixin.less';
@import './images.less';

.@{ns}-ImageControl {
  position: relative;
  display: block;

  &.is-quick-static-table{
    height: 20px;
    .@{ns}-ImageControl-item{
      width: 20px;
      height: 100%;
      margin-bottom: 0;
      padding: 0;
      border: none;
      .@{ns}-Images{
        height: 100%;
        width: 100%;
        margin: 0;
        .@{ns}-ImageControl-image{
          width: 100%;
          height: 100%;
          &-info{
            display: none;
          }
          .@{ns}-Image-thumbWrap{
            width: 100%;
            height: 100%;
            overflow: hidden;
            border-radius: @border-radius;
            .@{ns}-Image-thumb{
              width: 100%;
              height: 100%;
            }
            .@{ns}-Image-overlay{
              &>div{
                display: none;
              }
            }
          }
        }
      }

    }
  }

  &-dropzone {
    outline: none;
  }

  &-addBtn {
    margin: 0;
    width: 120px;
    height: 120px;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--color-border);
    cursor: pointer;
    margin-right: @gap-base;
    // color: rgb(132, 135, 140);
    .button-variant(
        @ImageControl-addBtn-bg,
        @ImageControl-addBtn-border,
        @ImageControl-addBtn-color,
        @ImageControl-addBtn-onHover-bg,
        @ImageControl-addBtn-onHover-border,
        @ImageControl-addBtn-onHover-color,
        @ImageControl-addBtn-onActive-bg,
        @ImageControl-addBtn-onActive-border,
        @ImageControl-addBtn-onActive-color
      );

    > svg {
      width: 40px;
      height: 40px;
      top: 0;
    }

    &.is-disabled {
      pointer-events: none;
      border: 1px solid @ImageControl-addBtn-onDisabled-border;
      background: @ImageControl-addBtn-onDisabled-bg;
      color: @ImageControl-addBtn-onDisabled-color;
    }
  }

  &-pasteTip {
    pointer-events: none;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    font-size: 12px;
    // line-height: @Tooltip--attr-lineHeigt;
    // text-align: left;
    // white-space: nowrap;
    // background: @Tooltip--attr-bg;
    // border: @Tooltip--attr-borderWidth solid @Tooltip--attr-borderColor;
    // border-radius: @Tooltip--attr-borderRadius;
    // box-shadow: @Tooltip--attr-boxShadow;
    // left: 100%;
    // color: @Tooltip--attr-color;
    // padding: @Tooltip--attr-paddingY @Tooltip--attr-paddingX;
    // margin: 30px 0 0 @Tooltip--attr-gap;
  }

  &-dropzone:focus &-addBtn {
    border-color: @ImageControl-addBtn-onHover-border;
    background: @ImageControl-addBtn-onHover-bg;
    color: @ImageControl-addBtn-onHover-color;
  }

  &-item {
    border: 1px solid var(--color-border);
    vertical-align: top;
    padding: @spacing-2;
    display: inline-block;
    margin-right: @gap-base;
    // margin-bottom: @gap-base;
    position: relative;
    width: 120px;
  }

  &-image {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border: none !important;
    display: block !important;
  }

  &-itemClear {
    position: absolute;
    cursor: pointer;

    color: #999;
    top: 5px;
    right: 5px;
    line-height: 1;

    > svg {
      top: 0;
      width: 10px;
      height: 10px;
    }
  }

  &-itemInfo {
    display: inline-flex;
    width: 110px;
    height: 110px;
    justify-content: center;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;

    > p {
      width: 100%;
      text-align: center;
      font-size: 12px;
      margin-bottom: 5px;
    }
  }

  &-progress {
    width: 70px;
    height: 5px;
    background: #ebebeb;
  }

  &-progressValue {
    height: 5px;
    display: block;
    background: var(--primary-5);
    min-width: 10%;
    transition: ease-out width @animation-duration-3;
  }

  &-item.is-invalid &-itemClear {
    display: none;
  }

  &-item.is-invalid:hover &-itemClear {
    display: block;
  }

  &-retryBtn {
    margin: 0;
    width: 108px;
    height: 108px;
    display: inline-flex;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
    color: #666;

    &:hover {
      color: #333;
      text-decoration: none;
    }

    > p {
      width: 100%;
      text-align: center;
      color: var(--danger-color);
      margin: 10px 0 0;
    }
  }

  &-errorMsg {
    color: var(--danger-color);
    margin: 5px 0 0;
  }

  &-uploadBtn {
    margin-top: 5px;
  }

  &-cropperWrapper {
    position: relative;

    img {
      max-width: 100%;
      max-height: 400px;
    }
  }

  &-croperToolbar {
    display: inline-flex;
    width: 50px;
    position: absolute;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: flex-end;

    > a {
      color: #fff;
      padding: 2px 5px;
      cursor: pointer;
      font-size: 20px;

      .icon-retry {
        polygon {
          fill: #fff;
        }

        path {
          stroke: #fff;
        }
      }
    }
  }

  &-acceptTip {
    height: 120px;
    color: #999;
    border: 2px dashed var(--color-border);

    // &.is-accept {
    border-color: var(--primary-5);
    background: #f3f9fe;
    // }

    border-radius: @border-radius;

    line-height: 120px;
    text-align: center;
  }

  &-fixed-size {
    width: 100%;
    height: 100%;
    padding: 0;
  }

  &-fixed-size &-itemOverlay {
    width: 100%;
    height: 100%;
  }
}
