:root {
  --hover-highlight-line-width: 0.25rem;
}

.list-row {
  position: relative;
  overflow: hidden;

  background-color: var(--color--background-light);

  &::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: var(--hover-highlight-line-width);
    height: 100%;
    background-color: var(--color--primary-light);
    transform: translateX(calc(-1 * var(--hover-highlight-line-width)));
    transition: transform var(--transition-duration--fast) var(--transition-timing--base);
  }
}

.list-row:hover:has(.list-row__link) {
  background-color: var(--color-hover);

  &::after {
    transform: none;
  }

  & .list-row__link::after {
    opacity: 1;
  }
}

.list-row--with-grid {
  display: grid;
  grid-template-columns: 1fr min-content;
  grid-template-rows: min-content min-content;
  align-items: center;
  gap: var(--space--base);

  padding: var(--space--base);
  margin: 0;

  border: var(--border--light);

  &:not(:last-child) {
    border-bottom: none;
  }
}

/* Used for instance row */
.list-row--secondary {
  padding-block: var(--space--x-small);
  background-color: var(--color--background-base);
}

/* Sections within list row with grid */
.list-row__main {
  display: flex;
  align-items: center;
  gap: var(--space--base);

  & a {
    text-decoration: none;
  }
}

.list-row__secondary {
  grid-row: 2 / 3;
}

.list-row__link {
  text-decoration: none;

  transition: background-color var(--transition-duration--fast) var(--transition-timing--base);
}

.list-row__link::after {
  /* Expands the touch target for the link to cover the entire container */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.list-row__actions {
  display: flex;
  justify-content: flex-end;
  position: relative;

  /*
    Only allow clicking on buttons within the "actions" container, not the 
    container itself so that the list-row link expanded touch target still works.
  */
  pointer-events: none;

  &>* {
    pointer-events: auto;
  }
}

.list-row__icon {
  flex-shrink: 0;
}

.list-row__data-container {
  flex: 1;
  display: block;
  overflow: hidden;
}

.list-row__data {
  display: flex;
  flex-wrap: wrap;
  height: min-content;
  gap: var(--space--xx-small);

  &>* {
    text-wrap: nowrap;
  }
}

.list-row__data-item {
  display: flex;
  margin: 0;

  background-color: var(--color--background-light);
  border: var(--border--light);
  border-radius: var(--border-radius--small);

  &>* {
    /* Style spans for key and value */
    display: inline-block;
    padding: 0 var(--space--xx-small);
  }

  &>*:not(:last-child) {
    border-right: var(--border--light);
  }
}

@media (min-width: 1000px) {
  .list-row {
    grid-template-columns: 3fr 2fr 1fr;
    grid-template-rows: min-content;
  }

  .list-row__secondary {
    grid-row: 1 / 2;
    grid-column: 2 / 3;
  }

  .list-row__data-container {
    position: relative;
    max-width: 25vw;

    /* Fade out effect for overflowing data */
    &::after {
      content: "";
      position: absolute;
      top: 0;
      right: 0;
      width: var(--space--large);
      height: 100%;
      background: linear-gradient(to left, var(--color--background-base), transparent);
    }
  }

  .list-row__data {
    flex-wrap: nowrap;
  }
}
