@import '@nebular/theme/styles/global/breakpoints';
@import '@nebular/theme/styles/theming';
@import '@nebular/theme/styles/themes';

@include nb-install-component() {
  @include nb-scrollbars(nb-theme(card-scrollbar-color), nb-theme(card-scrollbar-background-color), nb-theme(card-scrollbar-width));

  .inputfile {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: fixed;
    z-index: -1;

    + label {
      width: 100%;
      padding: 0.5rem;
      margin: 0;
      border: 2px dashed nb-theme(color-basic-500);

      &.dragHover {
        border: 2px solid nb-theme(color-info-500);
        box-shadow: inset 0 8px 17px 2px nb-theme(color-info-transparent-100), inset 0 3px 14px 2px nb-theme(color-info-transparent-300),
          inset 0 5px 5px -3px nb-theme(color-info-transparent-500);
      }

      .files {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;

        .file {
          border: 1px solid nb-theme(color-basic-transparent-500);
          border-radius: 4px;
          padding: 0.5rem 1rem;
          display: flex;
          flex-direction: column;

          nb-icon {
            align-self: center;
          }

          & .footer {
            display: grid;
            grid-template-columns: auto auto;
            justify-content: space-between;
            align-items: center;

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

          &.error {
            border-color: nb-theme(color-danger-500);
          }
        }
      }

      .upload-icon {
        font-size: 4rem;
      }

      .button {
        background-color: nb-theme(color-danger-500);
        border-color: nb-theme(color-danger-500);
        color: nb-theme(color-basic-100);
        padding: 0.6875rem 1.125rem;
        border-style: solid;
        border-width: 0.0625rem;
        text-transform: uppercase;
        border-radius: 1.5rem;
        font-size: 0.875rem;
        font-weight: 700;
        line-height: 1rem;
        appearance: none;
        text-align: center;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        vertical-align: middle;
        user-select: none;
        cursor: pointer;

        &:focus {
          background-color: nb-theme(color-danger-600);
          border-color: nb-theme(color-danger-700);
          position: relative;
          outline: none;
          box-shadow: 0 0 0 0.375rem nb-theme(color-basic-700);
        }
      }
    }

    &:disabled + label {
      border-color: nb-theme(color-basic-transparent-300);
      color: nb-theme(color-basic-transparent-600);

      .button {
        background-color: nb-theme(color-basic-transparent-300);
        border-color: nb-theme(color-danger-disabled);
        color: nb-theme(color-danger-400);
      }
    }

    &:focus + label {
      border-color: nb-theme(color-info-500);
      box-shadow: inset 0 8px 17px 2px nb-theme(color-info-transparent-100), inset 0 3px 14px 2px nb-theme(color-info-transparent-300),
        inset 0 5px 5px -3px nb-theme(color-info-transparent-500);
    }
  }

  @include media-breakpoint-up(sm) {
    .inputfile + label {
      padding: 1rem;

      .files {
        grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
        gap: 1rem;

        .fileName {
          max-width: auto;
        }
      }
    }
  }
}
