/* ============================================
   ALERTS PAGE - COMPLETE STYLESHEET v11.3
   ? Full Width Table (1px gap left/right)
   ? Increased Table Column Padding
   ? Single-Line Scrollable Column Chips
   ============================================ */

/* ============================================
   HEADER BAR
   ============================================ */
.page-header {
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.badge {
  background: #3b82f6;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 10px;
}

/* ============================================
   TOOLBAR / FILTERS
   ============================================ */
.toolbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 20px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 250px;
  max-width: 400px;
  padding: 8px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.08);
}

.filter-dropdown {
  padding: 8px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  background: white;
  cursor: pointer;
  min-width: 130px;
}

.btn {
  padding: 7px 16px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}
.btn-primary:hover { 
  background: #2563eb; 
  transform: translateY(-1px); 
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #64748b;
}
.btn-outline:hover { 
  background: #f8fafc; 
  border-color: #cbd5e1; 
}

/* ============================================
   STATS CARDS ROW
   ============================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.stat-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* Color variants */
.stat-critical .stat-number { color: #dc2626; }
.stat-high .stat-number { color: #ea580c; }
.stat-medium .stat-number { color: #d97706; }
.stat-low .stat-number { color: #059669; }

/* ============================================
   ? MAIN TABLE AREA - FULL WIDTH (1px GAP)
   ============================================ */
.table-area {
  padding: 1px !important; /* ? ONLY 1px GAP LEFT/RIGHT */
  max-width: none !important; /* ? REMOVE MAX-WIDTH LIMIT */
  width: 100% !important; /* ? FULL WIDTH */
  margin: 0 !important; /* ? NO MARGIN */
  box-sizing: border-box !important;
}

.table-wrapper {
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  width: 100% !important; /* ? FULL WIDTH */
}

/* ============================================
   COLUMN SELECTOR PANEL - ULTRA COMPACT
   ============================================ */

#columnSelectorPanel {
  margin-top: 10px !important;
  margin-bottom: 8px !important;
  padding: 10px 14px !important;
  background: #f8fafc !important;
  border: 1.5px dashed #cbd5e1 !important;
  border-radius: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

#columnSelectorPanel > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

#columnSelectorPanel > div:first-child > div:first-child {
  font-weight: 700;
  font-size: 9px !important;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

#columnSelectorPanel > div:first-child > div:last-child {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

#columnSelectorPanel button {
  padding: 3px 10px !important;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
  color: #64748b;
  font-size: 9px !important;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

#columnSelectorPanel button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* ============================================
   ? CHIP CONTAINER - SINGLE LINE SCROLLABLE
   ============================================ */
#col-chip-container {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 6px 2px !important;
  
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  
  width: 100% !important;
  max-width: 100% !important;
  
  scroll-behavior: smooth;
  white-space: nowrap !important;
}

#col-chip-container::-webkit-scrollbar {
  height: 5px !important;
  width: auto;
}

#col-chip-container::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
  border-radius: 10px;
}

#col-chip-container::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 10px;
}

#col-chip-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8 !important;
}

/* ============================================
   INDIVIDUAL CHIPS - MICRO SIZE
   ============================================ */
.col-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 2px !important;
  padding: 3px 8px !important;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 9px !important;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: all 0.15s ease;
  background: #ffffff;
  color: #64748b;
  line-height: 1.4;
  min-width: fit-content;
  max-width: none;
}

.col-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 1px 3px rgba(59,130,246,0.1);
  transform: translateY(-1px);
}

.col-chip:active {
  transform: scale(0.97);
  cursor: grabbing;
}

.col-chip[style*="background:#eff6ff"],
.col-chip[style*="#eff6ff"] {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
  font-weight: 700;
}

.col-chip .drag-handle {
  font-size: 8px !important;
  color: #94a3b8;
  opacity: 0.4;
  cursor: grab;
  margin-right: -1px;
  flex-shrink: 0;
}

.col-chip:hover .drag-handle {
  opacity: 0.7;
}

.col-chip span[style*="WIN"],
.col-chip span[style*="#1e40af"],
.col-chip span[style*="background:#dbeafe"] {
  font-size: 7px !important;
  background: #dbeafe;
  color: #1e40af;
  padding: 1px 3px !important;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-left: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

#columnSelectorPanel > div:last-child {
  margin-top: 5px;
  font-size: 8px !important;
  color: #94a3b8;
  font-style: italic;
  white-space: normal;
}

/* ============================================
   TABLE STRUCTURE - FULL WIDTH
   ============================================ */
.data-table {
  width: 100% !important; /* ? FULL WIDTH TABLE */
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto; /* Let columns size naturally */
}

.data-table thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

/* ============================================
   TABLE HEADERS - INCREASED PADDING
   ============================================ */
.data-table th {
  padding: 10px 20px;
  text-align: left;
  font-weight: 700;
  font-size: 9px !important;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
  user-select: none;
  position: relative;
}

/* Remove question marks/tooltips */
.data-table th::after,
#alertsTable th::after,
.table-wrapper thead th::after {
  content: none !important;
  display: none !important;
}

.data-table th .help-icon,
.data-table th .tooltip-icon,
.data-table th span:empty:last-child,
.data-table th i[class*="question"],
.data-table th svg[class*="help"],
.data-table th svg[class*="question"] {
  display: none !important;
}

.sort-arrow {
  opacity: 0.35;
  font-size: 8px !important;
  margin-left: 2px;
  transition: opacity 0.2s;
}

.data-table th:hover .sort-arrow {
  opacity: 0.7;
}

/* Column widths - let them expand naturally */
.col-time { width: 150px; min-width: 150px; }
.col-agent { width: 110px; min-width: 110px; }
.col-ip { width: 120px; min-width: 120px; }
.col-srcip { width: 130px; min-width: 130px; }
.col-dstip { width: 130px; min-width: 130px; }
.col-desc { min-width: 180px; }
.col-level { width: 70px; min-width: 70px; text-align: center; }

/* ============================================
   DATA ROWS - INCREASED PADDING
   ============================================ */
.data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.12s ease;
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr.is-expanded {
  background: #eff6ff !important;
  border-left: 3px solid #3b82f6;
}

.data-table tbody tr.is-expanded:hover {
  background: #dbeafe !important;
}

.data-table td {
  padding: 8px 20px;
  vertical-align: middle;
  font-size: 11px;
}

/* Extra edge spacing for first/last columns */
.data-table th:first-child,
.data-table td:first-child {
  padding-left: 24px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 24px;
}

/* Cell content styles */
.cell-time {
  font-family: 'SF Mono', 'JetBrains Mono', Consolas, monospace;
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
}

.cell-agent {
  font-weight: 700;
  color: #0369a1;
  cursor: pointer;
  font-size: 11px;
}
.cell-agent:hover {
  text-decoration: underline;
}

.cell-ip {
  font-family: 'SF Mono', 'JetBrains Mono', Consolas, monospace;
  font-size: 10px;
  color: #475569;
}

.cell-srcip {
  font-family: 'SF Mono', 'JetBrains Mono', Consolas, monospace;
  font-size: 10px;
  color: #dc2626;
  font-weight: 500;
}

.cell-dstip {
  font-family: 'SF Mono', 'JetBrains Mono', Consolas, monospace;
  font-size: 10px;
  color: #059669;
  font-weight: 500;
}

.cell-desc {
  color: #334155;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

/* Level badges */
.level-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 14px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.level-badge.critical {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.level-badge.high {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}
.level-badge.medium {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}
.level-badge.low {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

/* ============================================
   DETAIL EXPANSION PANEL
   ============================================ */
.detail-panel {
  display: none;
  grid-column: 1 / -1;
  background: #f8fafc;
  border-top: 1.5px dashed #cbd5e1;
}

.detail-panel.is-visible {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.detail-field {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
  transition: box-shadow 0.15s;
}

.detail-field:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.detail-label {
  font-size: 8px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 11px;
  color: #1e293b;
  word-break: break-all;
  line-height: 1.4;
}

.detail-value.mono {
  font-family: 'SF Mono', 'JetBrains Mono', Consolas, monospace;
  font-size: 10px;
  background: #f1f5f9;
  padding: 2px 5px;
  border-radius: 3px;
  display: inline-block;
}

/* ============================================
   PAGINATION - RIGHT ALIGNED (VULN EVENTS)
   ============================================ */

#vuln-inv-pager,
#vuln-ev-pager {

    width:100%;

    margin-top:10px;

    padding:0 18px 14px 18px;

    display:flex;

    justify-content:flex-end;

    align-items:center;

}

/* generated wrapper from renderPager() */

#vuln-inv-pager > div,
#vuln-ev-pager > div {

    width:auto;

    margin-left:auto;

    display:flex;

    align-items:center;

    justify-content:flex-end;

    gap:6px;

    flex-wrap:nowrap;

}

/* generic pagination */

.pagination {

    width:100%;

    display:flex;

    justify-content:flex-end;

    align-items:center;

    gap:10px;

    padding:12px 18px;

    background:#f8fafc;

    border-top:1px solid #e2e8f0;

}

/* page info */

.pagination-info {

    order:2;

    margin-left:12px;

    font-size:11px;

    color:#64748b;

    white-space:nowrap;

}

/* buttons group */

.pagination-buttons {

    display:flex;

    align-items:center;

    justify-content:flex-end;

    gap:4px;

    flex-wrap:nowrap;

}

/* pager buttons */

.page-btn,
.fim-page-btn {

    min-width:30px;

    height:30px;

    padding:0 10px;

    border:1px solid #e2e8f0;

    border-radius:5px;

    background:#ffffff;

    color:#475569;

    font-size:11px;

    font-weight:600;

    cursor:pointer;

    transition:all .15s ease;

}

.page-btn:hover:not(:disabled),
.fim-page-btn:hover:not(:disabled) {

    border-color:#3b82f6;

    color:#3b82f6;

    background:#f8fbff;

}

.page-btn.active,
.fim-page-btn.active {

    background:#0077cc;

    border-color:#0077cc;

    color:white;

}

.page-btn:disabled,
.fim-page-btn:disabled {

    opacity:.35;

    cursor:not-allowed;

}

/* dots */

.fim-page-ellipsis {

    padding:0 4px;

    color:#94a3b8;

    font-size:12px;

}

/* result counter */

#vuln-inv-pager span,
#vuln-ev-pager span {

    margin-left:10px;

    color:#64748b;

    font-size:11px;

    white-space:nowrap;

}
/* ============================================
   LOADING & EMPTY STATES
   ============================================ */
.loading-state,
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #64748b;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.25;
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.empty-text {
  font-size: 12px;
  color: #9ca3af;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
  .stats-row { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px;
    padding: 14px 16px;
  }
  
  .detail-panel.is-visible { 
    grid-template-columns: repeat(2, 1fr); 
  }
  
  #col-chip-container {
    gap: 3px;
  }
  
  .col-chip {
    padding: 3px 7px !important;
    font-size: 8px !important;
  }
}

@media (max-width: 900px) {
  .toolbar { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 6px;
    padding: 10px 14px;
  }
  
  .search-input { 
    max-width: none; 
    width: 100%;
  }
  
  .stats-row { 
    grid-template-columns: repeat(2, 1fr); 
    padding: 12px 14px;
  }
  
  /* ? MOBILE: Still full width with minimal gap */
  .table-area { 
    padding: 1px !important; /* Keep 1px gap */
  }
  
  .data-table { 
    font-size: 10px; 
  }
  
  .data-table th,
  .data-table td { 
    padding: 7px 14px; 
  }
  
  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 16px;
  }
  
  .data-table th:last-child,
  .data-table td:last-child {
    padding-right: 16px;
  }
  
  .data-table th {
    font-size: 8px !important;
  }
  
  .col-time { width: 130px; min-width: 130px; }
  .col-agent { width: 95px; min-width: 95px; }
  .col-ip, .col-srcip, .col-dstip { width: 105px; min-width: 105px; }
  .col-desc { max-width: 150px; }
  
  .detail-panel.is-visible { 
    grid-template-columns: 1fr; 
  }
  
  #col-chip-container {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 3px !important;
    padding: 5px 0 !important;
  }
  
  .col-chip {
    font-size: 8px !important;
    padding: 3px 7px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .toolbar,
  #columnSelectorPanel,
  .pagination,
  .stats-row {
    display: none !important;
  }
  
  .table-area {
    padding: 0 !important; /* No gap when printing */
    max-width: none !important;
  }
  
  .data-table {
    font-size: 9px;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 18px;
  }
  
  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 20px;
  }
  
  .data-table th:last-child,
  .data-table td:last-child {
    padding-right: 20px;
  }
}



