/*
 * InnovX — comportement commun des boutons : survol, appui, focus clavier,
 * état désactivé et état « en cours » (posé par static/js/innovx-boutons.js).
 */

button,
input[type="submit"],
input[type="button"],
[role="button"],
a.btn,
.btn {
  transition: filter .15s ease, box-shadow .15s ease, opacity .15s ease, background-color .15s ease, color .15s ease;
}

/* Survol : léger éclaircissement, quelle que soit la couleur du bouton */
button:not(:disabled):not(.ix-occupe):hover,
input[type="submit"]:not(:disabled):not(.ix-occupe):hover,
input[type="button"]:not(:disabled):not(.ix-occupe):hover,
[role="button"]:not(.ix-occupe):hover,
a.btn:not(.ix-occupe):hover,
.btn:not(:disabled):not(.ix-occupe):hover {
  filter: brightness(1.08);
  cursor: pointer;
}

/* Appui */
button:not(:disabled):not(.ix-occupe):active,
input[type="submit"]:not(:disabled):not(.ix-occupe):active,
.btn:not(:disabled):not(.ix-occupe):active {
  filter: brightness(.94);
}

/* Navigation au clavier : anneau jaune InnovX */
button:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible,
[role="button"]:focus-visible,
a.btn:focus-visible,
.btn:focus-visible {
  outline: 2px solid #FFD73A !important;
  outline-offset: 2px !important;
}

/* Désactivé */
button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
.btn:disabled,
.btn.disabled {
  cursor: not-allowed !important;
  opacity: .6;
  filter: none !important;
}

/* En cours (requête envoyée) : non cliquable + indicateur de chargement */
.ix-occupe {
  position: relative !important;
  pointer-events: none !important;
  cursor: progress !important;
  opacity: .75;
}
.ix-occupe > * {
  visibility: hidden;
}
button.ix-occupe,
a.ix-occupe,
.btn.ix-occupe,
[role="button"].ix-occupe {
  color: transparent !important;
}
button.ix-occupe::after,
a.ix-occupe::after,
.btn.ix-occupe::after,
[role="button"].ix-occupe::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(140, 140, 140, .95);
  border-right-color: transparent;
  animation: ix-tourne .7s linear infinite;
  visibility: visible;
}
/* input type=submit ne peut pas porter ::after : texte atténué */
input.ix-occupe {
  color: rgba(0, 0, 0, .45) !important;
}
@keyframes ix-tourne {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ix-occupe::after { animation-duration: 1.6s; }
}

/*
 * Boutons radio et cases à cocher : tailwind-output.css impose « input, select, textarea { width: 100% } »,
 * ce qui étire aussi radios et cases à cocher. Dans une ligne flex (moyens de paiement, options…),
 * le contrôle mange alors la place du texte voisin, écrasé à un mot par ligne sur mobile.
 * Même spécificité que la règle Tailwind (0,0,1) et chargé après elle : la taille native revient,
 * mais toute classe (.w-5, .w-full, .sr-only…) ou règle de page garde la priorité.
 */
input:where([type="radio"], [type="checkbox"]) {
  width: auto;
  flex-shrink: 0;
}
