/* === TRAINER.CSS — Formation : Renaître ===
   Styles de l'espace formateur
   ======================================== */

/* ── Reset page ──────────────────────────────────────────────────────────── */
#trainer-page {
  min-height: 100dvh;
  background: var(--light-2);
  display: flex;
  flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
#trainer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 58px;
  background: var(--navy);
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

/* Bouton retour accueil */
#trainer-btn-home {
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
#trainer-btn-home:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.trainer-brand {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--gold);
}

.trainer-role-badge {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50px;
  padding: 4px 14px;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
#trainer-main {
  box-sizing: border-box;
  flex: 1;
  padding: 36px 24px 60px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.trainer-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.trainer-card-header {
  padding: 32px 32px 24px;
  border-bottom: 1px solid var(--light);
}

.trainer-card-header h1 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  color: var(--navy);
  margin-bottom: 10px;
}

.trainer-desc {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.7;
  max-width: 540px;
  margin-bottom: 20px;
}

/* ── Nouveau code (banner) ───────────────────────────────────────────────── */
.new-code-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%);
  margin: 0 32px 0;
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.new-code-banner.hidden { display: none; }

.new-code-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  width: 100%;
}

.new-code-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-soft);
  white-space: nowrap;
}

.new-code-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--white);
  letter-spacing: 2px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  padding: 6px 16px;
  flex: 1;
  min-width: 180px;
  text-align: center;
}

.new-code-expiry {
  font-size: .85rem;
  color: rgba(255,255,255,.65);
  white-space: nowrap;
}

/* ── Liste des codes ─────────────────────────────────────────────────────── */
#codes-section {
  padding: 28px 32px 32px;
}

.codes-section-title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--navy);
  margin-bottom: 16px;
}

.code-group-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin: 20px 0 10px;
}
.code-group-title:first-child { margin-top: 0; }
.code-group-muted { color: var(--light); }

.empty-msg {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
  font-size: .95rem;
}
.empty-msg.hidden { display: none; }

.trainer-card-section {
  padding: 28px 32px 32px;
  border-top: 1px solid var(--light);
}

.trainer-desc.compact {
  margin-bottom: 18px;
}

.video-admin-form {
  display: grid;
  grid-template-columns: minmax(160px, 180px) minmax(200px, 1fr) minmax(220px, 1.5fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.video-admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
}

.video-admin-form input,
.video-admin-form select {
  width: 100%;
  border: 1.5px solid var(--light);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: var(--white);
  color: var(--navy);
}

.video-admin-form input:focus,
.video-admin-form select:focus {
  outline: 2px solid rgba(201, 162, 39, .2);
  border-color: var(--gold);
}

.video-list-admin {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--light);
  border-radius: 10px;
  background: var(--light-2);
}

.video-admin-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.video-admin-copy strong {
  color: var(--navy);
  font-size: .95rem;
}

.video-admin-copy span {
  color: var(--muted);
  font-size: .78rem;
  word-break: break-all;
}

.video-empty {
  color: var(--muted);
  font-size: .9rem;
  padding: 10px 0;
}

/* ── Ligne de code ───────────────────────────────────────────────────────── */
.code-row {
  border: 1.5px solid var(--light);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  background: var(--white);
  transition: box-shadow var(--transition);
}
.code-row:hover { box-shadow: var(--shadow-sm); }
.code-row--expired {
  opacity: .55;
  background: var(--light-2);
}

.code-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.code-value {
  font-family: 'Courier New', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 1.5px;
}

.code-status-badge {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 3px 10px;
  border-radius: 50px;
}
.code-status-badge--active  { background: #dcfce7; color: var(--success); }
.code-status-badge--warning { background: #fef9c3; color: #92400e; }
.code-status-badge--expired { background: var(--light-2); color: var(--muted); }

.code-row-meta {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.code-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Boutons spéciaux ────────────────────────────────────────────────────── */
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--navy);
  color: var(--navy);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }

.btn-danger-ghost {
  background: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger); color: var(--white); }

.btn-xs {
  padding: 5px 12px;
  font-size: .82rem;
  min-height: 32px;
}

.btn-sm {
  padding: 7px 16px;
  font-size: .88rem;
  min-height: 36px;
}

/* Cohortes de démonstration, conservées uniquement dans ce navigateur. */
.local-only-label {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 8px;
  background: #fff3d6;
  color: #644b13;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.cohort-create-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0 12px;
}
.cohort-create-form label,
.cohort-status-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.cohort-create-form input,
.cohort-status-control select,
.cohort-participant-form input,
.cohort-participant-form select {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #c8d0d8;
  border-radius: 4px;
  background: #fff;
  color: var(--navy);
  font: inherit;
}
.cohort-create-form input:focus-visible,
.cohort-status-control select:focus-visible,
.cohort-participant-form input:focus-visible,
.cohort-participant-form select:focus-visible {
  outline: 3px solid rgba(23, 58, 99, .2);
  outline-offset: 1px;
  border-color: var(--navy);
}
.cohort-form-message {
  padding: 10px 12px;
  background: #edf7f0;
  color: #245b32;
  font-size: .84rem;
  line-height: 1.45;
}
.cohort-form-message.hidden { display: none; }
.cohort-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 20px 0 16px;
  border-top: 1px solid #d9dfe5;
  border-bottom: 1px solid #d9dfe5;
}
.cohort-overview-item {
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  border-right: 1px solid #d9dfe5;
}
.cohort-overview-item:last-child { border-right: 0; }
.cohort-overview-item span { color: var(--muted); font-size: .78rem; }
.cohort-overview-item strong { color: var(--navy); font-size: 1.25rem; }
.cohort-list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px) auto;
  gap: 8px 12px;
  align-items: end;
  margin-bottom: 12px;
}
.cohort-list-tools label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}
.cohort-list-tools input,
.cohort-list-tools select {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #c8d0d8;
  border-radius: 4px;
  background: #fff;
  color: var(--navy);
  font: inherit;
}
.cohort-list-tools input:focus-visible,
.cohort-list-tools select:focus-visible {
  outline: 3px solid rgba(23, 58, 99, .2);
  outline-offset: 1px;
  border-color: var(--navy);
}
.cohort-result-count { margin: 0 0 10px; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.cohort-empty,
.cohort-empty-participants {
  color: var(--muted);
  font-size: .88rem;
}
.cohort-empty.hidden { display: none; }
.local-cohort-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.local-cohort-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #d9dfe5;
  border-left: 3px solid var(--gold);
  background: #fff;
}
.local-cohort-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.local-cohort-header h3 {
  margin: 0;
  color: var(--navy);
  font-family: var(--font-head);
  font-size: 1.1rem;
}
.local-cohort-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .82rem;
}
.cohort-status-control { max-width: 240px; margin-top: 14px; }
.cohort-participants { margin-top: 18px; }
.cohort-participants h4 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: .9rem;
}
.cohort-participants h4 span { color: var(--muted); font-weight: 400; }
.cohort-participants ul { list-style: none; margin: 0; padding: 0; }
.cohort-participant-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(130px, .8fr);
  align-items: start;
  gap: 10px 16px;
  padding: 14px 0;
  border-top: 1px solid #edf0f2;
}
.cohort-participant-identity { display: grid; gap: 4px; min-width: 0; }
.cohort-participant-name { color: #263442; font-size: .92rem; font-weight: 600; overflow-wrap: anywhere; }
.cohort-participant-email { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.cohort-participant-price { color: var(--navy); font-size: .84rem; font-weight: 600; }
.cohort-participant-statuses { display: grid; gap: 4px; }
.cohort-invitation-status { font-size: .75rem; font-weight: 700; }
.cohort-invitation-status.is-opened { color: #25623c; }
.cohort-invitation-status.is-unopened { color: #895f11; }
.cohort-invitation-status.is-missing { color: var(--muted); }
.cohort-payment-status { font-size: .75rem; font-weight: 700; }
.cohort-payment-status.is-paid { color: #25623c; }
.cohort-payment-status.is-pending { color: #895f11; }
.cohort-access-status { font-size: .75rem; font-weight: 700; }
.cohort-access-status.is-enabled { color: #25623c; }
.cohort-access-status.is-disabled { color: #7b4d12; }
.cohort-participant-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}
.cohort-invitation-code {
  grid-column: 1 / -1;
  display: block;
  max-width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #d9dfe5;
  background: #f7f9fb;
  color: #273443;
  font-size: .82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cohort-participant-actions .btn { min-width: 0; width: 100%; white-space: normal; }
.cohort-participant-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.cohort-participant-form > input,
.cohort-participant-form > select { min-width: 0; }
.cohort-participant-form > button { justify-self: start; min-width: 120px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.invitation-email-dialog {
  box-sizing: border-box;
  width: min(1120px, calc(100vw - 48px));
  height: min(90dvh, 920px);
  margin: auto;
  max-width: none;
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid #d9dfe5;
  border-radius: 6px;
  color: var(--navy);
  box-shadow: 0 18px 60px rgba(15, 30, 46, .24);
}
.invitation-email-dialog::backdrop { background: rgba(15, 30, 46, .58); }
.invitation-email-dialog-content {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 18px;
}
.invitation-email-dialog-header,
.invitation-email-dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.invitation-email-dialog-header { min-width: 0; }
.invitation-email-dialog-header h2 { min-width: 0; }
.invitation-email-dialog-header h2 { margin: 0; font-family: var(--font-head); font-size: 1.2rem; }
.invitation-email-dialog-hint,
.invitation-email-recipient,
.invitation-email-copy-status { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.invitation-email-recipient { min-width: 0; overflow-wrap: anywhere; }
#invitation-email-preview { box-sizing: border-box; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; border: 1px solid #d9dfe5; background: #f7f4ef; }
.invitation-email-copy-status { min-height: 1.4em; color: #245b32; }

@media (max-width: 760px) {
  .invitation-email-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .invitation-email-dialog-content {
    padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
    gap: 10px;
  }
  .invitation-email-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }
  #invitation-email-copy { grid-column: 1 / -1; }
  .invitation-email-dialog-actions .btn {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 420px) {
  .invitation-email-dialog-actions { grid-template-columns: minmax(0, 1fr); }
  #invitation-email-copy { grid-column: auto; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .cohort-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cohort-overview-item:nth-child(2) { border-right: 0; }
  .cohort-overview-item:nth-child(-n + 2) { border-bottom: 1px solid #d9dfe5; }
  .cohort-list-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cohort-result-count { grid-column: 1 / -1; margin: 0; }
  .cohort-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cohort-create-form > button { grid-column: 1 / -1; }
  .cohort-participant-row { grid-template-columns: minmax(0, 1fr); }
  .cohort-participant-statuses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cohort-participant-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cohort-participant-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cohort-participant-form > button { grid-column: 1 / -1; width: 100%; }
}

@media (min-width: 1100px) {
  #trainer-main { max-width: 1360px; }
  .cohort-participant-row {
    grid-template-columns: minmax(250px, 1.1fr) minmax(170px, .7fr) minmax(420px, 1.5fr);
    align-items: center;
  }
  .cohort-participant-actions { grid-column: auto; }
}

@media (max-width: 600px) {
  .trainer-card-header,
  #codes-section,
  .trainer-card-section { padding: 20px 18px; }

  .new-code-banner { margin: 0 18px; margin-top: 20px; padding: 18px 18px; }

  .trainer-card-header h1 { font-size: 1.35rem; }

  .new-code-value { font-size: 1.1rem; }

  #trainer-topbar { padding: 0 16px; }

  .video-admin-form { grid-template-columns: 1fr; }
  .cohort-create-form { grid-template-columns: 1fr; }
  .cohort-create-form .btn { width: 100%; }
  .cohort-participant-row { grid-template-columns: 1fr; gap: 7px; }
  .cohort-participant-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .cohort-participant-actions .btn { padding-left: 8px; padding-right: 8px; white-space: normal; }
  .cohort-participant-form { grid-template-columns: 1fr; }
  .cohort-participant-form .btn { width: 100%; }
  .local-cohort-header { align-items: center; }
  .cohort-list-tools { grid-template-columns: 1fr; }
  .cohort-result-count { grid-column: auto; }
}
