@use '@uppy/core/src/_variables.scss' as *;
@use '@uppy/core/src/_utils.scss' as *;

// ***
// View type: list
// ***

.uppy-ProviderBrowser-viewType--list {
  background-color: $white;

  [data-uppy-theme='dark'] & {
    background-color: $gray-900;
  }

  li.uppy-ProviderBrowserItem {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 7px 15px;

    [data-uppy-theme='dark'] & {
      color: $gray-200;
    }
  }

  li.uppy-ProviderBrowserItem--disabled {
    opacity: 0.6;
  }

  // Checkbox
  .uppy-ProviderBrowserItem-checkbox {
    width: 17px;
    height: 17px;
    background-color: $white;
    border: 1px solid $gray-300;
    border-radius: 3px;
    margin-inline-end: 15px;

    // Focus: show blue outline
    &:focus {
      border: 1px solid $blue;
      outline: none;
      box-shadow: 0 0 0 3px rgba($blue, 0.25);
    }

    // Checkmark icon
    &::after {
      top: 4px;
      width: 9px;
      height: 5px;
      opacity: 0;
      inset-inline-start: 3px;
    }

    [data-uppy-theme='dark'] &:focus {
      border-color: rgba($highlight--dark, 0.7);
      box-shadow: 0 0 0 3px rgba($highlight--dark, 0.2);
    }
  }
  // Checked: color the background, show the checkmark
  .uppy-ProviderBrowserItem--is-checked,
  .uppy-ProviderBrowserItem--is-partial {
    .uppy-ProviderBrowserItem-checkbox {
      background-color: $blue;
      border-color: $blue;

      &::after {
        opacity: 1;
      }
    }
  }

  // Either a <label/> for a file,
  // or a <button/> we can click on for a folder
  .uppy-ProviderBrowserItem-inner {
    display: flex;
    align-items: center;
    color: inherit;
    font-family: $font-family-base;

    // For better outline
    padding: 2px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    &:focus {
      text-decoration: underline;
      outline: none;
    }

    img,
    svg {
      margin-inline-end: 8px;
    }

    span {
      overflow: hidden;
      // focus underline is otherwise invisible
      line-height: 1.2;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }

  .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner {
    cursor: default;
  }

  .uppy-ProviderBrowserItem-iconWrap {
    width: 20px;
    margin-inline-end: 7px;
  }
}
