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

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

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