/* teacher/builder.css

   Construction d'un exercice et banque de questions.

   Chargé par index.html, dans l'ordre de css/README.md. Ne pas changer cet
   ordre sans relire la section « Ordre de chargement ». */

/* ---------- builder ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 20px; }

.builder-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  margin-bottom: 18px;
}

.builder-block.stimulus { border-left: 1px solid var(--border); }

.builder-block .builder-block { background: var(--bg); }

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 14px;
}

.block-head h4 { margin: 0; font-size: var(--fs-4); font-weight: 600; }

.checkline { display: flex; align-items: center; gap: 10px; font-size: var(--fs-3); margin-bottom: 18px; color: var(--muted); }

.checkline input { width: auto; accent-color: var(--primary); }

.pick-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
}

.pick-list label {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-3);
  cursor: pointer;
}

.pick-list label:last-child { border-bottom: none; }

.pick-list input { width: auto; accent-color: var(--primary); }

.bank-results { margin-top: 8px; }

.bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.bank-row:last-of-type { border-bottom: none; }

.bank-prompt { font-size: var(--fs-3); font-weight: 500; margin-bottom: 4px; }

@media (max-width: 640px) {
  .bank-row { flex-direction: column; align-items: flex-start; }
}

/* ---------- éditeur de parcours : tout est pliable ---------- */

.fold {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-radius: var(--r-md);
}

.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--surface-2); }
.fold > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.fold-chev {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s ease;
}
.fold[open] > summary > .fold-chev { transform: rotate(90deg); }

.fold-title { font-weight: 600; font-size: var(--fs-4); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-meta { margin-left: auto; font-size: var(--fs-2); color: var(--muted); white-space: nowrap; }
.fold-num {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-1); font-weight: 700; color: var(--muted); background: var(--surface-2);
}
.fold-warn { font-style: normal; font-weight: 500; color: var(--red); }
.fold-empty { margin: 0 0 12px; font-size: var(--fs-3); color: var(--muted); }

.fold-body { padding: 4px 16px 16px; }
.fold-stack { display: flex; flex-direction: column; gap: 8px; }
.fold-plan { margin-bottom: 18px; }
#plan-weeks.fold-stack { gap: 10px; }

.fold-tools {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 8px; font-size: var(--fs-2); color: var(--muted);
}

/* Une tâche dans une semaine : un cran plus discret. */
.fold-task { background: var(--bg); }
.fold-task > summary { min-height: 46px; padding: 8px 12px; }
.fold-task > summary .fold-title { font-weight: 500; }
.fold-task > .fold-body { padding: 4px 12px 14px; }

/* Les options secondaires : simple ligne, sans cadre. */
.fold-mini { background: transparent; border: 0; margin-top: 10px; }
.fold-mini > summary { min-height: 36px; padding: 6px 0; }
.fold-mini > summary:hover { background: transparent; }
.fold-mini > summary .fold-title { font-size: var(--fs-3); font-weight: 500; color: var(--muted); }
.fold-mini > .fold-body { padding: 4px 0 0 26px; }

.fold-foot { display: flex; justify-content: flex-end; margin-top: 6px; }

.tag-live { color: var(--green); background: var(--green-tint); }

/* Une semaine : la ligne pliable, puis les trois façons d'ajouter, toujours visibles. */
.week-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.week-card > .fold-week { border: 0; background: transparent; }

.add-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  padding: 0 16px 16px;
}

.add-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  text-align: left;
  font: inherit; color: var(--text);
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  cursor: pointer;
}
.add-card b { font-size: var(--fs-3); font-weight: 600; color: var(--primary); }
.add-card span { font-size: var(--fs-2); color: var(--muted); }
.add-card:hover { border-style: solid; border-color: var(--primary); background: var(--primary-tint); }
.add-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 560px) {
  .fold-meta { display: none; }
  .add-choice { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 12px; }
  .add-card { padding: 8px; text-align: center; justify-content: center; }
  .add-card b { font-size: var(--fs-2); }
  .add-card span { display: none; }
}

.fold-body textarea { min-height: 0; }
.fold-body textarea[rows="2"] { min-height: 64px; }
