.navds-table {
  width: 100%;
  border-collapse: collapse;
  display: table;
}

.navds-table__header {
  display: table-header-group;
}

.navds-table__body {
  display: table-row-group;

  & .navds-table__row--shade-on-hover:not(.navds-table__expandable-row--expansion-disabled):hover {
    background-color: var(--ax-bg-neutral-hoverA);
    transition: background-color 70ms cubic-bezier(0.2, 0, 0, 1);
  }

  & .navds-table__row--shade-on-hover.navds-table__row--selected:hover {
    background-color: var(--ax-bg-accent-hoverA);
  }
}

.navds-table__row {
  display: table-row;
}

.navds-table__row--selected {
  background-color: var(--ax-bg-accent);
}

.navds-table--zebra-stripes {
  & .navds-table__body :where(.navds-table__row:nth-child(odd):not(.navds-table__row--selected)) {
    background-color: var(--ax-bg-neutral);
  }

  & .navds-table__body :where(.navds-table__expandable-row:nth-child(4n + 1):not(.navds-table__row--selected)) {
    background-color: transparent;
  }
}

.navds-table--zebra-stripes .navds-table__body .navds-table__expanded-row:nth-child(4n) {
  background-color: var(--ax-bg-neutral);
}

.navds-table__header-cell,
.navds-table__data-cell {
  display: table-cell;
  padding: var(--ax-spacing-3) var(--ax-spacing-2);
  border-bottom: 1px solid var(--ax-border-default);
  text-align: left;
}

.navds-table__header .navds-table__header-cell,
.navds-table__header .navds-table__data-cell {
  border-bottom-width: 2px;
}

.navds-table__header-cell--align-right,
.navds-table__data-cell--align-right {
  text-align: right;
}

.navds-table__header-cell--align-center,
.navds-table__data-cell--align-center {
  text-align: center;
}

:where(.navds-table__body .navds-table__row--shade-on-hover:hover) .navds-table__header-cell,
:where(.navds-table__body .navds-table__row--shade-on-hover:hover) .navds-table__data-cell {
  border-color: var(--ax-border-strong);
}

:where(.navds-table__expandable-row--open:hover) .navds-table__data-cell {
  border-bottom-color: transparent;
}

.navds-table--large .navds-table__header-cell,
.navds-table--large .navds-table__data-cell {
  padding: var(--ax-spacing-4) var(--ax-spacing-2);
}

.navds-table--small .navds-table__header-cell,
.navds-table--small .navds-table__data-cell {
  padding: var(--ax-spacing-1) var(--ax-spacing-2);
}

.navds-table :not(.navds-checkboxes) > .navds-checkbox .navds-checkbox__input {
  top: -0.75rem;
}

.navds-table :not(.navds-checkboxes) > .navds-checkbox--small .navds-checkbox__input {
  top: -0.375rem;
}

.navds-table :not(.navds-checkboxes) > .navds-checkbox .navds-checkbox__label {
  padding: 0;
}

.navds-table__header-cell[aria-sort] {
  padding: 0;
}

.navds-table__sort-button {
  appearance: none;
  background: none;
  color: var(--ax-text-accent);
  border: none;
  cursor: pointer;
  margin: 0;
  padding: var(--ax-spacing-4) var(--ax-spacing-3);
  width: 100%;
  display: flex;
  gap: var(--ax-spacing-2);
  align-items: center;
  line-height: inherit;
  font-weight: inherit;
}

.navds-table--small .navds-table__sort-button {
  padding: var(--ax-spacing-2) var(--ax-spacing-3);
}

.navds-table__sort-button:hover {
  background-color: var(--ax-bg-neutral-hoverA);
}

.navds-table__sort-button:focus-visible {
  outline: 2px solid var(--ax-border-focus);
  outline-offset: -4px;
}

.navds-table__header-cell[aria-sort="ascending"] .navds-table__sort-button,
.navds-table__header-cell[aria-sort="descending"] .navds-table__sort-button {
  background-color: var(--ax-bg-accent-moderate);
  color: var(--ax-text-accent-strong);
}

.navds-table__header-cell--align-right .navds-table__sort-button {
  justify-content: flex-end;
}

.navds-table__header-cell--align-center .navds-table__sort-button {
  justify-content: center;
}

.navds-table__sort-button svg {
  font-size: 1rem;
  flex-shrink: 0;
}

.navds-table__expandable-row:not(.navds-table__expandable-row--open) .navds-table__data-cell {
  transition: border-bottom-color 150ms cubic-bezier(0.95, 0.05, 0.8, 0.04);
}

.navds-table__expandable-row.navds-table__expandable-row--clickable:not(.navds-table__expandable-row--expansion-disabled):hover {
  cursor: pointer;
}

.navds-table__expandable-row--open .navds-table__data-cell {
  border-bottom-color: transparent;
}

.navds-table__expandable-row--open .navds-table__header-cell {
  border-color: var(--ax-border-default);
}

.navds-table__expandable-row--open .navds-table__toggle-expand-cell--open {
  border-color: transparent;
}

.navds-table__toggle-expand-cell {
  padding: 0;
  width: 3rem;
}

.navds-table--large .navds-table__toggle-expand-cell {
  padding: 0 var(--ax-spacing-2);
}

.navds-table--small .navds-table__toggle-expand-cell {
  padding: var(--ax-spacing-1) var(--ax-spacing-2);
}

.navds-table__toggle-expand-button {
  display: grid;
  place-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: var(--ax-border-radius-medium);
  height: 2rem;
  width: 2rem;
  font-size: 1.5rem;
  margin: 0 auto;
  transition: background-color 70ms cubic-bezier(0.2, 0, 0, 1);
}

.navds-table__expandable-icon {
  transition: transform 250ms cubic-bezier(0.2, 0, 0, 1);
}

.navds-table__expandable-row:not(.navds-table__expandable-row--expansion-disabled) .navds-table__toggle-expand-cell:hover {
  cursor: pointer;
}

.navds-table__toggle-expand-button:hover,
.navds-table__toggle-expand-cell:hover > .navds-table__toggle-expand-button,
.navds-table__expandable-row--clickable:hover .navds-table__toggle-expand-button {
  background-color: var(--ax-bg-neutral-hoverA);
}

.navds-table__toggle-expand-cell--open > :where(.navds-table__toggle-expand-button) :where(.navds-table__expandable-icon) {
  transform: rotateX(180deg);
}

.navds-table__toggle-expand-button:focus-visible {
  outline: 2px solid var(--ax-border-focus);
}

.navds-table__expanded-row-cell {
  padding: 0;

  &:empty {
    display: none;
  }
}

/* -------------------------- Table ExpandableRow -------------------------- */
.navds-table__expanded-row-collapse:not([style*="height: 0px;"]),
.navds-table__expanded-row-collapse[style*="transition:"] {
  border-bottom: 1px solid var(--ax-border-default);
}

.navds-table__expanded-row-content {
  padding: var(--ax-spacing-4) calc(var(--ax-spacing-2) + 3rem);
}

.navds-table--small .navds-table__expanded-row-content {
  padding: var(--ax-spacing-2) calc(var(--ax-spacing-2) + 3rem);
}
