/* ==========================================================================
   VORTEX-SDN Enterprise Tables
   Sticky headers, dense rows, sorting indicators, search/filter bars, pagination.
   Consistent across Flows, Incidents, Policies, and Audit Logs.
   ========================================================================== */

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.table-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  gap: 8px;
  min-width: 260px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.table-search-box:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(var(--accent-cyan-rgb), 0.15);
}

.table-search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  width: 100%;
  font-family: inherit;
}

.table-search-box input::placeholder {
  color: var(--text-muted);
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-filter {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.select-filter:focus {
  border-color: var(--accent-cyan);
}

.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.vortex-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.vortex-table thead th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-medium);
  user-select: none;
}

.vortex-table thead th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast);
}

.vortex-table thead th.sortable:hover {
  color: var(--text-primary);
}

.vortex-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-speed);
}

.vortex-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.vortex-table tbody td {
  padding: 9px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.vortex-table tbody td.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -0.2px;
}

/* Status and Severity Badges inside Tables */
.severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.severity-critical {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

[data-theme="light"] .severity-critical {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.3);
}

.severity-high {
  background: rgba(249, 115, 22, 0.16);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

[data-theme="light"] .severity-high {
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
  border-color: rgba(234, 88, 12, 0.3);
}

.severity-medium {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

[data-theme="light"] .severity-medium {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.3);
}

.severity-low {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

[data-theme="light"] .severity-low {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border-color: rgba(2, 132, 199, 0.3);
}

.table-pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Light Mode Tables & Search/Filter Bar
   ========================================================================== */
[data-theme="light"] .table-search-box {
  background: #ffffff;
  border: 1px solid #d8e1ec;
}

[data-theme="light"] .table-search-box input {
  color: #0f172a;
}

[data-theme="light"] .table-search-box input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] .select-filter {
  background: #ffffff;
  border: 1px solid #d8e1ec;
  color: #0f172a;
}

[data-theme="light"] .table-responsive-wrapper {
  background: #ffffff;
  border: 1px solid #d8e1ec;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .vortex-table thead th {
  background: #f1f5f9;
  color: #334155;
  border-bottom: 1px solid #cbd5e1;
}

[data-theme="light"] .vortex-table thead th.sortable:hover {
  color: #0f172a;
}

[data-theme="light"] .vortex-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

[data-theme="light"] .vortex-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

[data-theme="light"] .vortex-table tbody tr:hover {
  background: #eef6ff;
}

[data-theme="light"] .vortex-table tbody td {
  color: #0f172a;
}

[data-theme="light"] .table-pagination-footer {
  background: #f8fafd;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
}

/* ==========================================================================
   VORTEX-SDN Enterprise Access Control & Audit Tables
   Fixed-proportion layouts, strict cell bounds, non-colliding action buttons,
   and local horizontal scroll containers.
   ========================================================================== */

/* Universal Data Table Container */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

/* Base Data Table Layout */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
  table-layout: fixed;
  box-sizing: border-box;
}

.data-table thead th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-medium);
  user-select: none;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.data-table tbody td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
  font-size: 12px;
  box-sizing: border-box;
}

.data-table tbody td.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: -0.2px;
}

/* ==========================================================================
   1. Access Control: Platform Users & Operators Directory Table
   Logical Column Proportions:
   1. User Identity:       15%
   2. Email:               22%
   3. Role:                10%
   4. Status:               9%
   5. Email Verified:      11%
   6. Permissions:         14%
   7. Administrative:      19%
   ========================================================================== */
#admin-users-table {
  min-width: 980px;
  table-layout: fixed;
  width: 100%;
}

#admin-users-table th:nth-child(1),
#admin-users-table td:nth-child(1) {
  width: 15%;
  min-width: 130px;
}

#admin-users-table th:nth-child(2),
#admin-users-table td:nth-child(2) {
  width: 22%;
  min-width: 170px;
}

#admin-users-table th:nth-child(3),
#admin-users-table td:nth-child(3) {
  width: 10%;
  min-width: 90px;
  text-align: left;
}

#admin-users-table th:nth-child(4),
#admin-users-table td:nth-child(4) {
  width: 9%;
  min-width: 80px;
  text-align: left;
}

#admin-users-table th:nth-child(5),
#admin-users-table td:nth-child(5) {
  width: 11%;
  min-width: 95px;
  text-align: left;
}

#admin-users-table th:nth-child(6),
#admin-users-table td:nth-child(6) {
  width: 14%;
  min-width: 120px;
}

#admin-users-table th:nth-child(7),
#admin-users-table td:nth-child(7) {
  width: 19%;
  min-width: 200px;
  text-align: right;
}

/* Specific Cell Layouts in Users Table */
.user-identity-cell {
  font-weight: 600;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.user-username-sub {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
  margin-top: 2px;
}

.user-email-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.user-perm-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-actions-cell {
  text-align: right;
  white-space: nowrap;
}

/* ==========================================================================
   2. Administrative Action Buttons Container
   Aligns [Permissions] [Revoke] [Disable] [Delete] consistently
   ========================================================================== */
.admin-actions-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: nowrap;
  vertical-align: middle;
}

.btn-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 25px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 23px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  box-sizing: border-box;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-xs.btn-revoke {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-xs.btn-revoke:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

.btn-xs.btn-disable {
  color: var(--status-danger);
}

.btn-xs.btn-disable:hover {
  background: rgba(239, 68, 68, 0.15);
}

.btn-xs.btn-enable {
  color: #10b981;
}

.btn-xs.btn-enable:hover {
  background: rgba(16, 185, 129, 0.15);
}

.btn-xs.btn-reject {
  color: var(--status-danger);
}

.btn-xs.btn-reject:hover {
  background: rgba(239, 68, 68, 0.15);
}

.protected-admin-label {
  font-size: 11px;
  color: var(--text-disabled);
  font-style: italic;
  padding: 2px 6px;
  user-select: none;
}

/* ==========================================================================
   3. Pending Operator Requests Table
   Columns:
   1. Requester Name:     18%
   2. Email:              24%
   3. Requested At:       15%
   4. Status:             10%
   5. Client IP / Device: 18%
   6. Actions:            15%
   ========================================================================== */
#admin-requests-table {
  min-width: 840px;
  table-layout: fixed;
  width: 100%;
}

#admin-requests-table th:nth-child(1),
#admin-requests-table td:nth-child(1) {
  width: 18%;
  min-width: 130px;
}

#admin-requests-table th:nth-child(2),
#admin-requests-table td:nth-child(2) {
  width: 24%;
  min-width: 170px;
}

#admin-requests-table th:nth-child(3),
#admin-requests-table td:nth-child(3) {
  width: 15%;
  min-width: 120px;
  white-space: nowrap;
}

#admin-requests-table th:nth-child(4),
#admin-requests-table td:nth-child(4) {
  width: 10%;
  min-width: 90px;
  white-space: nowrap;
}

#admin-requests-table th:nth-child(5),
#admin-requests-table td:nth-child(5) {
  width: 18%;
  min-width: 140px;
}

#admin-requests-table th:nth-child(6),
#admin-requests-table td:nth-child(6) {
  width: 15%;
  min-width: 150px;
  text-align: right;
  white-space: nowrap;
}

.client-ip-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.client-device-sub {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
  margin-top: 2px;
}

/* ==========================================================================
   4. System Audit Trail Table (#view-audit)
   Columns:
   1. TIMESTAMP: 14%
   2. USER:      13%
   3. ROLE:       9%
   4. ACTION:    23%
   5. RESOURCE:  23%
   6. RESULT:     8%
   7. CLIENT IP: 10%
   ========================================================================== */
#view-audit .vortex-table {
  min-width: 940px;
  table-layout: fixed;
  width: 100%;
}

#view-audit .vortex-table th:nth-child(1),
#view-audit .vortex-table td:nth-child(1) {
  width: 14%;
  min-width: 110px;
  white-space: nowrap;
}

#view-audit .vortex-table th:nth-child(2),
#view-audit .vortex-table td:nth-child(2) {
  width: 13%;
  min-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #ffffff;
}

#view-audit .vortex-table th:nth-child(3),
#view-audit .vortex-table td:nth-child(3) {
  width: 9%;
  min-width: 80px;
  white-space: nowrap;
}

#view-audit .vortex-table th:nth-child(4),
#view-audit .vortex-table td:nth-child(4) {
  width: 23%;
  min-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-audit .vortex-table th:nth-child(5),
#view-audit .vortex-table td:nth-child(5) {
  width: 23%;
  min-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

#view-audit .vortex-table th:nth-child(6),
#view-audit .vortex-table td:nth-child(6) {
  width: 8%;
  min-width: 80px;
  white-space: nowrap;
}

#view-audit .vortex-table th:nth-child(7),
#view-audit .vortex-table td:nth-child(7) {
  width: 10%;
  min-width: 95px;
  white-space: nowrap;
}

/* ==========================================================================
   5. Access Control Page Layout & Container Spacing
   ========================================================================== */
#view-admin-users {
  display: none;
  width: 100%;
  box-sizing: border-box;
}

#view-admin-users.active {
  display: block;
}

#view-admin-users .dashboard-hero-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
}

#view-admin-users .card-admin-panel {
  margin-bottom: 20px;
}

#view-admin-users .card-admin-panel:last-child {
  margin-bottom: 0;
}

#view-admin-users .admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

#view-admin-users .admin-card-title {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
  letter-spacing: 0.2px;
}

#view-admin-users .admin-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

#admin-user-search-input {
  width: 260px;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  padding: 6px 12px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#admin-user-search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(var(--accent-cyan-rgb), 0.15);
}

/* ==========================================================================
   6. Light Theme Table Overrides
   ========================================================================== */
[data-theme="light"] .table-container {
  background: #ffffff;
  border-color: #d8e1ec;
}

[data-theme="light"] .data-table thead th {
  background: #f1f5f9;
  color: #334155;
  border-bottom-color: #cbd5e1;
}

[data-theme="light"] .data-table tbody tr {
  border-bottom-color: #e2e8f0;
  background: #ffffff;
}

[data-theme="light"] .data-table tbody tr:hover {
  background-color: #eef6ff;
}

[data-theme="light"] .data-table tbody td {
  color: #0f172a;
}

[data-theme="light"] .user-identity-cell {
  color: #0f172a;
}

[data-theme="light"] #view-admin-users .admin-card-title {
  color: #0f172a;
}

