/* Module Émissions : liste (puces d'état, tâches en ligne) et fiche (lecteur, découpe, fichiers, workflow, journal). */

/* Puces d'état : présent = pleine (vert), absent = contour, en cours = info avec arc animé. Rien n'est barré. */
.em-dots { display: inline-flex; gap: var(--space-1); flex-wrap: wrap; }
.em-dot {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 5px; border-radius: 999px; font-size: 12px; line-height: 16px;
  border: 1px solid var(--border-strong); color: var(--text-muted); background: transparent; font-variant-numeric: tabular-nums;
}
.em-dot svg { width: 12px; height: 12px; flex-shrink: 0; }
/* Le texte reste en --text (contraste) ; la couleur porte sur l'icône et la bordure, le libellé dit l'état. */
.em-dot.is-on { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--text); font-weight: 500; }
.em-dot.is-on svg { color: var(--ok); }
.em-dot.is-busy { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 45%, transparent); color: var(--text); }
.em-dot.is-busy svg { color: var(--info); animation: spin 1.4s linear infinite; }

.em-title { font-weight: 500; }
.em-row-jobs { display: flex; flex-direction: column; gap: var(--space-1); min-width: 160px; }

/* Fiche */
.em-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; font-size: 14px; color: var(--text-2); }
.em-meta .mono { font-size: 13px; }
/* Noms des fichiers publiés (version DL, MP3) sous les métadonnées : pastille videos42, rôle, nom à copier */
.em-meta-block { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.em-names { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); align-items: center; font-size: 13px; color: var(--text-2); }
.em-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.em-name-role { color: var(--text-3); }
.em-name code { font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; user-select: all; }
.em-name.is-missing code { color: var(--text-3); border-style: dashed; background: transparent; }
.em-name .btn { padding: 2px 4px; }
.em-name-link { color: var(--text); text-decoration: underline dotted; text-underline-offset: 3px; }
.em-name-link:hover { text-decoration-style: solid; }
.em-v42 { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); opacity: .45; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.em-v42.is-on { background: #2fb36a; opacity: 1; box-shadow: 0 0 0 2px rgba(47,179,106,.18); }
.em-v42.is-other { background: #e0a528; opacity: 1; box-shadow: 0 0 0 2px rgba(224,165,40,.18); }
.em-v42.is-off { background: #dd4b4b; opacity: 1; box-shadow: 0 0 0 2px rgba(221,75,75,.18); }
.em-v42.is-pending { background: #e0a528; opacity: 1; box-shadow: 0 0 0 2px rgba(224,165,40,.18); animation: em-v42-pulse 1.6s ease-in-out infinite; }
@keyframes em-v42-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .em-v42.is-pending { animation: none; } }
.em-detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(min(100%, 360px), 2fr); gap: var(--space-4); align-items: start; }
.em-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.em-col .card + .card { margin-top: 0; }

/* Lecteur */
.em-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); outline-offset: 2px; }
.em-source { margin-top: var(--space-2); font-size: 13px; color: var(--text-2); min-height: 18px; }
.em-source .is-warn { color: var(--warn-text); }
.em-source .empty { padding: var(--space-4); }
.em-proxy { margin-top: var(--space-2); display: flex; flex-direction: column; gap: var(--space-1); }
.em-proxy .job-progress { max-width: 360px; }

/* Découpe */
.em-cut-bar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.em-cut-now { display: flex; align-items: baseline; gap: var(--space-2); margin-right: auto; }
.em-tc { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; color: var(--text); }
.em-cut-fields { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.em-cut-fields .field { min-width: 150px; flex: 0 1 180px; }
.em-cut-fields .check { min-height: 36px; }
.em-tc-field .input { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.em-cut-duration { align-self: center; padding-bottom: 8px; }
.em-cut-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }
.em-cut-jobs { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-2); }
.em-cut-jobs .job-progress .meta { flex: 0 0 auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn[aria-pressed="true"] { background: var(--blue-light); border-color: var(--accent); color: var(--accent); }

/* Fichiers */
.em-file-col { width: 100%; }
.em-file { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.em-file-name { overflow-wrap: anywhere; word-break: break-word; font-size: 12px; color: var(--text-2); font-family: var(--font-mono); }
.em-role { display: inline-flex; align-items: center; gap: 6px; }
/* Emplacements distants : puce verte « videos42 », « PeerTube » (lien), « Archive » ; grise avec « ? » quand le serveur n'a pas répondu */
.em-places-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.em-place { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 16px; background: var(--ok-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); text-decoration: none; }
.em-place svg { color: var(--ok); }
.em-place.is-unknown { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.em-places { margin-top: var(--space-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.em-role.is-missing .ftype { opacity: .55; }

/* Workflow */
.em-steps { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; }
.em-step { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border-bottom: 1px solid var(--border); }
.em-step:last-child { border-bottom: 0; }
.em-step .meta { font-size: 12px; }
.em-wf-actions { display: flex; justify-content: flex-end; margin-bottom: var(--space-3); }
.em-wf-status { display: flex; flex-direction: column; gap: var(--space-2); }
.em-wf-line { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; font-size: 14px; }
.em-wf-line .meta { flex: 1; min-width: 0; }

/* Journal */
.em-journal {
  margin: var(--space-2) 0 0; padding: var(--space-3); max-height: 320px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2);
}
.em-journal:focus-visible { outline: 2px solid var(--focus); }

@media (max-width: 1100px) {
  .em-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .em-video { scroll-behavior: auto; }
}

/* Suppression d'une émission : destinations à cocher, puis compte rendu. */
.em-delete { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.em-delete .is-warn { color: var(--warn-text); }
.em-delete-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.em-delete-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.em-delete-list li.is-absent { color: var(--text-3); }
.em-delete-list .meta { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; min-width: 0; flex: 1 1 220px; }
/* Renommage d'une émission (23 octobre 2026) */
.em-rename-fields { display: grid; grid-template-columns: minmax(150px, 180px) 1fr; gap: var(--space-3); }
.em-rename-fields > :last-child { grid-column: 1 / -1; }
.em-rename-fields > * { min-width: 0; }
.em-rename-fields .input { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 560px) { .em-rename-fields { grid-template-columns: 1fr; } }
.em-notebook-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.em-notebook-list li { display: flex; align-items: center; gap: 8px; }
.em-notebook-list li a { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.em-notebook-list li .btn { margin-left: auto; }

/* Émission › carte Vignette (29 octobre 2026) */
.em-vig { display: grid; gap: 10px; }
.em-vig-img img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.em-vig-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.em-vig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.em-vig-pick { display: grid; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; text-align: left; }
.em-vig-pick:hover { border-color: var(--accent); }
.em-vig-pick img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; }
