@import (reference) "../../styles/less/ring.less";

.np-upload-input__item {
  position: relative;
  padding: var(--size-16);
  display: flex;
  align-items: flex-start;
  border-left: var(--outerBorder);
  border-right: var(--outerBorder);

  &:first-child {
    border-top: var(--outerBorder);
    border-top-left-radius: var(--radius-small);
    border-top-right-radius: var(--radius-small);
  }

  & + .np-upload-input__item {
    &:before {
      content: " ";
      display: block;
      position: absolute;
      height: 1px;
      left: var(--size-16);
      width: calc(100% - 2 * var(--size-16));
      top: 0;
      background: var(--color-border-neutral);
    }
  }

  .np-upload-input__item-content {
    padding-right: var(--size-32);
    flex: 1;

    @media (--screen-400-zoom) {
      padding-right: var(--size-64);
    }
  }

  .np-upload-input__title,
  .np-upload-input__text {
    margin: 0;
    text-align-last: left;
    color: var(--color-content-secondary);
  }

  .np-upload-input__title + .np-upload-input__text {
    margin-top: var(--size-4);
  }

  .np-upload-input__icon {
    padding-right: var(--size-16);
  }

  .np-upload-input__item-link,
  .np-upload-input__item-container {
    align-items: flex-start;
    display: flex;
    width: 100%;
  }

  .np-upload-input__item-action {
    --iconSize: var(--size-24);
    --clickAreaSize: 44px;
    --buttonTopRightOffset: var(--size-16);
    // Offset towards the parent's top-right edge
    // ensuring no overflow on smaller screens
    --clickAreaTopRightOffset: calc((var(--clickAreaSize) - var(--iconSize)) * -.5);

    position: absolute;
    right: var(--buttonTopRightOffset);
    top: var(--buttonTopRightOffset);

    @media (--screen-400-zoom) {
      --iconSize: var(--size-48);
      --clickAreaTopRightOffset: calc(-1 * var(--buttonTopRightOffset));
    }

    .np-upload-input__item-button {
      appearance: none;
      height: var(--iconSize);
      width: var(--iconSize);
      padding: 0 var(--size-4);
      border-radius: 50%;
      border: 0;
      background-color: var(--color-background-neutral);
      color: var(--color-interactive-primary);
      transition: color, background-color 0.15s ease-in-out;
      outline-offset: 0;
      display: flex;
      align-items: center;
      justify-content: center;

      &:before {
        content: '';
        display: block;
        width: var(--clickAreaSize);
        height: var(--clickAreaSize);
        border-radius: 50%;
        position: absolute;
        top: var(--clickAreaTopRightOffset);
        right: var(--clickAreaTopRightOffset);
      }

      &:hover {
        background-color: var(--color-sentiment-negative);
        color: var(--color-contrast-overlay) !important;
      }

      &:active {
        background-color: var(--color-background-neutral-active);
      }
    }
  }

  &.is-interactive {
    padding: 0;

    &:hover:not(:has(.np-upload-input__item-button:hover)) {

      &:before,
      & + .np-upload-input__item:before {
        width: 100%;
        left: 0;
      }
    }

    .np-upload-input__item-link {
      padding: var(--size-16);
      text-decoration: none;
      border-radius: inherit;
      border-top: 1px solid transparent;
      background-clip: padding-box;

      &:focus-visible {
        outline-offset: -2px;
        outline-width: 3px;
      }

      &:hover,
      &:active {
        background-color: var(--color-background-neutral);
      }
    }

    &:first-child {
      .np-upload-input__item-link {
        border-top-width: 0;
      }
    }
  }

  .np-upload-input-errors {
    padding-left: 0;
    list-style-type: "";

    & > li {
      position: relative;
      padding-left: var(--size-16);

      &::before {
        content: '•' / '';
        position: absolute;
        display: block;
        left: 0;
      }

      @media (--screen-400-zoom) {
        padding-left: var(--size-32);
      }
    }
  }
}
