@use '@uppy/core/src/_variables.scss' as *;
@use '@uppy/core/src/_utils.scss' as *;
@use 'FilePreviewAndLink/index.scss';
@use 'FileProgress/index.scss' as index2;
@use 'FileInfo/index.scss' as index3;
@use 'Buttons/index.scss' as index4;

.uppy-Dashboard-Item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid $gray-200;

  .uppy-Dashboard:not(.uppy-Dashboard--singleFile) & {
    padding-inline-end: 0;
  }

  [data-uppy-theme='dark'] & {
    border-bottom: 1px solid $gray-800;
  }

  // @media bigger than .md
  $rl-margin: 15px;

  .uppy-size--md & {
    // For the Remove button
    position: relative;
    display: block;
    float: inline-start;

    /* When changing width: also update `itemsPerRow` values in `src/components/Dashboard.js`. */
    width: calc(33.333% - #{$rl-margin} - #{$rl-margin});
    height: 215px;
    margin: 5px $rl-margin;
    padding: 0;
    border-bottom: 0;
  }

  .uppy-size--lg & {
    /* When changing width: also update `itemsPerRow` values in `src/components/Dashboard.js`. */
    width: calc(25% - #{$rl-margin} - #{$rl-margin});
    height: 190px;
    margin: 5px $rl-margin;
    padding: 0;
  }

  .uppy-size--xl & {
    /* When changing width: also update `itemsPerRow` values in `src/components/Dashboard.js`. */
    width: calc(20% - #{$rl-margin} - #{$rl-margin});
    height: 210px;
    padding: 0;
  }

  .uppy-Dashboard--singleFile & {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    height: 100%;
    border-bottom: 0;
    position: relative;
    padding: 15px;
  }
}

.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap {
  opacity: 0.2;
}

.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name {
  opacity: 0.7;
}

.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview::before {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: $zIndex-5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417 3.416 0 5.125 3.417 8.61 3.417 3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709zm8.542-17.084a3.383 3.383 0 01-3.417-3.416 3.383 3.383 0 013.417-3.417 3.383 3.383 0 013.417 3.417 3.383 3.383 0 01-3.417 3.416zm13.667 0A3.383 3.383 0 0120.5 18.16a3.383 3.383 0 013.417-3.417 3.383 3.383 0 013.416 3.417 3.383 3.383 0 01-3.416 3.416z' fill='%2523000' fill-rule='nonzero'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 50% 10px;
  background-size: 25px;
  opacity: 0.5;
  content: '';

  .uppy-size--md & {
    background-position: 50% 50%;
    background-size: 40px;
  }

  .uppy-Dashboard--singleFile & {
    background-position: 50% 50%;
    background-size: 30%;
  }
}

.uppy-Dashboard-Item-preview {
  // for the FileProgress.js icons
  position: relative;

  // @media only mobile
  flex-grow: 0;
  flex-shrink: 0;
  width: 50px;
  height: 50px;

  // @media bigger than .md
  .uppy-size--md & {
    width: 100%;
    height: 140px;
  }

  .uppy-size--lg & {
    height: 120px;
  }

  .uppy-size--xl & {
    height: 140px;
  }

  .uppy-Dashboard--singleFile & {
    width: 100%;
    max-height: 75%;
    flex-grow: 1;
  }

  .uppy-Dashboard--singleFile.uppy-size--md & {
    max-height: 100%;
  }
}

.uppy-Dashboard-Item-fileInfoAndButtons {
  display: flex;
  flex-grow: 1;
  align-items: center;
  justify-content: space-between;
  padding-inline-end: 8px;
  padding-inline-start: 12px;

  .uppy-size--md &,
  .uppy-Dashboard--singleFile & {
    align-items: flex-start;
    padding: 0;
    padding-top: 9px;
  }

  .uppy-Dashboard--singleFile & {
    width: 100%;
    flex-grow: 0;
  }
}

.uppy-Dashboard-Item-fileInfo {
  flex-grow: 1;
  flex-shrink: 1;
}

.uppy-Dashboard-Item-actionWrapper {
  flex-grow: 0;
  flex-shrink: 0;
}
// ...uppy-Dashboard-Item-fileInfoAndButtons|
// ...uppy-Dashboard-Item|

// CSS that depends on status of the file (could be logic in js instead?)
.uppy-Dashboard-Item.is-inprogress,
.uppy-Dashboard-Item.is-error {
  .uppy-Dashboard-Item-previewInnerWrap::after {
    display: block;
  }
}

.uppy-Dashboard-Item-errorDetails {
  position: relative;
  top: 0;
  // display: inline-block;
  // vertical-align: middle;
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  color: $white;
  font-weight: 600;
  font-size: 10px;
  line-height: 12px;
  text-align: center;
  background-color: $gray-500;
  border-radius: 50%;
  border: none;
  cursor: help;
  appearance: none;
  inset-inline-start: 2px;
}

.uppy-Dashboard-Item-errorDetails::after {
  line-height: 1.3;
  word-wrap: break-word;
}
