/* ============================================
   EPI/PERT Dashboard Styles
   ============================================ */

.epi-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.epi-header {
  margin-bottom: 1.5rem;
}

.epi-header h1 {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text-main, #111827);
}

.stats-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-badge {
  background: var(--color-primary-light, #e0e7ff);
  color: var(--color-primary, #4f46e5);
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.82rem;
}

.stat-filtered {
  background: #f0fdf4;
  color: #166534;
}

/* Layout: sidebar + main */
.epi-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 991px) {
  .epi-layout {
    grid-template-columns: 1fr;
  }
  .filter-panel {
    display: none;
  }
  .filter-panel.show {
    display: block;
  }
}

/* Filter Panel */
.filter-panel {
  background: var(--color-sidebar-bg, #f9fafb);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 0.6rem;
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.filter-section {
  margin-bottom: 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.filter-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.filter-section h6 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6b7280);
  margin-bottom: 0.5rem;
}

.filter-checks {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 200px;
  overflow-y: auto;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--color-text-main, #111827);
  cursor: pointer;
  padding: 0.15rem 0;
}

.filter-check input[type="checkbox"] {
  margin: 0;
  accent-color: var(--color-primary, #4f46e5);
}

.year-range {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.year-range input {
  width: 80px;
  text-align: center;
}

.year-range span {
  color: var(--color-text-muted, #6b7280);
}

.filter-actions {
  margin-top: 1rem;
}

/* Charts Section */
.charts-section {
  margin-bottom: 1.25rem;
}

.charts-toggle-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.charts-toggle-bar h5 {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-main, #111827);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: #fff;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 0.5rem;
  padding: 1rem;
}

.chart-card h6 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6b7280);
  margin-bottom: 0.5rem;
}

.chart-card canvas {
  max-height: 220px;
}

.charts-grid.hidden {
  display: none;
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* DataTable overrides */
#articles-table {
  font-size: 0.83rem;
}

#articles-table thead th {
  background: var(--color-sidebar-bg, #f9fafb);
  border-bottom: 2px solid var(--color-border, #e5e7eb);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #6b7280);
  white-space: nowrap;
  padding: 0.6rem 0.75rem;
}

#articles-table tbody td {
  padding: 0.55rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f3f4f6;
}

#articles-table tbody tr:hover {
  background: #f5f3ff;
}

#articles-table tbody tr {
  cursor: pointer;
}

.article-title-link {
  color: var(--color-primary, #4f46e5);
  text-decoration: none;
  font-weight: 500;
  line-height: 1.4;
}

.article-title-link:hover {
  text-decoration: underline;
}

/* Badge styles for table */
.badge-sm {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-type {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-evidence {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-flag {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* DataTables pagination and info text */
.dataTables_wrapper .dataTables_info {
  font-size: 0.8rem;
  color: var(--color-text-muted, #6b7280);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  font-size: 0.8rem;
}

.dataTables_wrapper .dataTables_length select {
  font-size: 0.8rem;
}

/* Remove default DataTables search (we have our own) */
.dataTables_wrapper .dataTables_filter {
  display: none;
}

/* Table responsive */
.table-responsive {
  overflow-x: auto;
}
