.formGeneratorTable {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  font-family: var(--font-family);
  /* Fill available space and constrain height */
  min-height: 0;
  flex: 1;
  /* No overflow - children handle their own scrolling */
}

.title {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text);
  margin: 0;
  margin-bottom: 10px;
}

/* Table Container - scrollable area for table data only */
.tableContainer {
  position: relative;
  overflow: auto;
  border: 1px solid var(--color-primary);
  border-radius: 25px;
  background: var(--color-bg);
  /* Fill remaining space after controls */
  flex: 1;
  min-height: 0;
  /* Clip content to border-radius but allow sticky to work */
  isolation: isolate;
}

/* Empty table styling - no extra space, just header */
.emptyTable {
  min-height: auto;
  height: auto;
  max-height: none;
}

/* Empty state styling */
.emptyState {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 40px 20px;
}

/* Empty message styling */
.emptyMessage {
  text-align: center;
  padding: 20px;
  color: var(--color-text);
  opacity: 0.7;
  font-size: 1rem;
  line-height: 1.5;
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  font-size: 16px;
  color: var(--color-text);
}

/* Table Styles */
.table {
  width: 100%;
  /* Use separate borders for sticky header support */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  background: var(--color-bg);
  table-layout: fixed;
  word-wrap: break-word;
}

/* Disabled user row styling */
.table tbody tr[data-user-enabled="false"] {
  opacity: 0.6 !important;
  background-color: rgba(0, 0, 0, 0.02) !important;
}

.table tbody tr[data-user-enabled="false"]:hover {
  opacity: 0.8 !important;
  background-color: rgba(0, 0, 0, 0.05) !important;
}

/* Dark mode disabled user styling */
.dark .table tbody tr[data-user-enabled="false"] {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

.dark .table tbody tr[data-user-enabled="false"]:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Sticky thead for table header */
.table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  /* Shadow to separate header from scrolled content */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table thead tr {
  background: var(--color-bg);
}

.th {
  background: var(--color-bg);
  padding: 10px 16px;
  text-align: left;
  font-weight: 400;
  color: var(--color-text);
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  user-select: none;
  overflow: visible;
  /* Border separates header from scrolled content */
  border-bottom: 2px solid var(--color-primary);
  /* Shadow on the row, not individual cells */
}

.th.actionsColumn {
  text-align: center;
}

.th.sortable {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.th.sortable:hover {
  background: var(--color-gray-disabled);
}

.headerContent {
  display: flex;
  align-items: center;
  justify-content: left;
  gap: 4px;
}

.columnLabel {
  cursor: pointer;
  flex: 1;
}

.sortIcon {
  font-size: 12px;
  color: var(--color-text-secondary, #999);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}

.sortIcon:hover {
  color: var(--color-secondary);
}

.sortIcon.sortActive {
  color: var(--color-secondary);
  font-weight: 600;
}

.sortIcon sub {
  font-size: 9px;
  font-weight: 500;
}

/* Filter icon in column header */
.filterIcon {
  background: none;
  border: none;
  color: var(--color-text-secondary, #999);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.filterIcon:hover {
  color: var(--color-secondary);
  background: rgba(var(--color-secondary-rgb), 0.1);
}

.filterIcon.filterActive {
  color: var(--color-secondary);
  background: rgba(var(--color-secondary-rgb), 0.15);
}

/* Filter dropdown */
.filterDropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  max-width: 300px;
  background: var(--color-bg);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  margin-top: 4px;
}

.filterDropdownHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border, #ddd);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
}

.filterClearBtn {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}

.filterClearBtn:hover {
  background: rgba(255, 0, 0, 0.1);
  color: #c00;
}

.filterDropdownOptions {
  max-height: 250px;
  overflow-y: auto;
  padding: 4px 0;
}

.filterOption {
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filterOption:hover {
  background: var(--color-gray-disabled, #f5f5f5);
}

.filterOptionSelected {
  background: rgba(var(--color-secondary-rgb), 0.15);
  color: var(--color-secondary);
  font-weight: 500;
}

.filterOptionSelected:hover {
  background: rgba(var(--color-secondary-rgb), 0.2);
}

.filterOptionMore {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--color-text-secondary);
  font-style: italic;
}

.resizeHandle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
  background: transparent;
}

.resizeHandle:hover {
  background: var(--color-secondary);
  opacity: 0.5;
}

.resizeHandle:active {
  background: var(--color-secondary);
  opacity: 0.8;
}

.td {
  padding: 12px 16px;
  border-top: 1px solid var(--color-primary);
  color: var(--color-text);
  vertical-align: middle;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  overflow: visible;
}

/* FK Loading state - shows truncated ID while loading */
.fkLoading {
  color: var(--color-text);
  opacity: 0.6;
  font-style: italic;
}

.tr {
  transition: background-color 0.2s ease;
}

.tr:hover {
  background: transparent;
}

.tr.selected {
  background: rgba(var(--color-secondary-rgb), 0.1);
}

.tr.clickable {
  cursor: pointer;
}

/* Selection Column */
.selectColumn {
  text-align: center;
  padding: 8px !important;
  background: var(--color-bg);
  position: relative;
}

/* Selection column header - background inherited from thead */
thead .selectColumn {
  background: var(--color-bg);
}

/* Selection Column border only on body cells, not header */
tbody .selectColumn {
  border-top: 1px solid var(--color-primary);
}

.selectColumn input[type="checkbox"] {
  cursor: pointer;
  transform: scale(1.3);
  width: 16px;
  height: 16px;
  accent-color: var(--color-secondary);
  margin: 0;
  padding: 0;
  border: 2px solid var(--color-primary);
  border-radius: 3px;
  background: var(--color-bg);
  position: relative;
  z-index: 1;
  appearance: auto;
  -webkit-appearance: checkbox;
  -moz-appearance: checkbox;
}

.selectColumn input[type="checkbox"]:checked {
  background-color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.selectColumn input[type="checkbox"]:hover {
  border-color: var(--color-secondary);
}

.selectColumn input[type="checkbox"]:focus {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Actions Column - Fixed width like select column */
.actionsColumn {
  white-space: nowrap;
  text-align: center;
  padding: 8px !important;
  font-weight: 400;
  box-sizing: border-box;
  background: var(--color-bg);
  position: relative;
}

/* Actions column header - background inherited from thead */
thead .actionsColumn {
  background: var(--color-bg);
}

/* Actions Column border only on body cells, not header */
tbody .actionsColumn {
  border-top: 1px solid var(--color-primary);
}

.actionButtons {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0 auto;
}

/* Enable wrapping only when column exceeds 20% of container width */
.actionButtonsWrap {
  flex-wrap: wrap;
}

.actionButton {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  min-width: 28px;
  min-height: 28px;
  background: var(--color-secondary);
  color: var(--color-bg);
}

.actionButton:hover {
  background: var(--color-secondary-hover);
}

.actionIcon {
  font-size: 16px;
  height: 16px;
  width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Delete Confirmation Buttons */
.deleteConfirmButtons {
  display: flex;
  gap: 2px;
  justify-content: center;
  align-items: center;
  background: var(--color-secondary);
  border-radius: 25px;
}

.confirmButton {
  background: transparent !important;
  color: white !important;
}

.confirmButton:hover {
  background: transparent !important;
  transform: scale(1.05);
}

.cancelButton {
  background: transparent !important;
  color: white !important;
}

.cancelButton:hover {
  background: transparent !important;
  transform: scale(1.05);
}

.actionButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  /* Ensure pagination stays visible and doesn't get cut off */
  flex-shrink: 0;
  flex-wrap: wrap;
  background: var(--color-bg);
}

.pageSizeSelector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text);
}

.pageSizeSelector label {
  white-space: nowrap;
  font-family: var(--font-family);
}

.pageSizeSelect {
  height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--color-primary);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  min-width: 60px;
}

.pageSizeSelect:focus {
  outline: none;
  border-color: var(--color-secondary);
}

.paginationButton {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: var(--color-secondary);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-family: var(--font-family);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
}

.paginationButton:hover:not(:disabled) {
  background: var(--color-secondary-hover);
}

.paginationButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.paginationInfo {
  font-size: 14px;
  color: var(--color-text);
  margin: 0 15px;
  white-space: nowrap;
}

/* Page numbers container */
.pageNumbers {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  justify-content: flex-start;
  max-width: 60vw;
  max-height: 120px;
  overflow-y: auto;
  padding: 4px;
}

/* Individual page number button */
.pageNumber {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--color-border, #ddd);
  background: var(--color-bg, #fff);
  color: var(--color-text);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 12px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pageNumber:hover:not(:disabled) {
  background: var(--color-secondary);
  color: white;
  border-color: var(--color-secondary);
}

.pageNumber:disabled {
  cursor: default;
}

/* Active/current page number */
.pageNumberActive {
  background: var(--color-secondary);
  color: white;
  border-color: var(--color-secondary);
  font-weight: 600;
}

/* Ellipsis indicator */
.pageEllipsis {
  padding: 0 8px;
  color: var(--color-text-secondary, #666);
  font-size: 14px;
}

/* Loading overlay */
.loadingOverlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 8px;
}

.loadingOverlay p {
  margin-top: 12px;
  color: var(--color-text-secondary, #666);
  font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .tableContainer {
    flex: 1;
    min-height: 0;
    max-height: 100%;
  }
  
  /* Empty table styling - no extra space */
  .emptyTable {
    min-height: auto;
    height: auto;
  }

  .th,
  .td {
    padding: 8px 12px;
    font-size: 13px;
  }

  .actionButtons {
    flex-direction: column;
    gap: 4px;
  }

  .actionButton {
    padding: 4px 8px;
    font-size: 11px;
  }

  .pagination {
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  .pageSizeSelector {
    order: -1;
    justify-content: center;
  }

  .paginationInfo {
    text-align: center;
    margin: 0;
    font-size: 13px;
  }

  .pageNumbers {
    max-width: 100%;
    justify-content: center;
  }

  .pageNumber {
    min-width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
  .th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .tr:hover {
    background: transparent;
  }

  .tr.selected {
    background: rgba(var(--color-secondary-rgb), 0.2);
  }

  .loadingOverlay {
    background: rgba(30, 30, 30, 0.9);
  }

  .pageNumber {
    background: var(--color-bg, #2d2d2d);
    border-color: var(--color-border, #444);
  }
}

/* Accessibility */
.actionButton:focus,
.paginationButton:focus {
  outline: none;
}

/* Custom scrollbar for table container */
.tableContainer::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tableContainer::-webkit-scrollbar-track {
  background: var(--color-gray-disabled);
  border-radius: 4px;
}

.tableContainer::-webkit-scrollbar-thumb {
  background: var(--color-gray);
  border-radius: 4px;
}

.tableContainer::-webkit-scrollbar-thumb:hover {
  background: var(--color-secondary);
}

/* Loading State */
.loadingState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--color-text-secondary, #666);
}

.loadingSpinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-bg-secondary, #e9ecef);
  border-top: 3px solid var(--color-primary, #007bff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Inline Editable Boolean Cells */
.booleanCell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 4px;
  transition: all 0.15s ease;
  user-select: none;
}

.booleanEditable {
  cursor: pointer;
  background: transparent;
  border: 2px solid var(--color-border, #dee2e6);
}

.booleanEditable:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.booleanEditable:active {
  transform: scale(0.95);
}

.booleanEditable.booleanTrue {
  color: var(--color-success, #28a745);
  border-color: var(--color-success, #28a745);
  background: rgba(40, 167, 69, 0.1);
}

.booleanEditable.booleanTrue:hover {
  background: rgba(40, 167, 69, 0.2);
}

.booleanEditable.booleanFalse {
  color: var(--color-text-secondary, #6c757d);
  border-color: var(--color-border, #dee2e6);
  background: transparent;
}

.booleanEditable.booleanFalse:hover {
  color: var(--color-danger, #dc3545);
  border-color: var(--color-danger, #dc3545);
  background: rgba(220, 53, 69, 0.1);
}

.booleanReadonly {
  cursor: default;
  background: transparent;
  border: none;
  opacity: 0.7;
}

.booleanReadonly.booleanTrue {
  color: var(--color-success, #28a745);
}

.booleanReadonly.booleanFalse {
  color: var(--color-text-secondary, #adb5bd);
}

.booleanLoading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: booleanPulse 1s ease-in-out infinite;
  color: var(--color-primary, #007bff);
  font-size: 14px;
}

@keyframes booleanPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

