/* ============================================
   Tables - Reusable Table Styles
   ============================================ */

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

.table-wrapper::-webkit-scrollbar {
  height: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

thead th {
  background: #F8FAFC;
  backdrop-filter: blur(8px);
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

tbody td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Monospace values */
td.mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Cell with icon */
td .cell-with-icon {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Status indicators in tables */
td .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

td .status-dot.active {
  background: var(--color-success);
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

td .status-dot.inactive {
  background: var(--color-warning);
}

td .status-dot.blocked {
  background: var(--color-danger);
}

/* Action buttons in tables */
td .table-actions {
  display: flex;
  gap: var(--space-sm);
}

td .table-action-btn {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 550;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all var(--transition-fast);
}

td .table-action-btn:hover {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

td .table-action-btn.danger:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
}

/* Table footer */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Activity table - compact */
.activity-table {
  font-size: 0.82rem;
}

.activity-table td {
  padding: var(--space-sm) var(--space-lg);
}

.activity-table .activity-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
}

.activity-table .activity-type.detect {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.activity-table .activity-type.block {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.activity-table .activity-type.redact {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.activity-table .activity-type.allow {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* Heatmap table */
.heatmap-table td {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: var(--space-sm);
}

.heatmap-cell {
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  display: inline-block;
  min-width: 36px;
}

.heatmap-cell.level-0 { background: #F1F5F9; color: var(--text-tertiary); }
.heatmap-cell.level-1 { background: #DBEAFE; color: #1E40AF; }
.heatmap-cell.level-2 { background: #BFDBFE; color: #1E3A8A; }
.heatmap-cell.level-3 { background: #93C5FD; color: #1E3A8A; }
.heatmap-cell.level-4 { background: #60A5FA; color: white; }
.heatmap-cell.level-5 { background: #3B82F6; color: white; }

/* ============================================
   Users Table — Sortable / Filterable
   ============================================ */

/* Sortable headers */
th.ut-sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

th.ut-sortable:hover {
  color: var(--text-primary);
}

th .ut-sort-indicator {
  display: inline-block;
  margin-left: 3px;
  font-size: 0.55rem;
  letter-spacing: -1px;
  opacity: 0.25;
  transition: all var(--transition-fast);
  vertical-align: middle;
}

th.ut-sorted .ut-sort-indicator {
  opacity: 1;
  color: var(--brand-primary);
}

/* Filter row */
tr.ut-filter-row th {
  padding: var(--space-xs) var(--space-lg);
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-default);
}

tr.ut-filter-row input.ut-col-filter {
  width: 100%;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-family: var(--font-sans);
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

tr.ut-filter-row input.ut-col-filter:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(21, 94, 239, 0.1);
}

tr.ut-filter-row input.ut-col-filter::placeholder {
  color: var(--text-tertiary);
  font-size: 0.68rem;
}

/* Clickable rows */
tr.ut-clickable-row {
  cursor: pointer;
}

tr.ut-clickable-row:hover {
  background: rgba(21, 94, 239, 0.025) !important;
}

/* Group badge — uses inline --gc custom property for dynamic color */
.ut-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 550;
  white-space: nowrap;
  color: var(--gc, #155EEF);
  background: color-mix(in srgb, var(--gc, #155EEF) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--gc, #155EEF) 18%, transparent);
}

/* Disabled detection rule row */
tr.dr-disabled {
  opacity: 0.4;
}

tr.dr-disabled:hover {
  opacity: 0.55;
}

/* ============================================
   Group Cards
   ============================================ */

.groups-grid {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-width: 180px;
  flex: 1;
  max-width: 260px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.group-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.group-card--default {
  border-left: 3px solid var(--brand-primary);
}

.group-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.group-card__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-card__name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.group-card__default-tag {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand-primary);
  background: rgba(21, 94, 239, 0.06);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.group-card__members {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.group-card__tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
