$fixed-column-width: rem(145px);
$breakpoint: 768px;

.ResourceTable {
  position: relative;
  max-width: 100vw;
}

.collapsed {
  .Table {
    &::after {
      display: block;
    }
  }

  .Navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: spacing() spacing(tight);

    @include breakpoint-after($breakpoint, inclusive) {
      justify-content: flex-end;
    }
  }
}

.hasFooter {
  .ScrollContainer {
    margin-bottom: rem(52px);
  }
}

.Navigation {
  display: none;
}

.Pip {
  height: rem(6px);
  width: rem(6px);
  background: color('ink', 'lightest');
  border-radius: border-radius();

  &:not(:last-of-type) {
    margin-right: spacing(extra-tight);
  }
}

.Pip-visible {
  background: color('ink');
}

.ScrollContainer {
  overflow-x: auto;
  // account for a mysterious gap in Safari when not collapsed
  -webkit-overflow-scrolling: touch;
}

.Table {
  width: 100%;
  border-spacing: 0;
}

.TableRow {
  &:hover {
    @include breakpoint-after($breakpoint) {
      background-image: linear-gradient(rgba(223, 227, 232, 0.3), rgba(223, 227, 232, 0.3));
    }
  }
}

.IsDragging {
  border: none !important;
  background-color: white;
}

.TableRowClickable {
  cursor: pointer;

  &:active {
    background-image: linear-gradient(rgba(179, 188, 245, 0.15), rgba(179, 188, 245, 0.15));
  }
}

.TableRowSelected, .TableRowSelected:hover {
  background-image: linear-gradient(rgba(179, 188, 245, 0.15), rgba(179, 188, 245, 0.15));
}

.TableFoot {
  border-bottom: 0;
}

.Cell {
  padding: spacing();
  border-bottom: border-width() solid color('sky', 'light');
  white-space: nowrap;
  text-align: left;
  transition: background-color 0.2s ease-in-out;
  vertical-align: middle;

  &.SelectionCell {
    padding-left: 1.4rem !important;
    padding-right: 0 !important;
    width: 46px !important;
  }
}

.SelectionCell {
  padding: 0;
  border-bottom: border-width() solid color('sky', 'light');
  white-space: nowrap;
  text-align: left;
  transition: background-color 0.2s ease-in-out;
  vertical-align: middle;

  width: 42px !important;
}

.Cell-numeric {
  text-align: right;
}

.Cell-fixed {
  @include text-emphasis-normal;
  @include text-breakword;
  position: absolute;
  top: auto;
  left: 0;
  width: $fixed-column-width;
  white-space: unset;
  text-align: left;
  backface-visibility: hidden; // stops painting on scroll (due to positioning)
}

.Cell-truncated {
  white-space: nowrap;
  overflow-x: hidden;
  text-overflow: ellipsis;
}

.Cell-header {
  @include text-emphasis-normal;
  border-bottom: border(dark);
  border-top: 0;
}

.Cell-sortable {
  padding: 0;
}

.Icon {
  display: flex;
  align-self: flex-end;
  opacity: 0;
  transition: opacity duration() easing(), fill duration() easing();
}

.Heading {
  @include unstyled-button;
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
  align-items: baseline;
  transition: color duration() easing();
  padding: spacing();
  cursor: pointer;

  &:hover,
  &:focus {
    @include recolor-icon(color('indigo'));
    color: color('indigo');

    .Icon {
      opacity: 1;
    }
  }
}

.Heading-left {
  justify-content: flex-start;
  flex-direction: row-reverse;
}

.Cell-sorted {
  .Icon {
    opacity: 1;
  }
}

.Cell-total {
  @include text-emphasis-strong;
  background: color('sky', 'lighter');
  border-bottom: border();
}

.Cell-footer {
  @include text-emphasis-normal;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  border-bottom: 0;
  background: color('sky', 'light');
  color: color('ink', 'lighter');
  white-space: unset;
  text-align: center;
  backface-visibility: hidden; // stop painting on scroll (due to positioning)
}

.HideCheckableButtonWrapper {
  display: none;
}