@import '../../scss/styles.scss';

.file-field {
  position: relative;
  margin-bottom: var(--base);
  background: var(--theme-elevation-50);

  &__upload {
    display: flex;
  }

  .tooltip.error-message {
    z-index: 3;
    bottom: calc(100% - #{base(0.5)});
  }

  &__file-selected {
    display: flex;
  }

  &__thumbnail-wrap {
    position: relative;
    width: 150px;

    .thumbnail {
      position: absolute;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }

  &__remove {
    margin: calc($baseline * 1.5) $baseline $baseline 0;
    place-self: flex-start;
  }

  &__file-adjustments {
    padding: $baseline;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: calc(var(--base) / 2);
  }

  &__filename {
    @include formInput;
    background-color: var(--theme-bg);
  }

  &__file-mutation {
    display: flex;
    gap: calc(var(--base) / 2);
    flex-wrap: wrap;

    & button {
      cursor: pointer;
      background-color: var(--theme-elevation-150);
      border: none;
      border-radius: $style-radius-s;
      padding: base(0.25) base(0.5);
      text-wrap: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      &:hover {
        background-color: var(--theme-elevation-100);
      }
    }
  }

  &__previewDrawer {
    & h2 {
      margin: 0 base(1) 0 0;
      text-wrap: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: calc(100% - base(2));
    }
  }

  @include small-break {
    &__upload {
      flex-wrap: wrap;
      justify-content: space-between;
    }

    &__remove {
      margin: $baseline;
      order: 2;
    }

    &__file-adjustments {
      order: 3;
      border-top: 2px solid var(--theme-elevation-0);
      padding: calc($baseline * 0.5);
      gap: 0;
    }

    &__thumbnail-wrap {
      order: 1;
      width: 50%;

      .thumbnail {
        width: 100%;
      }
    }

    &__edit {
      display: none;
    }
  }
}
