@import '../../styles/common';

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

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

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

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

.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;
  -webkit-overflow-scrolling: touch;
}

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

.TableRow {
  &:hover .Cell {
    @include breakpoint-after($breakpoint) {
      background: color('sky', 'lighter');
    }
  }
}

.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;
}

.Cell-firstColumn {
  @include text-emphasis-normal;
  text-align: left;
  white-space: normal;
}

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

.Cell-truncated {
  white-space: nowrap;
  overflow-x: hidden;
  text-overflow: ellipsis;
  max-width: $first-column-width;
}

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

.Cell-sortable {
  padding: 0;
}

.Cell-verticalAlignTop {
  vertical-align: top;
}

.Cell-verticalAlignBottom {
  vertical-align: bottom;
}

.Cell-verticalAlignMiddle {
  vertical-align: middle;
}

.Cell-verticalAlignBaseline {
  vertical-align: baseline;
}

.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();
}

.Footer {
  padding: spacing();
  background: color('sky', 'light');
  color: color('ink', 'lighter');
  text-align: center;
}
