@use "@material/animation/_index" as animation;
@use "@material/shape/_index" as shape;
@use "~/util";

.image-upload {
  overflow: hidden;
  margin-bottom: 16px;
  &-title {
    margin: 0;
    padding: 16px;
  }
  &-form {
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    position: relative;
    .loading-indicator {
      position: absolute;
      top: 0;
      height: 100%;
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 2;
      cursor: default;
      pointer-events: none;
      overflow: hidden;
      .rmwc-circular-progress {
        position: absolute;
      }
      &.image {
        background-color: rgba(0, 0, 0, 0.25);
        .rmwc-circular-progress {
          color: white;
        }
      }
    }
    .image-display {
      position: relative;
      max-width: 480px;
      margin: 0 auto;
      height: 0;
      padding-top: 100% * 9/16;
      @include util.divider-border($style: dashed);
      user-select: none;
      overflow: hidden;
      transition: animation.standard(border-color, 150ms);
      margin: 1px 0;
      &-image {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        height: 100%;
        background-repeat: no-repeat;
        background-position: center;
        background-size: cover;
        pointer-events: none;
      }
      &.filled {
        border-color: transparent;
      }
      .drag-label {
        position: absolute;
        top: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        pointer-events: none;
        height: 100%;
        width: 100%;
        .caption {
          margin-bottom: 0;
          margin-top: 16px;
        }
      }
      &::before {
        content: "";
        position: absolute;
        top: 0;
        height: 100%;
        width: 100%;
        opacity: 0;
        transition: animation.standard(opacity, 150ms);
        pointer-events: none;
      }
      &.over {
        border-width: 2px;
        margin: 0;
        &::before {
          opacity: 0.04;
        }
      }
      &.image {
        border-width: 0;
        margin: 0;
        &.over::before {
          opacity: 0.25;
        }
      }
    }
    .mdc-text-field {
      margin-top: 16px;
      &-helper-line {
        margin-bottom: 0;
      }
    }
  }
  .file-input {
    input {
      display: none;
    }
  }
}
