/**
 * Create Seminar Form
 * Page layout, Bulma-style field/label/control primitives, error states,
 * radio spacing, notification banner, and mobile responsive adjustments.
 */

/* ─── Page container ─────────────────────────────────────────────────────── */

.create-seminar-page {
  padding: var(--space-8);
  max-width: 640px;
  margin: 0 auto;
}

/* ─── Field spacing ──────────────────────────────────────────────────────── */

.create-seminar-page .field {
  margin-bottom: var(--space-5);
}

/* ─── Labels ─────────────────────────────────────────────────────────────── */

.create-seminar-page .label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-base);
}

/* ─── Control wrapper ────────────────────────────────────────────────────── */

.create-seminar-page .control {
  display: block;
}

/* ─── Error states ───────────────────────────────────────────────────────── */

.create-seminar-page .input.is-danger,
.create-seminar-page input.is-danger,
.create-seminar-page select.is-danger {
  border-color: var(--color-error) !important;
}

.create-seminar-page .help.is-danger {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-error);
}

/* ─── Radio spacing ──────────────────────────────────────────────────────── */

.create-seminar-page label.radio {
  margin-right: var(--space-4);
}

/* ─── Form row (side-by-side fields) ─────────────────────────────────────── */

.create-seminar-page .form-row {
  display: flex;
  gap: var(--space-4);
}

.create-seminar-page .form-row > .field {
  flex: 1;
  min-width: 0;
}

/* ─── Submit button area ─────────────────────────────────────────────────── */

#create-seminar-form .button[type="submit"] {
  margin-top: var(--space-4);
}

/* ─── Notification banner ────────────────────────────────────────────────── */

.notification {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  font-size: var(--font-size-sm);
}

.notification.is-info,
.notification.is-info.is-light {
  background: color-mix(in srgb, var(--ctp-blue) 12%, var(--color-bg-base));
  border: 1px solid color-mix(in srgb, var(--ctp-blue) 30%, transparent);
  color: var(--color-text-base);
}

/* ─── Mobile responsive ──────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .create-seminar-page {
    padding: var(--space-4);
  }

  .create-seminar-page .field {
    margin-bottom: var(--space-4);
  }

  .create-seminar-page .form-row {
    flex-direction: column;
    gap: var(--space-3);
  }
}

/* ─── Instructor multi-select component ──────────────────────────────────── */

.instructor-search {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-md);
  background-color: var(--color-bg-base);
  color: var(--color-text-base);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.instructor-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.instructor-search::placeholder {
  color: var(--color-text-muted);
}

/* ─── Instructor list (scrollable container) ──────────────────────────────── */

.instructor-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-md);
  background-color: var(--color-bg-base);
  padding: var(--space-2);
}

/* ─── Individual instructor item ──────────────────────────────────────────── */

.instructor-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base);
}

.instructor-item:hover {
  background-color: var(--color-bg-subtle);
}

.instructor-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: var(--space-3);
  cursor: pointer;
  accent-color: var(--color-primary);
}

.instructor-item label {
  flex: 1;
  margin: 0;
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--color-text-base);
}

/* ─── Selected instructor chips ──────────────────────────────────────────── */

.instructor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.instructor-chip-form {
  display: inline;
}

.instructor-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background-color: var(--ctp-surface0);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
  cursor: pointer;
  transition: background-color var(--transition-base);
}

.instructor-chip:hover {
  background-color: var(--ctp-surface1);
}

.instructor-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
  line-height: 1;
  transition: color var(--transition-base);
}

.instructor-chip:hover .instructor-chip-remove {
  color: var(--color-danger);
}

/* ─── Warning message ────────────────────────────────────────────────────── */

.instructor-warning {
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  background-color: color-mix(in srgb, var(--color-warning) 12%, var(--color-bg-base));
  border: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
}

/* ─── Mobile responsive adjustments ──────────────────────────────────────── */

@media (max-width: 768px) {
  .instructor-list {
    max-height: none;
    max-height: 400px;
  }

  .instructor-item {
    min-height: 48px;
    padding: var(--space-3) var(--space-3);
  }

  .instructor-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Settings page — polished admin layout                                       */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Content wrapper — constrain width for comfortable reading ────────────── */

.settings-content-wrapper {
  padding-top: var(--space-4);
}

/* ─── Settings section card ───────────────────────────────────────────────── */

.settings-section {
  background: var(--color-bg-base);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-xs);
}

/* ─── Section title with lavender accent underline ─────────────────────────── */

.settings-section-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  margin: 0 0 var(--space-5) 0;
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--ctp-lavender);
}

/* ─── Section description — muted text below title ─────────────────────────── */

.settings-section-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: calc(-1 * var(--space-3)) 0 var(--space-4) 0;
}

/* ─── Block checkbox labels (vertical stack) ───────────────────────────────── */

.settings-section label.checkbox {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
  cursor: pointer;
}

/* ─── Help text inside settings ────────────────────────────────────────────── */

.settings-section .help {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ─── Sub-group label — muted uppercase pill ───────────────────────────────── */

.settings-group-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-3);
  margin-top: var(--space-5);
}

/* ─── Thin divider between groups ─────────────────────────────────────────── */

.settings-group-divider {
  border: none;
  border-top: 1px solid var(--color-border-base);
  margin: var(--space-5) 0;
}

/* ─── Field label — slightly muted ─────────────────────────────────────────── */

.settings-section .label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

/* ─── Input and select styling ─────────────────────────────────────────────── */

.settings-section .input,
.settings-section select {
  border-color: var(--color-border-base);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
  background-color: var(--color-bg-base);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.settings-section .input:focus,
.settings-section select:focus {
  border-color: var(--ctp-lavender);
  box-shadow: 0 0 0 3px rgba(114, 135, 253, 0.12);
  outline: none;
}

/* ─── Help text under settings labels ──────────────────────────────────────── */

.settings-help {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3) 0;
  line-height: 1.45;
}

/* ─── Food options — one card per meal choice ──────────────────────────────── */

.food-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.food-options [x-cloak] {
  display: none !important;
}

.food-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-md);
  background: var(--color-bg-base);
  transition: border-color var(--transition-base),
              background-color var(--transition-base),
              box-shadow var(--transition-base);
}

.food-option--active {
  border-color: rgba(114, 135, 253, 0.35);
  background: rgba(114, 135, 253, 0.04);
}

.food-option--default {
  border-color: var(--ctp-lavender);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.06);
}

.food-option__enable {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
  cursor: pointer;
}

.food-option__checkbox,
.food-option__radio {
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--ctp-lavender);
  cursor: pointer;
}

.food-option__name {
  line-height: 1.35;
  word-break: break-word;
}

.food-option__default {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-bg-base);
  border: 1px solid var(--color-border-base);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.food-option--default .food-option__default {
  border-color: var(--ctp-lavender);
  color: var(--ctp-lavender);
  background: rgba(139, 92, 246, 0.08);
  font-weight: var(--font-weight-medium);
}

.food-option__default-label {
  line-height: 1.2;
}

/* ─── Radio group — vertical stack with breathing room ─────────────────────── */

.settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.settings-radio-group label.radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
  cursor: pointer;
  margin-right: 0;
}

/* ─── Side-by-side field row ───────────────────────────────────────────────── */

.settings-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.settings-field-row .field {
  margin-bottom: 0;
}

/* ─── Field spacing inside settings sections ───────────────────────────────── */

.settings-section .field {
  margin-bottom: var(--space-4);
}

.settings-section .field:last-child {
  margin-bottom: 0;
}

/* ─── Auto-submitting form spacing inside settings ─────────────────────────── */

.settings-section > form + form {
  margin-top: var(--space-2);
}

/* ─── Instructor chips — move above search, no top margin needed ───────────── */

.settings-section .instructor-chips {
  margin-top: 0;
  margin-bottom: var(--space-4);
}


/* ─── Registration visibility: O ——— O ——— O progression ─────────────────── */

.reg-vis-field {
  margin-bottom: var(--space-2);
}

.reg-vis-field > .label {
  display: block;
  margin-bottom: var(--space-3);
}

.reg-vis-track {
  position: relative;
  /* Compact cluster, left-aligned. Do not stretch across the settings card.
     On a narrow card this is 100% so the three labels wrap instead of overflowing. */
  width: min(100%, 22rem);
  max-width: 100%;
  /* Traffic light for the selected state: red closed, amber spy, green open. */
  --reg-vis-tone: var(--ctp-red);
  --reg-vis-tone-ink: #b91c1c;
  --reg-vis-tone-ring: rgba(239, 68, 68, 0.28);
}

.reg-vis-track:has(input[value="instructors"]:checked) {
  --reg-vis-tone: #d97706;
  --reg-vis-tone-ink: #b45309;
  --reg-vis-tone-ring: rgba(217, 119, 6, 0.28);
}

.reg-vis-track:has(input[value="students"]:checked) {
  --reg-vis-tone: #16a34a;
  --reg-vis-tone-ink: #15803d;
  --reg-vis-tone-ring: rgba(22, 163, 74, 0.28);
}

/* Rail runs from the center of the first node to the center of the last. */
.reg-vis-track__rail {
  position: absolute;
  z-index: 0;
  top: 7.5px;
  left: calc(100% / 6);
  right: calc(100% / 6);
  height: 3px;
  border-radius: 999px;
  background: var(--color-border-base);
  pointer-events: none;
}

.reg-vis-track__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--reg-vis-tone);
}

.reg-vis-track:has(input[value="instructors"]:checked) .reg-vis-track__fill {
  width: 50%;
}

.reg-vis-track:has(input[value="students"]:checked) .reg-vis-track__fill {
  width: 100%;
}

.reg-vis-track__nodes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative;
  z-index: 1;
}

.reg-vis-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0 0.2rem;
  min-width: 0;
  text-align: center;
  cursor: pointer;
}

.reg-vis-node__dot {
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 2px solid var(--color-border-base);
  border-radius: 50%;
  background: var(--color-bg-base);
  flex-shrink: 0;
}

/* Nodes up to and including the selected one are filled (a progression). */
.reg-vis-track:has(input[value="nobody"]:checked) .reg-vis-node:nth-child(1) .reg-vis-node__dot,
.reg-vis-track:has(input[value="instructors"]:checked) .reg-vis-node:nth-child(-n+2) .reg-vis-node__dot,
.reg-vis-track:has(input[value="students"]:checked) .reg-vis-node .reg-vis-node__dot {
  background: var(--reg-vis-tone);
  border-color: var(--reg-vis-tone);
}

.reg-vis-node:has(input:checked) .reg-vis-node__dot {
  box-shadow: 0 0 0 4px var(--reg-vis-tone-ring);
}

.reg-vis-node__input:focus-visible + .reg-vis-node__dot {
  outline: 2px solid var(--reg-vis-tone);
  outline-offset: 3px;
}

.reg-vis-node__title,
.reg-vis-node__help {
  display: block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: manual;
}

.reg-vis-node__title {
  margin-top: 0.35rem;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  line-height: 1.25;
}

.reg-vis-node__help {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.3;
}

.reg-vis-node:has(input:checked) .reg-vis-node__title {
  color: var(--reg-vis-tone-ink);
}

/* ─── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .settings-field-row {
    grid-template-columns: 1fr;
  }

  .settings-section {
    padding: var(--space-4);
  }

  .food-option {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .food-option__default-label {
    /* Keep the row compact on narrow screens */
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .reg-vis-track__rail {
    top: 6.5px;
  }

  .reg-vis-node__dot {
    width: 16px;
    height: 16px;
  }

  .reg-vis-node__title {
    font-size: 0.75rem;
  }

  .reg-vis-node__help {
    font-size: 0.6875rem;
  }

  .reg-vis-node {
    padding: 0 0.1rem;
  }
}
