/* ==========================================================================
   dashboard-registration.css — Pass-3 admin section primitives.

   Page-scoped: linked from dashboard.html AFTER dashboard-panels.css so any
   selector specificity ties resolve in this file's favour where intended.
   Split out of dashboard-panels.css in Phase 3 sub-pass 3c step 1, when the
   parent file exceeded the ~1000-line tripwire from
   kore-architecture-folder-structure.md §5. Mechanical move only — no rule
   rewrites, no selector renames; visual result identical to pre-split.

   Sections (numbering matches the labels they carried in dashboard-panels.css):
     13. Dialog (idle-timeout prompt; base modal — grown by 3b's
         confirmModal() for danger ops)
     14. Phase-3 primitives — Registrations / Check-In / Summer Camp /
         generic data table / toast notifications
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────────────
   13. Dialog (idle-timeout "still there?" prompt; the base for future modals).
       Hidden via the [hidden] attribute (base.css: [hidden]{display:none
       !important}); .is-open is a JS hook for an optional entrance transition.
   ────────────────────────────────────────────────────────────────────── */

.dialog {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  background: var(--color-scrim);
}

.dialog__panel {
  width: 100%;
  max-width: 420px;
  padding: var(--spacing-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.dialog:not(.is-open) .dialog__panel {
  transform: translateY(8px);
  opacity: 0;
}

.dialog__title {
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.dialog__body {
  margin-bottom: var(--spacing-lg);
  color: var(--color-text-light);
  line-height: var(--line-height-base);
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--spacing-sm);
}

@media (prefers-reduced-motion: reduce) {
  .dialog__panel,
  .dialog:not(.is-open) .dialog__panel {
    transition: none;
    transform: none;
    opacity: 1;
  }
}


/* ──────────────────────────────────────────────────────────────────────
   14. Phase-3a primitives — Registrations / Check-In / Summer Camp
   ──────────────────────────────────────────────────────────────────────

   Three new admin sections land in 3a. Where the legacy dashboard.css used
   `#rtp-dashboard-wrapper` namespacing + `!important`, these are token-based
   BEM blocks that compose with the existing `.section-card`, `.stat-card`,
   `.report-filter-bar`, and `.dash-btn` primitives. Check-in buttons render
   in 3a but are `disabled` + `aria-disabled` (writes ship in 3b).
   ────────────────────────────────────────────────────────────────────── */

/* Status badge (REGISTERED / WAITLISTED). */
.reg-status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 2px var(--spacing-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.reg-status-badge--registered {
  background: rgba(22, 163, 74, 0.10);
  color: var(--color-success-strong);
}

.reg-status-badge--waitlisted {
  background: var(--color-warning-surface);
  color: #92400e;
}

/* Check-in button — two visual states. In 3a the button is rendered
   `disabled` everywhere (`aria-disabled="true"`); 3b wires the click. */
.reg-checkin-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
}

.reg-checkin-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.reg-checkin-btn--off {
  background: var(--color-overlay-black-soft);
  color: #1f2937;
  border-color: var(--color-overlay-black-light);
}

.reg-checkin-btn--off:hover:not(:disabled) {
  background: var(--color-primary-alpha-06);
  border-color: var(--color-primary-alpha-20);
}

.reg-checkin-btn--on {
  background: rgba(22, 163, 74, 0.12);
  color: var(--color-success-strong);
  border-color: rgba(22, 163, 74, 0.30);
}

.reg-checkin-btn:disabled,
.reg-checkin-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
}

.reg-checkin-group {
  font-weight: 700;
  font-size: 0.75rem;
}

.reg-checkin-time {
  font-size: 0.6875rem;
  opacity: 0.85;
}

/* Bulk-delete row trigger (3b wires the click). */
.reg-delete-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--color-danger-soft);
  background: transparent;
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.reg-delete-row-btn:hover:not(:disabled) {
  background: var(--color-danger-soft);
}

.reg-delete-row-btn:focus-visible {
  outline: 2px solid var(--color-danger);
  outline-offset: 2px;
}

.reg-delete-row-btn:disabled,
.reg-delete-row-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ── Check-In section: hero search + chip filters + slot groups ───── */

.checkin-hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: var(--color-overlay-white-full);
  border-radius: var(--radius-md);
  padding: var(--spacing-xl) var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-md);
}

.checkin-hero__inner {
  max-width: 720px;
  margin: 0 auto;
}

.checkin-hero__title {
  margin: 0 0 var(--spacing-xs);
  font-size: 1.5rem;
  font-weight: 700;
  color: inherit;
}

.checkin-hero__subtitle {
  margin: 0 0 var(--spacing-md);
  font-size: 0.9375rem;
  opacity: 0.92;
}

.checkin-hero__search {
  position: relative;
  display: flex;
  align-items: center;
}

.checkin-hero__search-input {
  flex: 1;
  padding: var(--spacing-md) var(--spacing-2xl) var(--spacing-md) var(--spacing-md);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--color-overlay-white-bold);
  color: #1f2937;
}

.checkin-hero__search-input:focus-visible {
  outline: 2px solid var(--color-overlay-white-full);
  outline-offset: 2px;
}

.checkin-hero__search-clear {
  position: absolute;
  right: var(--spacing-sm);
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: #1f2937;
  cursor: pointer;
  border-radius: var(--radius-full);
}

.checkin-hero__search-clear:hover {
  background: var(--color-overlay-black-soft);
}

.checkin-hero__search-clear:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Chip group: filter-bar tabs. ≥44px touch target. */
.checkin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.checkin-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--color-overlay-black-light);
  background: var(--color-surface);
  color: #1f2937;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
}

.checkin-chip:hover {
  background: var(--color-primary-alpha-06);
  border-color: var(--color-primary-alpha-20);
}

.checkin-chip:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.checkin-chip--active {
  background: var(--color-primary);
  color: var(--color-overlay-white-full);
  border-color: var(--color-primary);
}

.checkin-chip--active:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

/* Slot-group hierarchy. */
.checkin-slot-group {
  margin-bottom: var(--spacing-xl);
}

.checkin-slot-group:last-child {
  margin-bottom: 0;
}

.checkin-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--color-overlay-black-soft);
  border: 1px solid var(--color-overlay-black-light);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-md);
}

.checkin-slot-header__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.checkin-slot-counts {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.checkin-card-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

@media (min-width: 768px) {
  .checkin-card-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .checkin-card-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

.checkin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--color-surface);
  border: 1px solid var(--color-overlay-black-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.checkin-card__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.checkin-card__name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkin-card__sub {
  font-size: 0.8125rem;
  color: #6b7280;
}

.checkin-empty {
  padding: var(--spacing-md);
  font-size: 0.875rem;
  color: #6b7280;
  font-style: italic;
  text-align: center;
}

/* ── Summer Camp section: capacity grid ──────────────────────────── */

.sc-capacity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--spacing-md);
}

.sc-capacity-card {
  padding: var(--spacing-md);
  background: var(--color-surface);
  border: 1px solid var(--color-overlay-black-light);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.sc-capacity-card--full {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
}

.sc-capacity-card--waitlist {
  border-color: var(--color-accent);
  background: rgba(246, 181, 7, 0.08);
}

.sc-capacity-card__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1f2937;
}

.sc-capacity-card__meta {
  font-size: 0.8125rem;
  color: #6b7280;
}

.sc-capacity-card__bar {
  position: relative;
  height: 8px;
  background: var(--color-overlay-black-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.sc-capacity-card__bar-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  transition: width var(--transition-base);
}

.sc-capacity-card__bar-fill--warning {
  background: var(--color-accent);
}

.sc-capacity-card__bar-fill--full {
  background: var(--color-danger);
}

/* ── Generic data table — Registrations / Check-In / Summer Camp ─── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table__wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table th,
.data-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-overlay-black-light);
  vertical-align: top;
}

.data-table th {
  background: var(--color-overlay-black-soft);
  font-weight: 600;
  color: #1f2937;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: var(--color-primary-alpha-04);
}

/* ── Toast notifications — fed by dashboard-shared.js (empty in 3a). ─ */

.toast-container {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 240px;
  max-width: 400px;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-overlay-black-light);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: #1f2937;
  animation: toast-in var(--transition-base);
}

.toast--success {
  border-left: 4px solid var(--color-success-strong);
}

.toast--error {
  border-left: 4px solid var(--color-danger);
}

.toast__icon {
  flex-shrink: 0;
}

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-weight: 600;
  margin: 0 0 2px;
}

.toast__message {
  margin: 0;
  font-size: 0.8125rem;
  color: #6b7280;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

/* ──────────────────────────────────────────────────────────────────────
   15. Pass-3c Tier-3 forward-safety — synthetic TEST row highlight.

       The `_kore-v2/backend/migrations/003_3b_seed_admin_test_registration.sql`
       migration seeds one row on prod with parent_first_name='TEST' +
       time_slot='stt_test' so admins have a dedicated target for live-API
       click-tests. dashboard-registrations.js tags the row with the
       `data-table__row--test` class; the pill renders inline next to the
       student name. The legacy form can never submit `stt_test` (it's not
       in `validators.TIME_SLOT_CHOICES` and the new public form's
       `SLOTS_BY_DISTRICT` excludes it), so the row stays a unique sentinel.
   ────────────────────────────────────────────────────────────────────── */

.data-table__row--test {
  background: var(--color-accent-alpha-12);
}

.data-table__row--test td:first-child {
  border-left: 3px solid var(--color-accent);
}

.reg-test-pill {
  display: inline-block;
  margin-left: var(--spacing-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}


