/* ============================================================================
   VXG-v2 — Proposer une correction de fiche vidéo.
   Chargé UNIQUEMENT sur la page vidéo (condition identique à vxg-action-bar.js).

   La feuille elle-même réutilise le panneau de la barre d'action (.vxg-action-menu) :
   popover desktop, bottom-sheet mobile, scrim, piège de focus, Échap, retour Android
   sont donc déjà fournis par vxg-action-bar.css et vxg-action-bar.js. On n'ajoute ici
   que la largeur du panneau et la mise en page du formulaire.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Cartes fantômes dans les rails Casting et Explorer
   Calées au pixel sur les cartes réelles (vxg-v2.css:1167 et :1178), mais en
   contour tireté et en couleur secondaire : présentes, jamais en avant.
   -------------------------------------------------------------------------- */

html .vxg-cast-card.is-suggest,
html .vxg-ex-card.is-suggest{
  font:inherit;                       /* ce sont des <button>, pas des <a> */
  cursor:pointer;
  background:transparent;
  border:1px dashed color-mix(in oklab,var(--foreground) 22%,transparent);
  color:var(--muted-foreground);
  transition:border-color .2s,color .2s,background .2s,transform .2s;
}

/* Portrait 3:4, même gabarit que .vxg-cast-card */
html .vxg-cast-card.is-suggest{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:8px;
  text-align:center;
}
html .vxg-cast-card.is-suggest svg{
  width:22px;height:22px;
  fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;
}
html .vxg-cast-card.is-suggest span{
  font-size:11.5px;font-weight:650;line-height:1.25;
}
@media (min-width:1024px){
  html .vxg-cast-card.is-suggest span{font-size:12.5px}
}

/* Mini-carte horizontale, même gabarit que .vxg-ex-card */
html .vxg-ex-card.is-suggest .vxg-ex-thumb{
  background:transparent;
  border:1px dashed color-mix(in oklab,var(--foreground) 18%,transparent);
}
html .vxg-ex-card.is-suggest .vxg-ex-thumb svg{
  width:20px;height:20px;
  fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;
}
html .vxg-ex-card.is-suggest .vxg-ex-label{
  color:var(--muted-foreground);
  font-weight:600;
}

/* La couleur de marque n'apparaît qu'à l'intention : survol, focus. */
@media (min-width:1024px) and (hover:hover) and (pointer:fine){
  html .vxg-cast-card.is-suggest:hover,
  html .vxg-ex-card.is-suggest:hover{
    border-color:color-mix(in oklab,var(--primary) 55%,transparent);
    border-style:solid;
    color:var(--foreground);
    background:var(--surface);
  }
  html .vxg-ex-card.is-suggest:hover .vxg-ex-label{color:var(--foreground)}
  html .vxg-ex-card.is-suggest:hover .vxg-ex-thumb{
    border-color:color-mix(in oklab,var(--primary) 45%,transparent);
    color:var(--primary-glow);
  }
}
html .vxg-cast-card.is-suggest:focus-visible,
html .vxg-ex-card.is-suggest:focus-visible{
  outline:2px solid var(--primary-glow);
  outline-offset:3px;
  border-color:var(--primary);
  color:var(--foreground);
}

/* Une fois la proposition envoyée depuis cet appareil (localStorage), l'invite s'efface. */
html .vxg-cast-card.is-suggest.is-sent,
html .vxg-ex-card.is-suggest.is-sent{
  opacity:.55;
  pointer-events:none;
  border-style:solid;
}

/* ----------------------------------------------------------------------------
   2. Le panneau
   Sur mobile, .vxg-action-menu est déjà un bottom-sheet plein largeur : on n'y touche pas.
   Sur desktop, le popover 360 px de la barre d'action est inadapté à ce formulaire —
   on en fait une vraie boîte de dialogue centrée et large.

   ⚠️ positionMenu() (vxg-action-bar.js:313) pose des styles EN LIGNE (top/left/max-height)
   pour ancrer le popover sur le bouton ⋮ : d'où les !important qui les neutralisent.
   -------------------------------------------------------------------------- */

@media (min-width:1024px){
  html .vxg-action-suggest-menu{
    position:fixed!important;
    top:50%!important;
    left:50%!important;
    right:auto!important;
    bottom:auto!important;
    transform:translate(-50%,-50%);
    width:min(860px,calc(100vw - 64px))!important;
    max-width:none!important;
    max-height:min(88vh,940px)!important;
    /* Au-dessus de toutes les couches VXG (toast = 300, plafond du thème),
       en dessous de fancybox (8010) pour ne pas passer devant une modale native. */
    z-index:400;
    display:flex;
    flex-direction:column;
    padding:0!important;
    border-radius:20px;
    overflow:hidden!important;
    box-shadow:0 40px 100px -30px oklch(0 0 0 / .85), 0 0 0 1px var(--border);
  }

  /* Fond assombri : on réutilise le scrim natif, que le JS de la barre ne révèle qu'en
     mobile. La classe est posée sur <html> par vxg-suggest.js — pas de :has(), et ça nous
     donne au passage le verrouillage du défilement. */
  html.vxg-sg-open{overflow:hidden}
  html.vxg-sg-open .vxg-action-scrim{
    display:block!important;
    position:fixed;
    inset:0;
    z-index:399;
    background:oklch(0 0 0 / .72);
    -webkit-backdrop-filter:blur(6px);
    backdrop-filter:blur(6px);
  }

  /* En-tête fixe : titre à gauche, croix à droite. Le thème masque .vxg-action-sheet-close
     en desktop (vxg-action-bar.css:216) — ici on la veut. */
  html .vxg-action-suggest-menu .vxg-action-sheet-head{
    display:flex!important;
    align-items:center;
    gap:12px;
    flex:0 0 auto;
    margin:0;
    padding:16px 20px;
    border-bottom:1px solid var(--border);
    background:var(--surface-elevated);
  }
  html .vxg-action-suggest-menu .vxg-action-sheet-head>span{display:none} /* le grip est mobile */
  html .vxg-action-suggest-menu .vxg-action-sheet-head strong{
    flex:1;
    font-family:'Outfit','Inter',sans-serif;
    font-size:18px;font-weight:800;letter-spacing:-.01em;
    color:var(--foreground);
  }
  html .vxg-action-suggest-menu .vxg-action-sheet-close{
    display:inline-grid!important;
    place-items:center;
    flex:0 0 auto;
    width:40px;height:40px;
    padding:0;
    border:1px solid var(--border);
    border-radius:9999px;
    background:color-mix(in oklab,var(--foreground) 6%,transparent);
    color:var(--foreground);
    cursor:pointer;
    transition:background .16s,border-color .16s;
  }
  html .vxg-action-suggest-menu .vxg-action-sheet-close:hover{
    background:color-mix(in oklab,var(--primary) 18%,transparent);
    border-color:color-mix(in oklab,var(--primary) 45%,transparent);
  }
  html .vxg-action-suggest-menu .vxg-action-sheet-close svg{
    width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;
  }

  /* Corps défilant */
  html .vxg-action-suggest-menu [data-vxg-suggest-body]{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    padding:16px 20px 20px;
  }

  /* La largeur gagnée sert d'abord aux catégories, qui sont le gros du formulaire. */
  html .vxg-action-suggest-menu .vxg-sg-cats{max-height:none}
  html .vxg-action-suggest-menu .vxg-sg-catgroup{
    break-inside:avoid;
    page-break-inside:avoid;
  }
  html .vxg-action-suggest-menu .vxg-sg-cats > .vxg-sg-catgroup{margin-bottom:14px}
  html .vxg-action-suggest-menu [data-vxg-sg-cats]{
    column-count:2;
    column-gap:24px;
  }
  html .vxg-action-suggest-menu .vxg-sg-legend{column-span:all}
}

@media (min-width:1400px){
  html .vxg-action-suggest-menu [data-vxg-sg-cats]{column-count:3}
}

html .vxg-sg-loading{
  display:flex;align-items:center;justify-content:center;gap:10px;
  min-height:120px;padding:20px;
  color:var(--muted-foreground);font-size:13px;
}
html .vxg-sg-loading::before{
  content:"";width:18px;height:18px;flex:0 0 auto;
  border:2px solid oklch(1 0 0/.14);border-top-color:var(--primary);border-radius:9999px;
  animation:vxg-model-spin .7s linear infinite;
}

/* ----------------------------------------------------------------------------
   3. Le formulaire
   -------------------------------------------------------------------------- */

html .vxg-sg-form{margin:0;padding:0 4px 4px}

html .vxg-sg-intro{
  margin:2px 0 9px;
  color:var(--muted-foreground);
  font-size:12.5px;font-weight:700;
}

html .vxg-sg-chips{display:flex;flex-wrap:wrap;gap:7px;margin:0 0 4px}
html .vxg-sg-chip{
  display:inline-flex;align-items:center;
  min-height:36px;padding:0 14px;
  border:1px solid var(--border);border-radius:9999px;
  background:var(--surface);
  color:color-mix(in oklab,var(--foreground) 82%,transparent);
  font:inherit;font-size:12.5px;font-weight:650;
  cursor:pointer;
  transition:background .18s,border-color .18s,color .18s;
}
html .vxg-sg-chip[aria-pressed="true"]{
  border-color:color-mix(in oklab,var(--primary) 50%,transparent);
  background:color-mix(in oklab,var(--primary) 15%,transparent);
  color:var(--primary-glow);
}
html .vxg-sg-chip:focus-visible{outline:2px solid var(--primary-glow);outline-offset:2px}
@media (min-width:1024px) and (hover:hover) and (pointer:fine){
  html .vxg-sg-chip:hover{background:color-mix(in oklab,var(--foreground) 7%,transparent)}
}

html .vxg-sg-panel{
  margin:10px 0 0;padding:12px 12px 4px;
  border:1px solid var(--border);border-radius:12px;
  background:color-mix(in oklab,var(--foreground) 3%,transparent);
}
html .vxg-sg-panel[hidden]{display:none}

html .vxg-sg-hint{
  margin:2px 0 10px;
  color:var(--muted-foreground);
  font-size:11.5px;line-height:1.45;
}

/* Catégories : vocabulaire fermé, 86 cases groupées. */
html .vxg-sg-cats{margin:0;padding:0;border:0;max-height:240px;overflow-y:auto;overscroll-behavior:contain}
html .vxg-sg-legend{
  display:block;width:100%;padding:0 0 8px;
  color:var(--muted-foreground);font-size:11.5px;font-weight:700;
}
html .vxg-sg-legend span{color:var(--primary-glow)}
html .vxg-sg-catgroup{margin-bottom:12px}
html .vxg-sg-catgroup h4{
  margin:0 0 6px;
  color:var(--muted-foreground);
  font-family:'Inter',sans-serif;
  font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.14em;
}
html .vxg-sg-catlist{display:flex;flex-wrap:wrap;gap:6px}
html .vxg-sg-cat{
  display:inline-flex;align-items:center;gap:7px;
  min-height:34px;padding:0 11px;
  border:1px solid var(--border);border-radius:9999px;
  background:var(--surface);
  color:color-mix(in oklab,var(--foreground) 84%,transparent);
  font-size:12px;line-height:1.2;cursor:pointer;
}
html .vxg-sg-cat input{
  flex:none;width:15px;height:15px;margin:0;
  accent-color:var(--primary);cursor:pointer;
}
html .vxg-sg-cat:has(input:checked){
  border-color:color-mix(in oklab,var(--primary) 45%,transparent);
  background:color-mix(in oklab,var(--primary) 12%,transparent);
  color:var(--foreground);
}
html .vxg-sg-cat:has(input:focus-visible){outline:2px solid var(--primary-glow);outline-offset:2px}
html .vxg-sg-cat.is-blocked{opacity:.45}

/* Acteur absent du référentiel. Décollé du sélecteur : la liste de résultats de
   l'autocomplete est en absolu juste au-dessus et ne doit pas sembler lui appartenir. */
html .vxg-sg-newmodels{margin-top:16px;padding-top:14px;border-top:1px dashed var(--border)}

html .vxg-sg-note{margin-top:14px}
html .vxg-sg-note span em{
  font-style:normal;font-weight:500;
  color:color-mix(in oklab,var(--muted-foreground) 80%,transparent);
}

/* Champ-piège : hors flux, hors lecture d'écran, hors tabulation. */
html .vxg-sg-hp{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}

html .vxg-sg-error{
  margin:10px 4px 0;padding:9px 11px;
  border:1px solid color-mix(in oklab,var(--primary) 45%,transparent);
  border-radius:10px;
  background:color-mix(in oklab,var(--primary) 12%,transparent);
  color:var(--foreground);
  font-size:12.5px;line-height:1.4;
}
html .vxg-sg-error[hidden]{display:none}

html .vxg-sg-foot{margin-top:14px}
html .vxg-sg-foot .vxg-sg-hint{margin:0 4px 8px}
html .vxg-sg-form .vxg-action-submit[disabled]{
  opacity:.45;cursor:not-allowed;
}
html .vxg-sg-form.is-sending .vxg-action-submit{opacity:.6;pointer-events:none}

/* Champs : le thème ne style .textfield/.textarea que dans .modal-inner ; ici on
   s'aligne explicitement sur .vxg-action-field (vxg-action-bar.css:369-390). */
html .vxg-sg-form .textfield,
html .vxg-sg-form input[type="search"]{
  width:100%;height:40px;padding:0 11px;
  border:1px solid var(--border);border-radius:10px;
  background:var(--surface);
  color:var(--foreground);
  font:inherit;font-size:13px;font-weight:500;
}
html .vxg-sg-form textarea{max-height:220px}

/* ----------------------------------------------------------------------------
   4. Sélecteur à puces (acteurs et tags)
   Report des règles .vxg-model-picker__* de vxg-photo-gallery.css:137-162, qui
   n'est pas chargé sur la page vidéo. Les deux feuilles ne cohabitent jamais.
   -------------------------------------------------------------------------- */

html .vxg-sg-form .vxg-model-picker{position:relative}
html .vxg-sg-form .vxg-model-picker>small{display:block;margin:-2px 0 10px;color:var(--muted-foreground);font-size:11.5px;line-height:1.45}
html .vxg-sg-form .vxg-model-picker__chips{display:flex;flex-wrap:wrap;gap:7px;margin:0 0 9px}
html .vxg-sg-form .vxg-model-picker__chips:empty{display:none}
html .vxg-sg-form .vxg-model-picker__chip{display:inline-flex;align-items:center;gap:7px;min-height:34px;padding:0 5px 0 11px;border:1px solid color-mix(in oklab,var(--primary) 35%,var(--border));border-radius:9999px;background:color-mix(in oklab,var(--primary) 10%,transparent);color:var(--foreground);font-size:12px}
html .vxg-sg-form .vxg-model-picker__chip b{font-weight:780}
html .vxg-sg-form .vxg-model-picker__chip button{display:grid;place-items:center;width:25px;height:25px;padding:0;border:0;border-radius:9999px;background:transparent;color:var(--muted-foreground);font:700 18px/1 Arial;cursor:pointer}
html .vxg-sg-form .vxg-model-picker__chip button:hover,
html .vxg-sg-form .vxg-model-picker__chip button:focus-visible{background:oklch(1 0 0/.08);color:#fff;outline:none}
html .vxg-sg-form .vxg-model-picker__search{position:relative}
html .vxg-sg-form .vxg-model-picker__search>svg{position:absolute;z-index:1;top:50%;left:14px;width:18px;height:18px;transform:translateY(-50%);fill:none;stroke:var(--muted-foreground);stroke-width:1.8;stroke-linecap:round;pointer-events:none}
html .vxg-sg-form .vxg-model-picker__search .textfield{padding-left:43px;padding-right:42px}
html .vxg-sg-form .vxg-model-picker__loader{position:absolute;top:50%;right:14px;width:16px;height:16px;margin-top:-8px;border:2px solid oklch(1 0 0/.14);border-top-color:var(--primary);border-radius:9999px;opacity:0;animation:vxg-model-spin .7s linear infinite;pointer-events:none}
html .vxg-sg-form .vxg-model-picker.is-loading .vxg-model-picker__loader{opacity:1}
html .vxg-sg-form .vxg-model-picker__results{position:absolute;z-index:180;right:0;left:0;top:100%;max-height:250px;margin-top:5px;overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--border);border-radius:12px;background:var(--surface-elevated);box-shadow:0 18px 42px oklch(0 0 0/.45)}
html .vxg-sg-form .vxg-model-picker__result-list{padding:5px}
html .vxg-sg-form .vxg-model-picker__result{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:5px 8px;border:0;border-radius:9px;background:transparent;color:var(--foreground);font:inherit;text-align:left;cursor:pointer}
html .vxg-sg-form .vxg-model-picker__result:hover,
html .vxg-sg-form .vxg-model-picker__result.is-active,
html .vxg-sg-form .vxg-model-picker__result:focus-visible{background:oklch(1 0 0/.065);outline:none}
html .vxg-sg-form .vxg-model-picker__result.is-selected{color:var(--primary-glow)}
html .vxg-sg-form .vxg-model-picker__result img,
html .vxg-sg-form .vxg-model-picker__result>span{display:grid;place-items:center;flex:0 0 auto;width:36px;height:36px;border-radius:8px;background:oklch(1 0 0/.06);object-fit:cover;color:var(--muted-foreground);font-weight:800}
html .vxg-sg-form .vxg-model-picker__result b{overflow:hidden;font-size:13px;font-weight:760;text-overflow:ellipsis;white-space:nowrap}
html .vxg-sg-form .vxg-model-picker__result small{margin-left:auto;flex:0 0 auto;color:var(--muted-foreground);font-size:11px}
html .vxg-sg-form .vxg-model-picker__no-result{margin:0;padding:13px;color:var(--muted-foreground);font-size:12.5px;text-align:center}

@keyframes vxg-model-spin{to{transform:rotate(360deg)}}

/* ----------------------------------------------------------------------------
   5. Mobile — le panneau est déjà un bottom-sheet, on élargit juste les cibles.
   -------------------------------------------------------------------------- */

@media (max-width:1023px){
  html .vxg-sg-chip{min-height:42px;padding:0 16px;font-size:13px}
  html .vxg-sg-cat{min-height:40px;font-size:12.5px}
  html .vxg-sg-cats{max-height:none}
  html .vxg-sg-form .vxg-model-picker__chip{min-height:38px}
  html .vxg-sg-form .vxg-model-picker__result{min-height:48px}
  /* La liste de résultats déborderait de la sheet en position absolue près du bas :
     on la laisse dans le flux pour qu'elle pousse le contenu et reste atteignable. */
  html .vxg-sg-form .vxg-model-picker__results{position:static;max-height:210px}
}

/* ----------------------------------------------------------------------------
   6. Accessibilité
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion:reduce){
  html .vxg-cast-card.is-suggest,
  html .vxg-ex-card.is-suggest,
  html .vxg-sg-chip{transition:none}
  html .vxg-sg-loading::before,
  html .vxg-sg-form .vxg-model-picker__loader{animation:none}
}
