/* Zelle Reconciliation Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f9f9f9;
  min-height: 100vh;
  padding: 20px;
  padding-top: max(64px, 20px);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Screens */
.screen {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  min-height: 400px;
}

#loading-screen, #auth-screen, #error-screen {
  text-align: center;
}

#loading-screen p {
  color: #666;
  font-size: 16px;
  margin-top: 20px;
}

/* The main screen is left-aligned; the shared theme.css .screen centers text,
   which is right for auth/error/loading but wrong for a data table. */
#main-screen {
  text-align: left;
}

#main-screen .subtitle {
  text-align: left;
  margin: 0 0 20px;
  color: #666;
}

/* Error/Warning Card */
.warning-card {
  text-align: center;
  padding: 20px;
}

.warning-card h1 {
  color: #d32f2f;
  margin-bottom: 20px;
}

.warning-card p {
  color: #666;
  margin-bottom: 30px;
}

/* Toolbar */
.controls {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 250px;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1em;
}

.date-filter, .checkbox-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92em;
  color: #333;
  white-space: nowrap;
}

.date-filter input[type="date"] {
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.status-info {
  margin-bottom: 15px;
  padding: 10px;
  background: #f0f0f0;
  border-radius: 4px;
  font-size: 0.9em;
  color: #333;
}

/* Table: bounded scroll region so the sticky header row + frozen columns have
   something to position against (same technique as activity-roster). */
.table-wrapper {
  overflow: auto;
  max-height: calc(100vh - 260px);
  margin-bottom: 20px;
}

#zelle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#zelle-table th {
  background: #f8f9fa;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #e0e0e0;
  cursor: pointer;
  position: relative; /* containing block for .resize-handle (theme.css) */
  min-width: 90px;
  white-space: nowrap;
}

#zelle-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}

.mono {
  font-family: 'Courier New', monospace;
}

.muted {
  color: #999;
  font-size: 0.9em;
}

.empty-message {
  text-align: center;
  color: #666;
  padding: 30px !important;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-ok { background: #d4edda; color: #155724; }
.badge-warn { background: #fff3cd; color: #856404; }
.badge-bad { background: #f8d7da; color: #721c24; }

/* Editable notes cell */
.col-notes { min-width: 180px; }

.notes-edit {
  cursor: pointer;
  display: inline-block;
  min-width: 100px;
  min-height: 1.2em;
}

.notes-input {
  width: 100%;
  min-height: 40px;
  padding: 4px 6px;
  border: 1px solid #02133e;
  border-radius: 4px;
  font-family: inherit;
  font-size: inherit;
  resize: vertical;
}

.reconciled-cell {
  text-align: center;
}

.reconciled-toggle {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Messages */
.error-message {
  position: fixed;
  top: 74px; /* clear the fixed beta-notice (top:0, ~64px) so it isn't obscured */
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  background: #d32f2f;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 10000; /* above the beta-notice (z-index: 9999) */
  max-width: 400px;
}

/* ==========================================================================
   Freeze panes: keep the header row and the Date/Time + Payer columns visible
   while scrolling the wide table. Sticky positions against the bounded
   .table-wrapper scroll region.
   ========================================================================== */

#zelle-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Frozen first two columns (Date/Time, Payer). The second column's left offset
   tracks the resizable first column's width via --freeze-2-left (set in
   updateFreezeOffsets); the fallback covers the moment before JS runs. */
#zelle-table th:nth-child(1),
#zelle-table td:nth-child(1),
#zelle-table th:nth-child(2),
#zelle-table td:nth-child(2) {
  position: sticky;
  z-index: 1;
}
#zelle-table th:nth-child(1),
#zelle-table td:nth-child(1) { left: 0; }
#zelle-table th:nth-child(2),
#zelle-table td:nth-child(2) { left: var(--freeze-2-left, 140px); }

/* Body cells in the frozen columns need an opaque background so other columns
   don't bleed through when scrolled horizontally. */
#zelle-table td:nth-child(1),
#zelle-table td:nth-child(2) {
  background: #fff;
}

/* The two header corner cells are frozen on BOTH axes — keep them above every
   other sticky cell. */
#zelle-table thead th:nth-child(1),
#zelle-table thead th:nth-child(2) {
  z-index: 3;
}
