/* Registrations 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;
}

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

.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; }

/* Main screen is left-aligned (theme.css .screen centers text). */
#main-screen { text-align: left; }
#main-screen .subtitle { text-align: left; margin: 0 0 20px; color: #666; }
.top-links { float: right; display: flex; gap: 8px; margin-top: 10px; }

.warning-card { text-align: center; padding: 20px; }
.warning-card h1 { color: #d32f2f; margin-bottom: 20px; }
.warning-card p { color: #666; margin-bottom: 30px; }

/* Totals strip */
.totals-strip { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.total-tile {
  background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 8px;
  padding: 8px 14px; min-width: 120px;
}
.total-tile .total-num { font-size: 20px; font-weight: 900; color: #02133e; }
.total-tile .total-label { font-size: 12px; color: #666; }

/* Toolbar */
.controls { display: flex; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; align-items: center; }
.search-box { flex: 1; min-width: 250px; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.date-filter, .checkbox-filter { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #444; }
.date-filter select { padding: 8px; border: 1px solid #ddd; border-radius: 6px; }
.status-info { color: #666; font-size: 14px; margin-bottom: 10px; }

/* Table: bounded scroll region so the sticky header + frozen first column have something to position against. */
.table-wrapper { overflow: auto; max-height: calc(100vh - 260px); margin-bottom: 20px; }
.table-wrapper.small-table { max-height: 300px; }

#reg-table, #exc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
#reg-table th, #exc-table th {
  background: #f8f9fa; padding: 10px 14px; text-align: left;
  border-bottom: 2px solid #e0e0e0; position: relative; min-width: 90px; white-space: nowrap;
}
#reg-table th.sortable { cursor: pointer; }
#reg-table td, #exc-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }

/* Registration grouping: alternating bands; a heavier top border starts each registration. */
#reg-table tr.band-a td { background: #fff; }
#reg-table tr.band-b td { background: #eef3fb; }
#reg-table tr.reg-first td { border-top: 2px solid #c9d3e6; }

.muted { color: #999; font-size: 0.9em; }
.empty-message { text-align: center; color: #666; padding: 30px !important; }
.adult-line { white-space: nowrap; }
.adult-line + .adult-line { margin-top: 3px; }
.cell-sub { display: block; color: #777; font-size: 12px; }

.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; }
.badge-neutral { background: #e9ecef; color: #495057; }

.warnings-cell { color: #721c24; font-size: 13px; }
.warnings-cell li { margin-left: 16px; }

/* Notes editor */
.notes-cell textarea {
  width: 100%; min-width: 220px; min-height: 60px; padding: 6px 8px;
  border: 1px solid #ddd; border-radius: 6px; font: inherit; font-size: 13px;
}
.notes-cell .notes-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.notes-cell .notes-caption { font-size: 11px; color: #777; }

.action-buttons { display: flex; flex-direction: column; gap: 6px; }

/* Panels */
.panel { border-top: 2px solid #e0e0e0; padding-top: 20px; margin-top: 28px; }
.panel h2 { color: #02133e; margin-bottom: 10px; font-size: 1.3rem; }
.warn-text { background: #fff3cd; color: #856404; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.help-text { color: #666; font-size: 13px; margin: 6px 0 12px; }
#settings-summary dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; margin-bottom: 14px; }
#settings-summary dt { font-weight: 700; color: #02133e; }

.settings-form { max-width: 760px; margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: 260px 1fr; gap: 10px 16px; align-items: end; margin-bottom: 10px; }
.form-grid label, .block-label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; color: #02133e; }
.form-grid input, .block-label textarea, .inline-form input {
  padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font: inherit; font-size: 14px; font-weight: 400;
}
.pacific-note { font-size: 13px; color: #555; padding-bottom: 8px; }
.override-set { border: 1px solid #ddd; border-radius: 6px; padding: 8px 14px; margin: 10px 0 4px; display: flex; gap: 20px; flex-wrap: wrap; }
.override-set legend { font-weight: 700; color: #02133e; padding: 0 6px; }
.manual-edit-radio { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.block-label { margin: 14px 0; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form input { min-width: 220px; }

/* Messages */
.error-message, .success-message {
  position: fixed; top: 20px; right: 20px; padding: 15px 20px; border-radius: 8px;
  color: white; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 10000; max-width: 400px;
}
.error-message { background: #d32f2f; }
.success-message { background: #2e7d32; }

/* Freeze panes: header row + first (Scout) column. */
#reg-table thead th { position: sticky; top: 0; z-index: 2; }
#reg-table th:nth-child(1), #reg-table td:nth-child(1) { position: sticky; left: 0; z-index: 1; }
#reg-table thead th:nth-child(1) { z-index: 3; }
/* Frozen body cells need an opaque background; the band rules above already set one. */

@media (max-width: 768px) {
  #reg-table td:nth-child(1) { position: static; }
  #reg-table th:nth-child(1) { left: auto; }
  #reg-table thead th:nth-child(1) { z-index: 2; }
  .form-grid { grid-template-columns: 1fr; }
}
