/* O’Phys RC4 — gestion des contenus : théorie, images et QCM */
.theory-cover {
  margin: 0 0 24px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(0,0,0,.3);
}
.theory-cover img { display: block; width: 100%; max-height: 440px; object-fit: cover; }

.ophys-chapter-image-fields,
.ophys-qcm-image-fields {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
}
.ophys-chapter-image-preview,
.ophys-qcm-image-preview {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(244,215,123,.24);
  background: #02050b;
}
.ophys-chapter-image-preview img,
.ophys-qcm-image-preview img { display: block; width: 100%; max-height: 280px; object-fit: cover; }
.ophys-chapter-image-preview button,
.ophys-qcm-image-preview button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.82);
  color: #fff;
  font-weight: 850;
}
.ophys-chapter-row-thumb {
  width: 72px;
  height: 58px;
  flex: 0 0 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
}

.ophys-legacy-admin-list { display: none !important; }
.ophys-qcm-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 18px;
  padding: 22px;
}
.ophys-qcm-overview h3 { margin: 8px 0; }
.ophys-qcm-overview p { margin: 0; }

.ophys-content-manager-overlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0,0,0,.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.ophys-content-manager {
  width: min(1420px, 100%);
  max-height: calc(100svh - 32px);
  overflow: auto;
  padding: 26px;
  border-radius: 30px;
  border: 1px solid rgba(244,215,123,.25);
  background: radial-gradient(circle at 90% 0%, rgba(212,175,55,.11), transparent 30%), #06101f;
  box-shadow: 0 38px 130px rgba(0,0,0,.78);
}
.ophys-content-manager-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.ophys-content-manager-head h2 { margin: 10px 0 8px; font-size: clamp(31px,4vw,52px); }
.ophys-content-manager-head p { margin: 0; }
.ophys-content-close {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
  color: #fff;
  font-size: 34px;
}
.ophys-content-tools {
  display: grid;
  grid-template-columns: minmax(210px,.7fr) minmax(260px,1.3fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.ophys-content-tools label,
.ophys-qcm-edit-form label { display: grid; gap: 7px; color: #e8e5dd; font-weight: 800; }
.ophys-content-tools strong { color: #f4d77b; padding: 0 4px 14px; white-space: nowrap; }
.ophys-content-grid {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(390px,.85fr);
  gap: 20px;
  align-items: start;
}
.ophys-content-list { display: grid; gap: 18px; }
.ophys-content-empty { padding: 34px; text-align: center; color: #9faabd; border: 1px dashed rgba(255,255,255,.12); border-radius: 22px; }
.ophys-qcm-group {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 24px;
  background: rgba(255,255,255,.035);
}
.ophys-qcm-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 19px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.23);
}
.ophys-qcm-group > header span { color: #f4d77b; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; }
.ophys-qcm-group > header h3 { margin: 3px 0 0; font-size: 21px; }
.ophys-qcm-group > header strong { color: #d8c77f; white-space: nowrap; }
.ophys-qcm-group-list { display: grid; }
.ophys-qcm-admin-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.ophys-qcm-admin-row:last-child { border-bottom: 0; }
.ophys-qcm-admin-row > img { width: 74px; height: 64px; object-fit: cover; border-radius: 13px; border: 1px solid rgba(255,255,255,.12); }
.ophys-qcm-admin-copy { min-width: 0; }
.ophys-qcm-admin-copy h4 { margin: 7px 0; font-size: 16px; line-height: 1.45; }
.ophys-qcm-admin-copy small { color: #aab5c8; }
.ophys-qcm-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.ophys-qcm-meta span { padding: 4px 8px; border-radius: 999px; background: rgba(212,175,55,.10); color: #e6d68f; font-size: 10px; font-weight: 850; }
.ophys-qcm-admin-actions { display: flex; flex-direction: column; gap: 8px; }
.ophys-qcm-admin-actions button,
.ophys-qcm-edit-head button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-weight: 850;
}
.ophys-qcm-admin-actions button.danger { color: #ffb4b4; }
.ophys-qcm-edit-form {
  position: sticky;
  top: 0;
  display: grid;
  gap: 14px;
  padding: 21px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(3,8,17,.86);
}
.ophys-qcm-edit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ophys-qcm-edit-head h3 { margin: 8px 0 0; }
.ophys-qcm-edit-form fieldset { display: grid; gap: 14px; border: 0; padding: 0; margin: 0; min-width: 0; }
.ophys-qcm-edit-form fieldset:disabled { opacity: .52; }
.ophys-content-two-cols,
.ophys-qcm-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ophys-content-status { padding: 12px 14px; border-radius: 14px; line-height: 1.45; }
.ophys-content-status.info { background: rgba(93,216,255,.10); color: #bcefff; }
.ophys-content-status.success { background: rgba(71,213,135,.12); color: #a8f2c6; }
.ophys-content-status.error { background: rgba(255,96,96,.12); color: #ffc1c1; }
.ophys-content-primary {
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg,#f4d77b,#d4af37);
  color: #111;
  font-weight: 950;
}

@media (max-width: 980px) {
  .ophys-content-grid { grid-template-columns: 1fr; }
  .ophys-qcm-edit-form { position: static; order: -1; }
}
@media (max-width: 700px) {
  .ophys-content-manager { padding: 17px; border-radius: 24px; }
  .ophys-content-tools { grid-template-columns: 1fr; }
  .ophys-content-tools strong { padding-bottom: 0; }
  .ophys-qcm-overview { align-items: flex-start; flex-direction: column; }
  .ophys-qcm-admin-row { grid-template-columns: 1fr; align-items: start; }
  .ophys-qcm-admin-row > img { width: 100%; height: 150px; }
  .ophys-qcm-admin-actions { flex-direction: row; }
  .ophys-content-two-cols,
  .ophys-qcm-choices { grid-template-columns: 1fr; }
}

/* O’Phys RC5 — workflow de publication, prévisualisation et médiathèque. */
.ophys-content-tools {
  grid-template-columns: minmax(180px,.8fr) minmax(160px,.65fr) minmax(240px,1.25fr) auto;
}
.ophys-qcm-meta span.published,
.ophys-chapter-row-badges em.published {
  background: rgba(71,213,135,.14);
  color: #a8f2c6;
}
.ophys-qcm-meta span.draft,
.ophys-chapter-row-badges em.draft {
  background: rgba(255,183,77,.14);
  color: #ffd59b;
}
.ophys-chapter-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
}
.ophys-chapter-row-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.ophys-chapter-row-badges,
.ophys-chapter-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.ophys-chapter-row-badges em,
.ophys-chapter-metrics span {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: .04em;
}
.ophys-chapter-metrics span {
  color: #b8c1d0;
  background: rgba(255,255,255,.055);
  text-transform: none;
}
.ophys-empty-thumb {
  display: grid;
  place-items: center;
  padding: 8px;
  color: #8f9aae;
  background: rgba(255,255,255,.035);
  font-size: 10px;
  text-align: center;
}
.ophys-chapter-order {
  display: flex;
  gap: 6px;
}
.ophys-chapter-order button {
  min-width: 40px;
  padding: 0;
}
.ophys-chapter-order button:disabled { opacity: .35; }
.ophys-chapter-preview,
.ophys-qcm-preview {
  width: min(900px,100%);
  max-height: calc(100svh - 34px);
  overflow: auto;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(244,215,123,.25);
  background: radial-gradient(circle at 90% 0%, rgba(212,175,55,.10), transparent 30%), #06101f;
  box-shadow: 0 40px 130px rgba(0,0,0,.8);
}
.ophys-chapter-preview > header,
.ophys-qcm-preview > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.ophys-chapter-preview h2,
.ophys-qcm-preview h2 { margin: 9px 0 6px; font-size: clamp(30px,5vw,52px); }
.ophys-preview-formulas {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(210px,1fr));
  gap: 12px;
  margin: 22px 0;
}
.ophys-preview-formulas article,
.ophys-preview-two > section,
.ophys-qcm-preview > section {
  padding: 18px;
  border-radius: 19px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.ophys-preview-formulas article > span { color: #f4d77b; font-weight: 900; }
.ophys-preview-formulas small { color: #aab5c8; }
.ophys-preview-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.ophys-qcm-preview-image {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  margin-bottom: 20px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.10);
  background: #02050b;
}
.ophys-qcm-preview > h3 { font-size: clamp(22px,4vw,34px); line-height: 1.35; }
.ophys-qcm-preview-choices {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}
.ophys-qcm-preview-choices li {
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
}
.ophys-qcm-preview-choices li.correct {
  border-color: rgba(71,213,135,.45);
  background: rgba(71,213,135,.10);
}

@media (max-width: 900px) {
  .ophys-content-tools { grid-template-columns: 1fr 1fr; }
  .ophys-chapter-row { grid-template-columns: 1fr; }
  .ophys-chapter-row-thumb { width: 100%; height: 160px; }
}
@media (max-width: 620px) {
  .ophys-content-tools { grid-template-columns: 1fr; }
  .ophys-preview-two { grid-template-columns: 1fr; }
  .ophys-chapter-preview,
  .ophys-qcm-preview { padding: 18px; border-radius: 22px; }
}

/* RC30 — liste compacte des chapitres avec onglets de matière */
.ophys-subject-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 14px;
}
.ophys-subject-tabs button {
  flex: 1;
  border: 1px solid var(--border-soft, rgba(255,255,255,.12));
  background: rgba(255,255,255,.04);
  color: var(--muted, #a9a9b3);
  border-radius: 12px;
  padding: 9px 10px;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ophys-subject-tabs button span { opacity: .7; font-weight: 700; }
.ophys-subject-tabs button.active {
  border-color: var(--gold-2, #d4af37);
  background: var(--gold-soft, rgba(212,175,55,.13));
  color: var(--text, #f8f5eb);
}

.ophys-chapter-row-compact {
  border: 1px solid var(--border-soft, rgba(255,255,255,.1));
  border-radius: 14px;
  margin-bottom: 8px;
  overflow: hidden;
}
.ophys-chapter-row-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,.03);
  color: var(--text, #f8f5eb);
  text-align: left;
  font-size: 14px;
}
.ophys-chapter-row-lock { flex: none; }
.ophys-chapter-row-name { flex: 1; font-weight: 800; }
.ophys-chapter-row-status { font-size: 11px; padding: 3px 8px; border-radius: 999px; flex: none; }
.ophys-chapter-row-status.published { background: rgba(78,220,147,.12); color: #8df0bc; }
.ophys-chapter-row-status.draft { background: rgba(255,255,255,.08); color: var(--muted, #a9a9b3); }
.ophys-chapter-row-chevron { flex: none; opacity: .6; }

.ophys-chapter-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border-soft, rgba(255,255,255,.08));
}
.ophys-chapter-row-actions button {
  border: 1px solid var(--border-soft, rgba(255,255,255,.12));
  background: rgba(255,255,255,.05);
  color: var(--text, #f8f5eb);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}
.ophys-chapter-row-actions button.danger { border-color: rgba(255,107,107,.35); color: #ff9b9b; }
.ophys-chapter-row-actions button.access-paid { border-color: rgba(212,175,55,.4); color: var(--gold-2, #d4af37); }
.ophys-chapter-row-meta { width: 100%; margin: 0 0 4px; font-size: 12px; color: var(--muted, #a9a9b3); }

/* RC36 — regroupement visuel des boutons de l'espace Prof par catégorie
   (réordonnancement CSS uniquement, les boutons restent dans la même
   rangée pour ne jamais casser les vérifications anti-doublon) */
.admin-action-row.ophys-admin-row-categorized { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }
.ophys-admin-group-label {
  display: flex;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted, #a9a9b3);
  font-weight: 800;
  padding: 0 2px;
  margin-left: 6px;
}
.ophys-admin-group-label:first-child { margin-left: 0; }
