/* Word breaking for long tokens - prevents overflow */
.table-responsive table td,
.table-responsive table th {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Sortable column cursor and icon styling */
.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Sort icon styling - prevent layout shift */
.sort-icon {
  display: inline-block;
  width: 1em;
  text-align: center;
  opacity: 0.5;
  font-size: 0.875em;
  transition: opacity 0.2s;
}

.sortable:hover .sort-icon {
  opacity: 1;
}

/* Action column buttons - consistent sizing */
.table .btn-group-sm > .btn,
.table .btn-sm {
  white-space: nowrap;
  min-width: fit-content;
}

/* Ensure buttons don't wrap text */
.table td .btn .glyphicon + * {
  white-space: nowrap;
}

/* Accessibility: focus styles for sortable headers */
.table th.sortable:focus {
  outline: 2px solid #0d6efd;
  outline-offset: -2px;
}

/* Optional: smoother horizontal scroll on mobile */
.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* Fix for transparent sticky headers in some Bootstrap versions */
/* Ensure sticky headers have a background to cover content scrolling behind them */
.table-responsive thead.sticky-top th {
  background-color: #fff;
  box-shadow: inset 0 -1px 0 #dee2e6; /* Adds the border bottom look */
  z-index: 5;
}

/* Fix for very narrow viewports - prevent action column collapse */
@media (max-width: 576px) {
  .table td:last-child,
  .table th:last-child {
    min-width: 120px;
  }
}