/* Fonds documentaire : recherche dans les sous-titres, résultats avec contexte, lecteur de consultation. */

/* Recherche */
.fonds-search { align-items: flex-end; gap: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); }
.fonds-search .field-search { flex: 1 1 280px; min-width: 220px; max-width: none; }
.fonds-search .field { min-width: 120px; }
.fonds-search-actions { display: flex; gap: var(--space-2); align-items: center; min-height: 36px; }
.fonds-status { font-variant-numeric: tabular-nums; }
.fonds-source, .tag-source { vertical-align: 2px; font-weight: 500; letter-spacing: .02em; }
.channel-group h3 .fonds-source, .channel-group h3 .tag-source { text-transform: none; letter-spacing: .02em; }
.fonds-group-head h2 { display: flex; align-items: center; gap: var(--space-2); }
.fonds-srt { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; }
.fonds-srt svg { width: 14px; height: 14px; color: var(--cat-fonds); }

/* Résultats */
.fonds-results-head, .fonds-results-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.fonds-results-foot { margin-top: var(--space-4); justify-content: flex-end; }
.fonds-results-count { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.fonds-pager { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; }

.fonds-group { margin-bottom: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden; }
.fonds-group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-4); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.fonds-group-head h2 { font-size: 15px; font-weight: 600; }
.fonds-hits { list-style: none; margin: 0; padding: 0; }
.fonds-hits li + li { border-top: 1px solid var(--border); }
.fonds-hit {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: var(--space-3); width: 100%; text-align: left;
  padding: var(--space-3) var(--space-4); border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; cursor: pointer;
  user-select: text; /* le passage se copie-colle (signalement 106) ; un clic qui termine une sélection ne lance pas la lecture */
}
.fonds-hit:hover { background: var(--hover); }
.fonds-hit:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.fonds-hit-tc { color: var(--accent); font-size: 13px; padding-top: 2px; user-select: none; }
.fonds-hit-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fonds-ctx { color: var(--text-muted); font-size: 13px; }
.fonds-hit-text mark, .fonds-cue mark { background: var(--blue-subtle); color: var(--text); border-radius: 2px; padding: 0 1px; }

/* Navigation par dates */
.fonds-month-nav { justify-content: space-between; margin-bottom: var(--space-2); }
.fonds-month-nav h2 { min-width: 0; flex: 1; font-size: 15px; }
.fonds-day { margin-bottom: var(--space-4); font-size: 18px; }

/* Lecteur */
.fonds-media-head .breadcrumb .btn { margin-left: calc(-1 * var(--space-3)); }
.fonds-media { display: grid; grid-template-columns: minmax(0, 3fr) minmax(min(100%, 320px), 2fr); gap: var(--space-6); align-items: start; }
.fonds-player { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.fonds-player-box { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
/* Aperçu ASISynthés : PNG d'habillage par-dessus, vidéo réduite dans sa fenêtre (mêmes proportions que l'export). */
.fonds-asi-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.fonds-asi-overlay[hidden] { display: none; }
.player-view.is-dressed .nle-source-video { position: absolute; left: 10.7812%; top: 10.3704%; width: 78.4896%; height: 78.4259%; }
.fonds-asi { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.fonds-asi-fields { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fonds-asi-fields[hidden] { display: none; }
.fonds-asi-field { min-width: 160px; }
.fonds-extract-fields { display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--space-2); }
.fonds-tc { width: 110px; }
.fonds-tc input { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.fonds-dl { display: flex; flex-direction: column; gap: var(--space-3); }
.fonds-dl-status:empty { display: none; }
.fonds-dl-ready { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.fonds-video { display: block; width: 100%; height: 100%; background: #000; }
.fonds-player-note:empty { display: none; }
.fonds-proxy { display: flex; flex-direction: column; gap: var(--space-2); font-size: 14px; color: var(--text-2); }
.fonds-extract { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.fonds-extract-info { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; color: var(--text-2); padding-bottom: 8px; }
.fonds-extract-info b { color: var(--text); font-weight: 600; }
.fonds-extract-range { color: var(--text-2); }
.fonds-extract-controls { display: flex; align-items: flex-end; gap: var(--space-2); }
.fonds-extract-controls .field { min-width: 88px; }

/* Transcript et résumé */
.fonds-side { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); padding: var(--space-3) var(--space-4) var(--space-4); }
.fonds-side .tabs { margin-bottom: var(--space-3); }
.fonds-filter { display: flex; align-items: flex-end; gap: var(--space-2); margin-bottom: var(--space-3); }
.fonds-filter .field { flex: 1; min-width: 0; }
.fonds-filter-nav { display: flex; align-items: center; gap: 2px; min-height: 36px; }
.fonds-filter-count { font-size: 13px; white-space: nowrap; }
.fonds-cues { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 300px); min-height: 240px; overflow: auto; scroll-padding: var(--space-4); border-top: 1px solid var(--border); }
.fonds-cues > li { display: block; }
.fonds-cue {
  display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: var(--space-2); width: 100%; text-align: left;
  padding: 6px var(--space-2); border: 0; border-left: 3px solid transparent; background: none; color: var(--text-2);
  font: inherit; font-size: 14px; line-height: 1.45; cursor: pointer;
  user-select: text; /* copier-coller du transcript (signalement 112) */
}
.fonds-cue:hover { background: var(--hover); color: var(--text); }
.fonds-group--back { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); animation: fonds-back-fade 3s ease-out forwards; }
@keyframes fonds-back-fade { 0%, 60% { outline-color: var(--accent); } 100% { outline-color: transparent; } }
.fonds-cue:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.fonds-cue-tc { color: var(--text-muted); font-size: 12px; padding-top: 2px; user-select: none; } /* une sélection à la souris sur plusieurs répliques ne copie que le texte (signalement 113) */
.fonds-cue[aria-current="true"] { background: var(--blue-light); color: var(--text); border-left-color: var(--accent); }
.fonds-cue--match .fonds-cue-tc { color: var(--accent); }
.fonds-summary { font-size: 15px; line-height: 1.6; max-height: calc(100vh - 240px); overflow: auto; }
.fonds-md > * + * { margin-top: var(--space-3); }
.fonds-md h2, .fonds-md h3, .fonds-md h4, .fonds-md h5, .fonds-md h6 { font-family: var(--font-heading); line-height: 1.3; margin-top: var(--space-4); }
.fonds-md h2 { font-size: 18px; }
.fonds-md h3 { font-size: 16px; }
.fonds-md h4, .fonds-md h5, .fonds-md h6 { font-size: 15px; }
.fonds-md ul, .fonds-md ol { padding-left: var(--space-6); }
.fonds-md li + li { margin-top: var(--space-1); }
.fonds-md blockquote { border-left: 3px solid var(--border-strong); padding-left: var(--space-3); color: var(--text-2); }
.fonds-md code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); padding: 0 4px; border-radius: var(--radius-s); }
.fonds-md hr { border: 0; border-top: 1px solid var(--border); }

@media (max-width: 1100px) {
  .fonds-media { grid-template-columns: minmax(0, 1fr); }
  .fonds-cues { max-height: 50vh; }
}
@media (max-width: 899px) {
  .fonds-hit { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .fonds-hit-save { justify-self: end; }
  .fonds-search { padding: var(--space-3); }
}
@media (prefers-reduced-motion: no-preference) {
  .fonds-cues { scroll-behavior: smooth; }
}

/* Lecteur ancré : colonne collante à côté des résultats (au-dessus sur écran étroit), indépendante de la liste */
.fonds-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.fonds-split.has-player { grid-template-columns: minmax(0, 1fr) minmax(min(100%, 400px), 46%); }
.fonds-main { min-width: 0; }
.fonds-dock { position: sticky; top: var(--space-3); max-height: calc(100vh - 2 * var(--space-3)); overflow: auto; display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: 0 6px 24px rgba(15, 23, 42, .08); min-width: 0; }
.fonds-dock[hidden] { display: none; }
.fonds-dock-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.fonds-dock-head h2 { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; font-weight: 600; margin: 0; min-width: 0; }
.fonds-dock .player { width: 100%; }
.fonds-dock-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.fonds-dock-actions [hidden] { display: none; }
.fonds-dock-sel { font-variant-numeric: tabular-nums; }
.fonds-hit.is-playing { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 1180px) {
  .fonds-split.has-player { grid-template-columns: minmax(0, 1fr); }
  .fonds-dock { order: -1; top: 0; z-index: 5; max-height: 62vh; }
  .fonds-dock .player-view { max-height: 34vh; }
}

/* Dialogues d'export : habillage de l'extrait, choix du projet pour le chutier */
.fonds-dl-synthes { display: grid; grid-template-columns: 160px 1fr 1fr; gap: var(--space-2); }
.fonds-dl-synthes[hidden] { display: none; }
.fonds-bin { display: flex; flex-direction: column; gap: var(--space-2); min-width: min(560px, 80vw); }
.fonds-bin-list { display: flex; flex-direction: column; max-height: 42vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.fonds-bin-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: var(--space-3); align-items: center; text-align: left; padding: 6px var(--space-3); border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; cursor: pointer; }
.fonds-bin-row:last-child { border-bottom: 0; }
.fonds-bin-row:hover, .fonds-bin-row:focus-visible { background: var(--hover); }
.fonds-bin-row.is-last { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.fonds-bin-thumb { grid-row: 1 / span 2; width: 64px; height: 36px; object-fit: cover; border-radius: 4px; background: #000; }
.fonds-bin-name { font-weight: 500; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.fonds-bin-new { display: flex; align-items: flex-end; gap: var(--space-2); }
.fonds-bin-new .field { flex: 1; min-width: 0; }

/* Historique des recherches (signalement 136, 28 octobre 2026) */
.fonds-history { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: var(--space-2) var(--space-4); }
.fonds-history-label { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; margin-right: 4px; }
.fonds-history-chip { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.fonds-history-chip:hover { border-color: var(--accent); color: var(--text); }
.fonds-history-chip b { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.fonds-history-ctx { color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.fonds-history-more { border: 0; background: none; color: var(--text-3); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.fonds-history-more:hover { color: var(--text); }

/* bouton Notebook sur chaque passage (28 octobre 2026) : discret, visible au survol ou au clavier */
.fonds-hit-save { align-self: start; opacity: .45; transition: opacity .15s; }
.fonds-hit:hover .fonds-hit-save, .fonds-hit:focus-within .fonds-hit-save, .fonds-hit.is-playing .fonds-hit-save { opacity: 1; }
@media (hover: none) { .fonds-hit-save { opacity: 1; } }
