// Data rows and cells: striping, hover, selection, merge layer, alignment,
// boolean checkboxes, and the data-map dropdown affordance.

.apg-row {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--apg-row-height);
  background: var(--apg-cell-bg);
  will-change: transform;
  contain: layout style;

  &.apg-row-alt {
    background: var(--apg-cell-bg-alt);
  }

  &:hover {
    background: var(--apg-hover-bg);
  }
}

.apg-cell {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: var(--apg-cell-padding);
  border-right: var(--apg-border);
  border-bottom: var(--apg-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  &.apg-cell-selected {
    background: var(--apg-selected-bg);
  }

  &.apg-cell-active {
    box-shadow: inset 0 0 0 2px var(--apg-active-border);
    border-radius: 1px;
  }
}

// Merge layer: spanning cells paint here, above the normal rows.
.apg-merge-layer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.apg-cell-merged {
  background: var(--apg-cell-bg);
  align-items: center;
  border-left: var(--apg-border);
  border-top: var(--apg-border);

  &.apg-cell-selected {
    background: var(--apg-selected-bg);
  }
}

// Data-mapped, editable cells show a chevron at rest so they read as dropdowns.
.apg-cell-dropdown {
  padding-right: 20px;

  &::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    margin-top: -2px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--apg-header-fg);
    opacity: 0.5;
    pointer-events: none;
  }
}

.apg-align-left {
  justify-content: flex-start;
}

.apg-align-center {
  justify-content: center;
}

.apg-align-right {
  justify-content: flex-end;
}

.apg-cell-bool::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--apg-checkbox-border);
  border-radius: var(--apg-radius-sm);
  background: var(--apg-cell-bg);
  transition:
    border-color 0.12s ease,
    background-color 0.12s ease;
}

.apg-cell-bool.apg-checked::before {
  border-color: var(--apg-active-border);
  background: var(--apg-active-border)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5'><path d='M3 8.5l3.5 3.5L13 4.5'/></svg>")
    center / 12px no-repeat;
}

.apg-cell-template {
  overflow: hidden;
}

// Drop marker shown while dragging a column to reorder.
.apg-col-drop-marker {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  margin-left: -1px;
  background: var(--apg-active-border);
  pointer-events: none;
  z-index: 5;
}
