/* Activity Roster 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: 1000px;
  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 Spinner */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #02133e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 40px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

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

/* Auth Screen */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: #02133e;
  color: white;
  margin-top: 20px;
}

.btn-primary:hover {
  background: #0a3161;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(2, 19, 62, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.google-icon {
  width: 20px;
  height: 20px;
}

.subtitle {
  color: #666;
  margin-top: 10px;
  margin-bottom: 20px;
}

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

/* The roster screen is left-aligned; the shared theme.css .screen centers text,
   which is right for the auth/error/loading screens but wrong here (header, section
   headings, and tables should read left-to-left). */
#roster-screen {
  text-align: left;
}

/* Activity Header */
#activity-header {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

#activity-header h1 {
  color: #333;
  font-size: 28px;
  margin-bottom: 10px;
}

#activity-header p {
  color: #666;
  margin: 5px 0;
}

/* Content */
.content {
  padding: 20px 0;
}

/* Roster Sections */
.roster-section {
  margin-bottom: 40px;
}

.roster-section h2 {
  color: #333;
  font-size: 22px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #02133e;
}

/* Numbered roster tables (Scouts / Adults) */
.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.roster-table th {
  text-align: left;
  color: #666;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 2px solid #e0e0e0;
}

.roster-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

.roster-table tr:hover td {
  background: #f9f9f9;
}

/* Narrow, muted numbering column */
.roster-table .num-col {
  width: 40px;
  color: #999;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.roster-name {
  font-weight: 600;
  color: #333;
}

.waitlist-badge {
  background: #ff9800;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.empty-message {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* Messages */
.error-message, .success-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;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 10000; /* above the beta-notice (z-index: 9999) */
  max-width: 400px;
}

.error-message {
  background: #d32f2f;
}

.success-message {
  background: #388e3c;
}

/* ==========================================================================
   Detail View: tabs, table, badges, editable cells
   (Column resize/sort/hide chrome lives in the shared theme.css.)
   ========================================================================== */

/* Tab Navigation */
.tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 12px 24px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-weight: 600;
  color: #666;
  font-size: 15px;
}

.tab-btn.active {
  color: #02133e;
  border-bottom-color: #02133e;
}

.tab-btn:hover:not(.active) {
  background: #f8f9fa;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Export / column-toggle bar */
.export-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

/* Keep every control in the bar the same height so the bordered "Columns"
   toggle lines up with the borderless action buttons (Create / Export). */
.export-bar .btn,
.export-bar .columns-toggle {
  height: 36px;
  display: inline-flex;
  align-items: center;
}

/* Persistent "sheet ready" link (shown even if the pop-up is blocked) */
.export-result {
  margin-right: auto; /* push to the far left of the flex-end bar */
  font-weight: 600;
  color: #388e3c;
}

.export-result a {
  color: #02133e;
  font-weight: 700;
}

.btn-small {
  padding: 8px 14px;
  font-size: 14px;
}

/* Horizontally scrollable, resizable detail table */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
}

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

#detail-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: 80px;
  white-space: nowrap;
}

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

/* Relationship columns: one entry per line, aligned across the three columns
   (data is newline-separated and positionally 1:1 — see migration 0019/0018). */
#detail-table td.col-relationships,
#detail-table td.col-rel-emails,
#detail-table td.col-rel-phones {
  white-space: nowrap;
}

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

.muted { color: #999; }

/* Editable consent + notes */
.consent-cell { text-align: center; }

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

.notes-edit {
  cursor: pointer;
  display: block;
  min-width: 120px;
  min-height: 20px;
  border: 1px dashed transparent;
  border-radius: 4px;
  padding: 2px 4px;
}

.notes-edit:hover {
  border-color: #ffc107;
  background: #fffef0;
}

.notes-input {
  width: 200px;
  min-height: 48px;
  padding: 4px;
  border: 2px solid #02133e;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .screen {
    padding: 20px;
  }

  #activity-header h1 {
    font-size: 22px;
  }

  .roster-table {
    font-size: 14px;
  }
}
