body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  background: #f5f7fb;
}

header {
  background: #1f2937;
  color: white;
  padding: 20px;
  text-align: center;
}

.controls {
  padding: 15px;
  background: white;
  display: flex;
  gap: 10px;
  justify-content: center;
  border-bottom: 1px solid #ddd;
}

.controls input {
  padding: 8px;
  width: 220px;
}

.controls button {
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 4px; 
  padding: 0 15px; 
}

.controls button:hover {
  background: #1d4ed8;
}

/* ==========================
   LOGIN FORM
========================== */

/* Center the text inside the input fields */
#loginForm input {
    display: block; /* Ensures they stack properly */
    margin: 0 auto 10px auto; /* Centers the input element itself */
    width: 100%;
    box-sizing: border-box; /* Ensures padding doesn't break width */
}

/* Ensure the form container is centered */
#loginForm {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
    margin: 0 auto;
}

/* ==========================
   TABLE VIEWPORT
========================== */

.table-container {
  padding: 20px;
}

/* NEW: scrolling viewport */
.table-scroll {
  width: 100%;
  height: 70vh;           /* visible window height */
  overflow: auto;         /* BOTH scrollbars here */
  border: 1px solid #ddd;
  background: white;
}

/* table grows naturally */
#metricsTable {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
}

/* cells */
th, td {
  padding: 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

/* sticky header */
thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 2;
}

/* =====================
   JSON TABLE
===================== */

.json-table {
  border: 1px solid #e5e7eb;
  font-size: 12px;
  background: #fafafa;
  min-width: 450px;     /* readable width */
  max-width: 900px;     /* prevents insanity */
}

.json-table td {
  border: 1px solid #e5e7eb;
  padding: 4px 6px;
  white-space: normal;  /* allow wrapping HERE */
  word-break: break-word;
}

.json-key {
  font-weight: bold;
  background: #f1f5f9;
  width: 35%;
}

.json-value {
  width: 65%;
}

details {
  cursor: pointer;
}

summary {
  font-weight: bold;
  color: #2563eb;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none; 
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-content {
  background: white;
  padding: 25px;
  border-radius: 8px;
  width: 400px;
  color: #333;
}

.modal-content input, .modal-content textarea {
  width: 100%;
  margin: 10px 0;
  padding: 8px;
  display: block;
  box-sizing: border-box;
}

.modal-actions { 
  display: flex; 
  gap: 10px; 
  margin-top: 15px; 
}

.btn-submit { 
  background: #ffed29; 
  color: white; 
  border: none; 
  padding: 10px; 
  cursor: pointer; 
  flex: 1; 
}

.btn-cancel { 
  background: #666; 
  color: white; 
  border: none; 
  padding: 10px; 
  cursor: pointer; 
  flex: 1; 
}

/* ==========================
   NAVIGATION
========================== */
.nav-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.2s;
    text-decoration: none;
}

#reportTitle {
    margin-left: 20px;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.1);
}

.nav-btn.active {
    background: #2563eb;
    border-color: #2563eb;
}

/* ==========================
   REPORTS GRID
========================== */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.report-card {
    background: white;
    border: 1px solid #e5e7eb;
    padding: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ==========================
   COMMENTS SECTION
========================= */
.comments-section {
    background: white;
    border: 1px solid #e5e7eb;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.comments-section h3 {
    margin-top: 0;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 10px;
}

#commentsList > div {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f3f4f6;
}

#commentsList > div:last-child {
    border-bottom: none;
}

/* ==========================
   ERROR PAGES & CONTINGENCIES
========================== */
.error-container {
    text-align: center;
    padding: 100px 20px;
}

.error-container h1 {
    font-size: 72px;
    margin: 0;
    color: #1f2937;
}

.error-container p {
    font-size: 24px;
    color: #6b7280;
}

/* ==========================
   FILTER BAR
========================== */

.filters {
  padding: 20px;
  background: white;
  border-bottom: 1px solid #ddd;
}

.filters h2 {
  margin-bottom: 10px;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-row input {
  padding: 8px;
  width: 220px;
}

/* ==========================
   CHART GRID
========================== */

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
}

.chart-card {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 15px;
  border-radius: 8px;
}

.chart-card canvas {
  width: 100%;
  height: 260px;
}

/* ==========================
   EXPORT BUTTON
========================== */

.export-btn {
  background: #059669;
}

.export-btn:hover {
  background: #047857;
}