@use "sass:color";

@use './_variables.scss' as *;
@use './_utils.scss' as *;

/**
* General Uppy styles that apply to everything inside the .uppy-Root container
*/

.uppy-Root {
  position: relative;
  box-sizing: border-box;
  color: $gray-800;
  font-family: $font-family-base;
  line-height: 1;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

// One selector uses the dir attribute declared by the page. If that does not exist, Uppy adds a
// fallback dir attribute on the root element itself, and we need a second selector to match that.
[dir='rtl'] .uppy-Root,
.uppy-Root[dir='rtl'] {
  text-align: right;
}

.uppy-Root *,
.uppy-Root *::before,
.uppy-Root *::after {
  box-sizing: inherit;
}

.uppy-Root [hidden] {
  display: none;
}

// Utilities

.uppy-u-reset {
  all: initial;
  box-sizing: border-box;
  appearance: none;
  font-family: $font-family-base;
  line-height: 1;
}

[dir='rtl'] .uppy-u-reset {
  text-align: right;
}

.uppy-truncate-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

// Inputs

.uppy-c-textInput {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 6px 8px;
  background-color: $white;
  border: 1px solid #ddd;
  border-radius: 4px;

  .uppy-size--md & {
    padding: 8px 10px;
  }

  &:focus {
    border-color: rgba($blue, 0.6);
    outline: none;
    box-shadow: 0 0 0 3px rgba($blue, 0.15);
  }

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

  [data-uppy-theme='dark'] &:focus {
    border-color: $gray-700;
    box-shadow: none;
  }
}

// Icon

// https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4
.uppy-c-icon {
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  fill: currentColor;
}

// Buttons

.uppy-c-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-weight: 500;
  font-size: inherit;
  font-family: inherit;
  color: inherit;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  // vertical-align: middle;
  transition-duration: 0.3s;
  transition-property: background-color, color;
  user-select: none;

  // Override right-to-left variant of the uppy-u-reset class
  [dir='rtl'] & {
    text-align: center;
  }
}

.uppy-c-btn:not(:disabled):not(.disabled) {
  cursor: pointer;
}

.uppy-c-btn::-moz-focus-inner {
  border: 0;
}

.uppy-c-btn-primary {
  padding: 10px 18px;
  color: $white;
  font-size: 14px;
  background-color: $blue;
  border-radius: 4px;

  &:not(:disabled):hover {
    background-color: color.adjust($blue, $lightness: -10%, $space: hsl);
  }

  &:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba($blue, 0.4);
  }

  .uppy-size--md & {
    padding: 13px 22px;
  }

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

    @include blue-border-focus--dark;
  }

  &.uppy-c-btn--disabled {
    background-color: rgb(142, 178, 219);
  }
}

.uppy-c-btn-link {
  padding: 10px 15px;
  color: $gray-700;
  font-size: 14px;
  line-height: 1;
  background-color: transparent;
  border-radius: 4px;

  &:hover {
    color: $gray-800;
  }

  &:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba($blue, 0.25);
  }

  .uppy-size--md & {
    padding: 13px 18px;
  }

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

    @include blue-border-focus--dark;
  }

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