/* Aide par IA : préremplir avec les photos, reconnaître le composant, régler la clé. Couleurs de style.css. */

/* Une pile d'éléments espacés. Une zone d'état vide ne prend pas de place mais reste dans la page :
   un lecteur d'écran annonce ce qu'on y écrit ensuite. */
.ia-pile { display: grid; justify-items: start; }
.ia-pile > * + * { margin-top: 10px; }
.ia-pile > :empty, .ia-pile > [hidden]:first-child + * { margin-top: 0; }

.ia-etat { font-size: 14px; line-height: 1.4; color: var(--texte-doux); }
.ia-etat.attente { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--encre); }
.ia-etat.attente::before { content: ''; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--trait); border-top-color: var(--accent); animation: ia-tourne 0.9s linear infinite; }
.ia-etat.question { font-size: 16px; font-weight: 650; color: var(--encre); }
.ia-etat.probleme, .ia-etat.fait { padding: 10px 12px; border-radius: var(--rayon); font-weight: 600; }
.ia-etat.probleme { background: var(--alerte-clair); color: #5d3804; }
.ia-etat.fait { background: var(--succes-clair); color: #134b30; }
.ia-etat.rappel { animation: ia-rappel 0.7s; }
@keyframes ia-tourne { to { rotate: 1turn; } }
@keyframes ia-rappel { 0%, 60% { color: var(--accent-sombre); font-weight: 700; } }
@media (prefers-reduced-motion: reduce) {
  .ia-etat.attente::before { animation-duration: 4s; }
}

/* ------------------------------------------------------------------ dans la fiche */
.ia-bloc { margin-top: 4px; scroll-margin-top: 70px; }
.ia-lancer { min-height: 54px; padding: 12px 20px; font-size: 17px; line-height: 1.25; text-align: left; }
.ia-lancer svg { width: 22px; height: 22px; }
/* Sans photo, le bouton reste appuyable : il rappelle alors ce qu'il faut faire d'abord. */
.bouton.ia-lancer[aria-disabled='true'], .bouton.ia-lancer[aria-disabled='true']:hover { background: var(--papier); border-color: var(--trait-fort); color: var(--texte-doux); }
.ia-resultat { width: 100%; }

.ia-panneau { display: grid; gap: 12px; padding: 16px 16px 0; border: 1px solid var(--trait-fort); border-radius: var(--rayon); background: var(--papier); scroll-margin-top: 70px; }
.ia-panneau:focus { outline: none; }
.ia-panneau:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ia-commentaire { padding: 10px 12px; border-radius: 6px; background: var(--info-clair); color: #1d3f61; font-size: 14.5px; line-height: 1.4; }
.ia-groupe { display: grid; }
.ia-groupe h4 { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--texte-doux); }
.ia-ligne { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; min-height: 52px; padding: 8px 2px; border-top: 1px solid var(--trait); cursor: pointer; }
.ia-ligne input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ia-texte { display: grid; gap: 1px; }
.ia-libelle { font-size: 13.5px; color: var(--texte-doux); }
.ia-texte strong { font-size: 16px; font-weight: 650; color: var(--encre); overflow-wrap: anywhere; white-space: pre-line; }
.ia-deja { font-size: 13px; font-weight: 600; color: var(--alerte); overflow-wrap: anywhere; }
.ia-pastille { padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.ia-pastille.lu { background: var(--succes-clair); color: var(--succes); }
.ia-pastille.estime { background: var(--alerte-clair); color: var(--alerte); }
/* Le bouton qui applique reste en bas de l'écran tant que la liste défile. */
.ia-actions { position: sticky; bottom: 0; display: grid; margin: 0 -16px; padding: 12px 16px; background: var(--papier); border-top: 1px solid var(--trait); }
.ia-actions:last-child { border-radius: 0 0 var(--rayon) var(--rayon); }
.ia-actions .bouton, .ia-refus { width: min(420px, 100%); min-height: 50px; }
.ia-refus { margin: -4px 0 16px; }

/* ------------------------------------------------------------------ « Que relevez-vous ? » */
.ia-photo { width: min(520px, 100%); justify-content: flex-start; line-height: 1.25; text-align: left; }
.ia-photo:not(.principal) { min-height: 48px; width: auto; padding: 10px 16px; font-size: 16px; }
.ia-photo:not(.principal) svg { width: 20px; height: 20px; stroke-width: 1.8; }
.ia-vignettes { display: flex; gap: 8px; }
.ia-vignettes img { width: 96px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--trait); background: var(--papier2); }
.ia-types { width: min(520px, 100%); justify-items: stretch; }
.ia-type { display: grid; gap: 4px; min-height: 64px; padding: 14px 18px; border-color: var(--trait-fort); text-align: left; }
.ia-type:hover { border-color: var(--accent); }
.ia-type:disabled { opacity: 0.6; cursor: default; }
.ia-type p { font-size: 14.5px; color: var(--texte-doux); }
/* Un article du catalogue retrouvé d'après la référence lue sur la photo. */
.ia-article { border-left: 5px solid var(--succes); }
.ia-article.proche, .ia-article.famille { border-left-color: var(--alerte); }
.ia-article h3 { font-family: var(--mono, ui-monospace, Consolas, monospace); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.ia-origine { font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texte-doux); }
.ia-certitude { justify-self: start; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--succes-clair); color: var(--succes); }
.ia-article.proche .ia-certitude, .ia-article.famille .ia-certitude { background: var(--alerte-clair); color: var(--alerte); }
.ia-pastille.catalogue { background: var(--papier2); color: var(--encre); border: 1px solid var(--trait-fort); }

/* ------------------------------------------------------------------ « Gérer les comptes » */
.ia-reglage { justify-items: stretch; max-width: 520px; padding: 20px; }
.ia-reglage > * + * { margin-top: 14px; }
.ia-reglage .ia-saisie { display: grid; gap: 14px; }
.ia-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.ia-boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.ia-confirmation { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--rayon); background: var(--alerte-clair); color: #5d3804; font-weight: 600; }

@media (max-width: 940px) {
  /* Sur téléphone la vue 3D reste collée en haut : le panneau s'arrête dessous. */
  .ia-panneau, .ia-bloc { scroll-margin-top: calc(max(30vh, 190px) + 70px); }
}
@media (max-width: 520px) {
  .ia-lancer, .ia-photo.principal { width: 100%; }
  .ia-ligne { grid-template-columns: auto minmax(0, 1fr); }
  .ia-pastille { grid-column: 2; justify-self: start; }
}
