/**
 * Seminars list — responsive header + mobile cards
 * Cards are shown only on small screens (.hidden-desktop); the Tabulator
 * data-grid is shown only on larger screens (.hidden-mobile).
 */

/* Responsive list header: tabs + primary action */
.seminars-toolbar {
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}

@media (max-width: 767px) {
  .seminars-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .seminars-toolbar .tabs-list {
    width: 100%;
  }

  .seminars-toolbar > .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Mobile card list — shown only < 768px (see .hidden-desktop). `display`
   lives inside the mobile media query so it never beats the .hidden-desktop
   utility (equal specificity, later source order) on larger screens. */
.seminars-cards {
  flex-direction: column;
  gap: var(--space-3);
}

@media (max-width: 767px) {
  .seminars-cards {
    display: flex;
  }
}

.seminars-cards__search {
  position: relative;
  margin-bottom: var(--space-1);
}

.seminars-cards__search input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-background);
  color: var(--color-foreground);
  font-size: var(--font-size-sm);
  font-family: var(--font-family-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.seminars-cards__search input:focus {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.seminars-cards__search input::placeholder {
  color: var(--color-muted-foreground);
}

/* Card */
.seminar-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.seminar-card:active {
  transform: scale(0.99);
  background: var(--color-muted);
}

.seminar-card__body {
  flex: 1;
  min-width: 0; /* allow children to clamp/ellipsis instead of overflowing */
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--color-foreground);
  text-decoration: none;
}

.seminar-card__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Host · course line */
.seminar-card__people {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
}

.seminar-card__people > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seminar-card__people i {
  flex-shrink: 0;
  font-size: 0.75em;
  opacity: 0.8;
}

/* Date + participants stats line */
.seminar-card__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
}

.seminar-card__stat {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}

.seminar-card__stat i {
  font-size: 0.85em;
  opacity: 0.8;
}

.seminar-card__count {
  font-weight: var(--font-weight-semibold);
  color: var(--color-foreground);
}

/* Waiting-list count — secondary to the registered count */
.seminar-card__waitlist {
  color: var(--color-muted-foreground);
}

/* Unconfirmed (awaiting confirmation) student count — red pill, mirrors the
   nav notification badge so it can't be missed. */
.seminar-card__unconfirmed {
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--color-destructive);
  color: #fff;
  font-weight: var(--font-weight-semibold);
}

.seminar-card__unconfirmed i {
  opacity: 1;
}

/* Active toggle */
.seminar-card__aside {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.seminar-card__aside .form-group {
  margin: 0;
}

/* Enlarge the touch target around the small switch (visual size unchanged) */
.seminar-card__aside .switch {
  padding: var(--space-2);
  margin: calc(-1 * var(--space-2));
}

/* Inactive seminars are dimmed so active ones stand out when scanning */
.seminar-card--inactive .seminar-card__title {
  color: var(--color-muted-foreground);
  font-weight: var(--font-weight-medium);
}

.seminar-card--inactive .seminar-card__body {
  opacity: 0.7;
}

/* ------------------------------------------------------------------ */
/* Participant cards (mobile) — shown only < 768px via .hidden-desktop */
/* `display` lives in the media query so it never beats .hidden-desktop */
/* on larger screens (equal specificity, later source order).          */
.participants-cards,
.waiting-list-cards {
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

@media (max-width: 767px) {
  .participants-cards,
  .waiting-list-cards {
    display: flex;
  }
}

.participants-cards__search {
  margin-bottom: var(--space-1);
}

.participants-cards__search input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-background);
  color: var(--color-foreground);
  font-size: var(--font-size-sm);
  font-family: var(--font-family-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.participants-cards__search input:focus {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.participants-cards__search input::placeholder {
  color: var(--color-muted-foreground);
}

.participant-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Awaiting-confirmation students are surfaced first with a red accent so the
   instructor sees at a glance who still needs confirming. */
.participant-card--unconfirmed {
  border-color: color-mix(in srgb, var(--color-destructive) 35%, var(--color-border));
  border-left: 3px solid var(--color-destructive);
  background: color-mix(in srgb, var(--color-destructive) 5%, var(--color-card));
}

/* The current instructor's own students are surfaced first with a primary
   accent so they can spot and manage their own people at a glance. */
.participant-card--own {
  border-left: 3px solid var(--color-link);
}

/* Payment state on cards follows the same pattern as desktop: unpaid is the
   neutral default; yellow means part received; green means settled. A free
   seminar also stays neutral. */
.participant-card--partial {
  background: color-mix(in srgb, var(--color-warning) 14%, var(--color-card));
}

.participant-card--paid {
  background: color-mix(in srgb, var(--color-success) 9%, var(--color-card));
}

.participant-card--payment-mismatch {
  border-color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 10%, var(--color-background));
}

.participant-card--payment-mismatch .participant-chip--paid {
  color: var(--color-warning);
  font-weight: var(--font-weight-semibold);
}

/* Top row: select + avatar + identity. Actions live on a second row so the
   name gets the full width and stops wrapping to two lines. */
.participant-card__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* The avatar doubles as the select control: the photo is the tap target, the
   checkbox is visually hidden, and a corner badge shows an empty circle that
   fills with a check when selected (Google Photos / iOS pattern). The empty
   circle is the affordance that signals tapping is possible. */
.participant-card__avatar-select {
  position: relative;
  display: block;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: var(--radius-md);
  -webkit-tap-highlight-color: transparent;
}

.participant-card__select-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.participant-card__badge {
  position: absolute;
  top: 3px;
  right: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-card) 55%, transparent);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  color: transparent;
  font-size: 11px;
  line-height: 1;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

/* Selected: fill the badge and reveal the check. */
.participant-card__select-input:checked ~ .participant-card__badge {
  background: #1e66f5;
  border-color: #fff;
  color: #fff;
}

/* Keyboard focus ring for the visually-hidden checkbox. */
.participant-card__select-input:focus-visible ~ .participant-card__badge {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

/* Selected state — tint the whole card + ring so selection reads at a glance,
   not only from the badge. */
.participant-card:has([data-bulk-checkbox]:checked) {
  border-color: #1e66f5;
  background: color-mix(in srgb, #1e66f5 6%, var(--color-card));
  box-shadow: 0 0 0 1px #1e66f5;
}

.participant-card__avatar {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-muted);
}

.participant-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.participant-card__name a {
  display: block;
  font-weight: var(--font-weight-medium);
  color: var(--color-foreground);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.participant-card__position {
  font-weight: var(--font-weight-semibold);
  color: var(--color-muted-foreground);
  flex-shrink: 0;
  min-width: 1.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.participant-card__meta {
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: 2px;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.participant-chip--paid {
  color: #40a02b;
  background: color-mix(in srgb, #40a02b 12%, transparent);
}

/* Part of the money is in -- amber, matching the table's partial rows. */
.participant-chip--partial {
  color: #df8e1d;
  background: color-mix(in srgb, #df8e1d 14%, transparent);
  font-variant-numeric: tabular-nums;
}

/* Nothing paid yet -- muted, so it reads as "still open" without shouting. */
.participant-chip--unpaid {
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-text-muted) 10%, transparent);
  font-variant-numeric: tabular-nums;
}

.participant-chip--checkin {
  color: #1e66f5;
  background: color-mix(in srgb, #1e66f5 12%, transparent);
}

/* Actions sit in a footer that is separated from the identity row by a thin
   divider, so they read as a deliberate toolbar instead of floating icons. */
.participant-card__actions {
  display: flex;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.participant-card__actions form {
  margin: 0;
  width: 100%;
}

/* Participant icon actions spread evenly across the footer as a segmented bar
   with comfortable tap targets, filling the width instead of hugging a corner. */
.participant-card__actions .action-buttons {
  display: flex;
  width: 100%;
  gap: var(--space-2);
}

.participant-card__actions .action-btn {
  flex: 1;
  height: 40px;
}

/* Waiting-list cards carry a single promote action — let it fill the footer. */
.participant-card__actions .cluster {
  width: 100%;
}

.participant-card__actions .cluster .btn {
  width: 100%;
  min-height: 40px;
}

/* ------------------------------------------------------------------ */
/* Sticky multi-select bar (mobile) — revealed by seminars-cards.js    */
/* when one or more card checkboxes in its group are ticked. The card  */
/* checkboxes bind to the bar's <form> via the HTML5 `form` attribute, */
/* so the browser submits the selection natively.                      */
.bulk-bar {
  position: fixed;
  left: 0;
  right: 0;
  /* Sit directly above the fixed mobile bottom-nav, not over it. */
  bottom: calc(var(--bottom-nav-height, 4rem) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-sticky);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.10);
}

.bulk-bar.bulk-bar--active {
  display: flex;
}

.bulk-bar__info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--font-size-sm);
  color: var(--color-foreground);
}

.bulk-bar__count {
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
}

.bulk-bar__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-background);
  color: var(--color-muted-foreground);
  cursor: pointer;
}

.bulk-bar form {
  margin: 0;
  flex-shrink: 0;
}

.bulk-bar .btn {
  width: auto;
}

/* Keep the last card clear of the fixed bar while it is showing. */
@media (max-width: 767px) {
  .participants-cards:has(.bulk-bar--active),
  .waiting-list-cards:has(.bulk-bar--active) {
    padding-bottom: 76px;
  }
}

/* ------------------------------------------------------------------ */
/* Register-students: the compact opener button on the seminar list    */
/* (desktop table action column + mobile card aside), and the modal     */
/* picker with a live per-student objection preview.                    */

/* Opener form wraps the button; strip its default margin. */
.reg-open {
  margin: 0;
  display: inline-flex;
}

/* Icon-only opener (list table + cards) reads as a link-tinted action. */
.btn-icon.reg-open__btn {
  color: var(--color-link);
}

/* Labeled opener (page header) keeps icon + text comfortably spaced. */
.reg-open__btn--labeled {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

/* Seminar detail page header: title left, register action right, wrapping
   gracefully on narrow screens. */
.seminar-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.seminar-detail-header h1 {
  margin: 0;
  min-width: 0;
}

/* On mobile cards the opener sits beside the active toggle. */
.seminar-card__register {
  margin-right: var(--space-1);
}

/* Enlarge the touch target around the opener on mobile cards. */
.seminar-card__aside .reg-open__btn {
  width: 40px;
  height: 40px;
}

@media (max-width: 767px) {
  /* Full-width, thumb-friendly register action in the detail header. */
  .seminar-detail-header {
    align-items: stretch;
  }

  .seminar-detail-header__register,
  .seminar-detail-header__register .reg-open__btn--labeled {
    width: 100%;
    justify-content: center;
  }
}

/* ── Picker: search results ─────────────────────────────────── */
.reg-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.reg-result__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.reg-result__label:hover {
  background: var(--color-muted);
}

.reg-result__check {
  flex-shrink: 0;
}

.reg-result__name {
  font-weight: var(--font-weight-medium);
  color: var(--color-foreground);
}

.reg-result__meta {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Picker: chosen students panel ──────────────────────────── */
.reg-selected-panel {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--color-muted);
  border-radius: var(--radius-md);
}

.reg-selected-panel__title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.reg-selected-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.reg-selected {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-md);
}

.reg-selected__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  min-width: 0;
}

.reg-selected__name {
  font-weight: var(--font-weight-medium);
  color: var(--color-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Accent the row by preview status. */
.reg-selected--ok {
  border-left-color: #40a02b;
}

.reg-selected--override {
  border-left-color: #df8e1d;
}

.reg-selected--waitlist {
  border-left-color: #1e66f5;
}

.reg-selected--already-registered,
.reg-selected--blocked,
.reg-selected--not-student {
  border-left-color: var(--color-destructive);
  background: color-mix(in srgb, var(--color-destructive) 4%, var(--color-card));
}

/* ── Status pill ────────────────────────────────────────────── */
.reg-status {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.reg-status--ok {
  color: #40a02b;
  background: color-mix(in srgb, #40a02b 12%, transparent);
}

.reg-status--override {
  color: #b9770e;
  background: color-mix(in srgb, #df8e1d 16%, transparent);
}

.reg-status--waitlist {
  color: #1e66f5;
  background: color-mix(in srgb, #1e66f5 12%, transparent);
}

.reg-status--blocked {
  color: var(--color-destructive);
  background: color-mix(in srgb, var(--color-destructive) 12%, transparent);
}

/* On narrow screens the status pill is wide; stack it under the name so the
   name stays fully readable instead of being truncated to a few letters. */
@media (max-width: 767px) {
  .reg-selected {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
  }

  .reg-selected__name {
    white-space: normal;
  }

  .reg-status {
    margin-left: 28px;
    align-self: flex-start;
  }

  /* Candidate rows: comfortable tap target; course · instructor wraps under
     the name rather than being clipped to a few letters. */
  .reg-result__label {
    flex-wrap: wrap;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
  }

  .reg-result__meta {
    margin-left: 28px;
    flex-basis: 100%;
    white-space: normal;
  }

  .reg-selected__label {
    min-height: 24px;
  }
}

/* ── Registration outcome flash ────────────────────────────────
   The alert itself is the single surface; outcome rows stay flat. */
.alert:has(.registration-summary) {
  width: min(44rem, calc(100% - 2rem));
  margin: var(--space-4) auto;
  padding: 0;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.registration-summary {
  display: grid;
  width: 100%;
}

.registration-summary__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  background: transparent;
}

.registration-summary__item + .registration-summary__item {
  border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

.registration-summary__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: var(--font-size-sm);
}

.registration-summary__item--success {
  color: #16803c;
}

.registration-summary__item--waitlist {
  color: #1e66d0;
}

.registration-summary__item--already-registered {
  color: #52606d;
}

.registration-summary__item--denied {
  color: #a16207;
}

.registration-summary__copy {
  min-width: 0;
}

.registration-summary__label {
  display: block;
  color: currentColor;
  line-height: 1.75rem;
}

.registration-summary__names {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-1);
  margin: 2px 0 0;
  padding: 0;
  color: var(--color-foreground);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  list-style: none;
}

.registration-summary__names li:not(:last-child)::after {
  content: ",";
}

.alert:has(.registration-summary) .alert-dismiss {
  align-self: flex-start;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  margin: var(--space-2) var(--space-2) 0 0;
  padding: 0;
  border-radius: var(--radius-full);
}

.alert:has(.registration-summary) .alert-dismiss:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
}

@media (max-width: 767px) {
  .alert:has(.registration-summary) {
    width: calc(100% - var(--space-4));
    margin: var(--space-2) auto;
  }

  .registration-summary__item {
    padding: var(--space-3);
  }
}