/* React Data Grid styles */
@import 'react-data-grid/lib/styles.css';

@layer base {
  :root {
    --rdg-border-color: var(--alpha-8);
    --rdg-background-color: rgb(var(--semantic-1));
    --rdg-row-hover-color: var(--alpha-4);
    --rdg-background-color-edit: rgb(var(--semantic-1));
    --rdg-header-row-background-color: rgb(var(--semantic-1));
    --rdg-outline-color: rgb(var(--foreground));
    --rdg-cell-frozen-box-shadow: none;
  }

  .rdg-dark {
    --rdg-border-color: var(--alpha-8);
    --rdg-background-color: rgb(var(--semantic-1));
    --rdg-row-hover-color: var(--alpha-4);
    --rdg-background-color-edit: rgb(var(--semantic-1));
    --rdg-header-row-background-color: rgb(var(--semantic-1));
    --rdg-outline-color: rgb(var(--foreground));
    --rdg-cell-frozen-box-shadow: none;
  }
}

.rdg-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  border-right: 1px solid var(--rdg-border-color);
  border-bottom: 1px solid var(--rdg-border-color);
  padding-inline: 6px;
}

.rdg-header-row .rdg-cell {
  border-bottom: 1px solid var(--rdg-border-color);
  background-color: var(--rdg-header-row-background-color) !important;
  font-weight: 400;
  color: rgb(var(--muted-foreground));
}

.rdg-row .rdg-cell:first-child,
.rdg-header-row .rdg-cell:first-child {
  padding-left: 12px;
}

.rdg-row {
  background-color: rgb(var(--semantic-0));
}

.rdg-row:hover,
.rdg-row[aria-selected='true'],
.rdg-row[aria-selected='true']:hover {
  background-color: var(--rdg-row-hover-color);
}

.rdg-cell[aria-selected='true'] {
  outline: 1px solid rgb(var(--foreground));
  outline-offset: -1px;
  box-shadow: none;
}

/* Disable selection styling for disabled cells in link record dialog */
.rdg-cell.link-record-dialog-disabled-cell[aria-selected='true'] {
  outline: none !important;
  box-shadow: none !important;
}

.rdg-cell.rdg-cell-editing {
  background-color: var(--rdg-background-color-edit);
}

/* Hide default sorting indicators; we render our own */
.rdg-sort-arrow,
.rdg-header-row .rdg-cell .rdg-sort-arrow,
.rdg-header-row .rdg-cell[aria-sort='ascending']::after,
.rdg-header-row .rdg-cell[aria-sort='descending']::after,
.rdg-header-row .rdg-cell::after {
  display: none !important;
}

/* Selection column */
.rdg-cell[data-column-key='rdg-select-column'],
.rdg-header-row .rdg-cell[data-column-key='rdg-select-column'],
.rdg .rdg-cell[data-column-key='select-row'] {
  justify-content: flex-start;
  padding-left: 10px;
  padding-right: 10px;
}

.rdg-header-row .rdg-cell[aria-sort] {
  cursor: pointer;
}

/* Prevent accidental interactions while dragging columns */
.rdg .rdg-viewport-dragging .rdg-row {
  pointer-events: none;
}

/* Ensure dropdown menu doesn't cause layout shift */
[data-radix-popper-content-wrapper] {
  position: fixed !important;
}
