@import "ui-variables";

.nuclide-ui-table {
  border: 1px solid @base-border-color;
  table-layout: fixed;
  width: 100%;
  -webkit-user-select: none;

  // Hack around a Chrome rendering bug by which resizing columns doesn't redraw
  // their borders.
  transform: translate3d(0, 0, 0);
}

.nuclide-ui-table-body {
  border-top: none;
}

.nuclide-ui-table-body-selectable-text {
  -webkit-user-select: text;
}

.nuclide-ui-table-header {
  font-weight: bold;
  background-color: @pane-item-background-color;
  border-bottom: 1px solid @base-border-color;
}

.nuclide-ui-table-header, .nuclide-ui-table-row {
  display: flex;
}

.nuclide-ui-table-full-header {
  width: 100%;
}

.nuclide-ui-table-header-cell,
.nuclide-ui-table-body-cell {
  border-right: 1px solid @base-border-color;
  overflow: hidden;
  padding: 2px 6px;
}

.nuclide-ui-table-body-cell {
  word-break: break-word;
  text-overflow: inherit;
}

.nuclide-ui-table-header-cell {
  -webkit-user-select: none;
  position: relative;
  text-overflow: ellipsis;
  vertical-align: baseline; // align sort icons with text
  white-space: nowrap;
}

.nuclide-ui-table-header-cell-sortable {
  cursor: pointer;
}

.nuclide-ui-table-header-cell-sortable:hover {
  color: @text-color-highlight;
}

.nuclide-ui-table-sort-indicator {
  // We want the icon to take up horizontal space so that it's taken into
  // account when centering the heading, but NOT add any height. In order to
  // accomplish this, we give a width and height to the the container and then
  // absolutely position the icon within it.
  position: relative;
  display: inline-block;
  transform: scale(0.6);
  width: 1em;
  height: 1em;

  .icon {
    position: absolute;
    left: 0;
    top: 0;
  }
}

.nuclide-ui-table-header-resize-handle {
  cursor: ew-resize;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  margin-right: -3px;
  z-index: 1;
}

.nuclide-ui-table-row-alternate {
  background-color: @background-color-highlight;
}

.nuclide-ui-table-row-selectable {
  cursor: pointer;
}

.nuclide-ui-table-row-selectable:not(.nuclide-ui-table-row-using-keyboard-nav):hover  {
  background-color: @background-color-selected;
  color: @text-color-selected;
}

.nuclide-ui-table-row-disabled {
  color: @text-color-subtle;
}

.nuclide-ui-table-row-selected {
  background-color: @background-color-selected;
  color: @text-color-selected;

  .nuclide-ui-table:focus &,
  .nuclide-ui-table:focus & a {
    background: @button-background-color-selected;
    color: contrast(@button-background-color-selected);
  }
}

.nuclide-ui-table-collapsed-row {
  word-break: break-word;
  text-overflow: ellipsis;

  .nuclide-ui-table-body-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.nuclide-ui-table-empty-message {
  font-style: italic;
  padding: 1em;
  text-align: center;
}
