@import 'theme/default';
@import 'theme/font';

@mixin ellipsis {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.zent-upload {
  &.inline {
    display: inline-block;
  }

  &.zent-dialog-r {
    min-width: 760px !important; // sass-lint:disable-line no-important

    &-footer {
      margin-top: 0;
      padding-top: 10px;
      text-align: center;
    }

    &-title {
      margin-bottom: 10px;
    }
  }

  &-dialog {
    &.zent-dialog-r {
      padding: 15px;
    }
  }

  &__footer {
    text-align: center;
  }
}

.zent-upload-container {
  position: relative;
  padding: 0;
  overflow-y: auto;
  width: 760px;
  max-width: 100%;
  height: 480px;
  display: flex;
  flex-direction: column;

  ul,
  li {
    list-style: none;
    margin: 0;
    padding: 0;
  }
}

.zent-upload-network-image-region,
.zent-upload-group-region,
.zent-upload-local-attachment-region {
  padding: 30px 10px;
  overflow: hidden;

  .zent-upload-title {
    float: left;
    font-size: $font-size-normal;
    font-weight: bold;
    text-align: right;
    width: 100px;
  }

  .zent-upload-content {
    @include theme-color(background-color, stroke, 9);
    position: relative;
    zoom: 1;
    margin-left: 100px;
  }
}

.zent-upload-group-region {
  .zent-upload-title {
    line-height: 30px;
  }
}

.zent-upload-network-image-region {
  overflow: hidden;

  .zent-upload-content {
    display: flex;
  }

  .zent-btn {
    float: right;
  }

  .zent-upload-title {
    line-height: 30px;
  }

  .zent-upload-input-append {
    margin-bottom: 10px;
    margin-right: 10px;
    flex: 1;
  }

  .zent-upload-image-preview {
    max-width: 200px;
    max-height: 200px;

    img {
      max-width: 200px;
      max-height: 200px;
    }
  }
}

.zent-upload-local-attachment-region {
  height: 100%;

  .zent-upload-content {
    margin-top: -10px;
    height: 100%;
    line-height: 0;
  }

  .zent-upload-local-tips {
    @include theme-color(color, stroke, 3);
    clear: both;
    padding-top: 12px;
    font-size: $font-size-small;
    line-height: 14px;
  }

  .zent-upload__upload-local-image-list {
    height: auto;
    margin-top: 10px;

    .zent-upload-image-item {
      position: relative;
      float: left;
      margin-right: 10px;
      width: 80px;
      height: 80px;

      &:hover {
        .zent-upload__close-modal {
          display: block;
        }
      }

      &__box {
        width: 80px;
        height: 80px;
        background-size: cover;
        background-position: 50% 50%;
      }

      &__progress {
        @include theme-color(color, stroke, 9);
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        background: rgba(black, 0.6);
        text-align: center;
        line-height: 80px;
        font-size: $font-size-normal;
      }
    }
  }

  .zent-upload__upload-local-voice-list {
    height: auto;

    &::after {
      content: '.';
      display: block;
      height: 0;
      clear: both;
      visibility: hidden;
    }

    .zent-upload-voice-item {
      @include theme-color(border-color, stroke, 6);
      position: relative;
      float: left;
      width: 300px;
      height: 60px;
      margin-right: 10px;
      margin-bottom: 10px;
      padding: 9px;
      border-width: 1px;
      border-style: solid;
      cursor: pointer;
      box-sizing: border-box;

      &:hover {
        .zent-upload__close-modal {
          display: block;
        }
      }

      &__icon {
        @include theme-color(background-color, stroke, 5);
        width: 40px;
        height: 40px;
        background-size: 40px 40px;
        background-image: url('https://b.yzcdn.cn/upload/image/play@2x.png');

        &.loading {
          background-image: url('https://b.yzcdn.cn/upload/image/loading@2x.gif');
        }

        &.playing {
          background-image: url('https://b.yzcdn.cn/upload/image/playing@2x.gif');
        }
      }

      &__name {
        @include ellipsis;

        position: absolute;
        width: 200px;
        height: 18px;
        line-height: 18px;
        top: 10px;
        left: 60px;
      }

      &__createtime {
        @include theme-color(color, stroke, 3);
        position: absolute;
        bottom: 10px;
        left: 60px;
        line-height: 14px;
      }

      &__duration {
        position: absolute;
        top: 12px;
        right: 10px;
      }

      &__progress {
        @include theme-color(color, stroke, 9);
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        background: rgba(black, 0.6);
        text-align: center;
        line-height: 60px;
        font-size: $font-size-normal;
      }

      &__size {
        @include theme-color(color, stroke, 3);
        position: absolute;
        top: 34px;
        right: 10px;
      }
    }
  }
}

.zent-upload__close-modal {
  @include theme-color(color, stroke, 9);
  display: none;
  position: absolute;
  z-index: 2;
  text-align: center;
  cursor: pointer;
  background: rgba(black, 0.3);
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  font-size: $font-size-normal;
  line-height: 16px;
  border-radius: 9px;

  &:hover {
    @include theme-color(color, stroke, 9);
    @include theme-color(background-color, stroke, 1);
  }
}

.zent-upload-add-local-attachment {
  position: relative;
  width: 44px;
  height: 20px;
  line-height: 20px;
  cursor: pointer;
  overflow: hidden;

  input {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    direction: rtl;
    font-size: 23px;
    opacity: 0;
    cursor: pointer;
  }
}

.zent-upload-wrapper,
.zent-upload-add-local-image-button,
.zent-upload-trigger {
  position: relative;

  input[type='file'] {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    direction: rtl;
    font-size: 23px;
    opacity: 0;
    cursor: pointer;
  }
}

.zent-upload-add-local-image-button,
.zent-upload-trigger {
  @include theme-color(color, stroke, 2);
  @include theme-color(border-color, stroke, 5);
  display: block;
  width: 80px;
  height: 80px;
  border-width: 1px;
  border-style: dashed;
  line-height: 80px;
  box-sizing: border-box;
  text-align: center;
  font-size: 24px;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
}

.zent-upload-add-local-image-button {
  margin: 10px 20px 0 0;
}

.zent-upload-tips {
  @include theme-color(color, stroke, 3);
  line-height: 14px;
  font-size: $font-size-small;
  margin-top: 12px;
  margin-bottom: 0;
  position: absolute;
}

.zent-upload-link {
  @include theme-color(color, primary, 4);
  cursor: pointer;
  font-weight: bold;
}

.zent-upload-split {
  margin: 0 10px;
}
