/* ===== EQM CONFIRM - Global confirmation/alert modal ===== */
/* Usage: eqmConfirm({ title, message, theme, okLabel, cancelLabel, onConfirm, onCancel, alertOnly, promptMode }) */

.eqm-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(255,255,255,.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease
}

.eqm-confirm-overlay.show {
  display: flex;
  opacity: 1;
  pointer-events: auto
}

.eqm-confirm-box {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem 1.75rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
  text-align: center;
  transform: scale(.9);
  transition: transform .3s cubic-bezier(.175,.885,.32,1.1)
}

.eqm-confirm-overlay.show .eqm-confirm-box {
  transform: scale(1)
}

.eqm-confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.35rem
}

.eqm-confirm-icon.amber {
  background: rgba(245,158,11,.12);
  color: #f59e0b
}

.eqm-confirm-icon.danger {
  background: rgba(239,68,68,.12);
  color: #ef4444
}

.eqm-confirm-icon.info {
  background: rgba(var(--primary-rgb),.12);
  color: var(--primary)
}

/* 'primary' = confirmation d'une action posee en QUESTION (« Valider ? »).
   Teinte bleue interrogative (decision), volontairement distincte du vert
   'info' (succes) : une question ne doit pas ressembler a un succes. */
.eqm-confirm-icon.primary {
  background: rgba(59,130,246,.12);
  color: #3b82f6
}

.eqm-confirm-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 .45rem
}

.eqm-confirm-desc {
  font-size: .85rem;
  color: #64748b;
  line-height: 1.55;
  margin: 0 0 1.5rem;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto
}

.eqm-confirm-actions {
  display: flex;
  gap: .65rem;
  justify-content: center;
  flex-wrap: wrap
}

.eqm-confirm-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .625rem 1.25rem;
  border-radius: .75rem;
  font-family: 'Outfit', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .2s
}

.eqm-confirm-btn.cancel {
  background: #f1f5f9;
  color: #475569
}

.eqm-confirm-btn.cancel:hover {
  background: #e2e8f0;
  color: #334155
}

.eqm-confirm-btn.ok.amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 4px 14px -2px rgba(245,158,11,.4)
}

.eqm-confirm-btn.ok.amber:hover {
  filter: brightness(1.08);
  transform: translateY(-1px)
}

.eqm-confirm-btn.ok.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px -2px rgba(239,68,68,.4)
}

.eqm-confirm-btn.ok.danger:hover {
  filter: brightness(1.08);
  transform: translateY(-1px)
}

.eqm-confirm-btn.ok.primary,
.eqm-confirm-btn.ok.info {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px -2px rgba(var(--primary-rgb),.4)
}

.eqm-confirm-btn.ok.primary:hover,
.eqm-confirm-btn.ok.info:hover {
  filter: brightness(1.08);
  transform: translateY(-1px)
}

/* Prompt input */
.eqm-confirm-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: .875rem;
  outline: none;
  transition: border-color .2s;
  margin-top: .25rem;
  box-sizing: border-box
}

.eqm-confirm-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.1)
}

/* ============================================================
   Choix du type de document dans un eqm-confirm (radio-cards).
   Utilise dans le modal "Facturer les prestations" (panier client)
   en remplacement d'un <select> natif dont le dropdown debordait
   du modal bottom-sheet sur smartphone. Pattern reutilisable
   pour tout modal de type confirm exigeant un choix discret.
   ============================================================ */
.fp-doctype-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}

.fp-doctype-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .65rem .4rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: .78rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.fp-doctype-card:hover {
  border-color: var(--primary, #10b981);
  color: var(--primary, #10b981);
}

.fp-doctype-card.is-active {
  background: rgba(var(--primary-rgb, 16, 185, 129), .08);
  border-color: var(--primary, #10b981);
  color: var(--primary, #10b981);
  box-shadow: 0 2px 6px rgba(var(--primary-rgb, 16, 185, 129), .15);
}

.fp-doctype-card .fp-doctype-ico {
  font-size: 1.05rem;
}

.fp-doctype-card .fp-doctype-lbl {
  line-height: 1.1;
}

/* Mobile bottom-sheet style */
@media (max-width: 768px) {
  .eqm-confirm-overlay {
    align-items: flex-end;
    padding: 0
  }

  .eqm-confirm-box {
    max-width: 100%;
    border-radius: 1.25rem 1.25rem 0 0;
    padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.22,1,.36,1)
  }

  .eqm-confirm-overlay.show .eqm-confirm-box {
    transform: translateY(0)
  }
}

/* ============================================================================
   CROIX DE FERMETURE (07/09/2026)
   ----------------------------------------------------------------------------
   Le §2 en exige une sur CHAQUE modal ; ce composant global n'en avait pas. En
   mode `alertOnly` le bouton « Annuler » est masqué : il ne restait alors aucun
   moyen VISIBLE de fermer — seulement le clic sur le fond, que rien n'annonce.

   32 px à l'œil, 44 px au doigt via un ::after transparent : le patron du dépôt
   (§17). Grossir le dessin écraserait un modal volontairement compact.
   ========================================================================= */
.eqm-confirm-box { position: relative; }
.eqm-confirm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, .05);
    color: #64748b;
    font-size: .95rem;
    cursor: pointer;
    z-index: 2;
    transition: background .2s ease, color .2s ease, transform .3s ease;
}
.eqm-confirm-close:hover { background: rgba(15, 23, 42, .10); color: #0f172a; transform: rotate(90deg); }
.eqm-confirm-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* La cible tactile, invisible et centrée sur la croix. */
.eqm-confirm-close::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 44px; height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}
@media (prefers-reduced-motion: reduce) { .eqm-confirm-close, .eqm-confirm-close:hover { transition: none; transform: none; } }

/* =============================================================================
   UNE BOÎTE LARGE — pour les confirmations qui portent un VRAI formulaire
   -----------------------------------------------------------------------------
   `eqmConfirm` sert aussi de cadre à des formulaires (relevé d'état du cheval,
   saisie d'un objectif) via `messageHtml`. Sa boîte de 400 px les empilait sur
   toute la hauteur de l'écran, sans marge en haut ni en bas (demande client du
   25/10/2026). L'appelant demande cette classe par l'option `classe`.

   Le texte descriptif perd sa largeur bridée de 300 px : il n'a de sens que pour
   une question courte, pas pour un formulaire.
   ============================================================================= */
.eqm-confirm-box.eqm-confirm--large {
    max-width: 720px;
    /* La hauteur est bornée, et c'est le CONTENU qui défile : la boîte garde
       ainsi ses marges en haut et en bas, et ses boutons restent visibles. */
    max-height: calc(100vh - 80px);
    display: flex; flex-direction: column;
}
.eqm-confirm--large .eqm-confirm-desc {
    max-width: none;
    overflow-y: auto;
    text-align: left;
}
.eqm-confirm--large .eqm-confirm-actions { margin-top: auto; }
@media (max-width: 768px) {
    .eqm-confirm-box.eqm-confirm--large { max-height: calc(100vh - 32px); }
}

/* =============================================================================
   LA BOITE NE DEPASSE JAMAIS L'ECRAN (10/11/2026, releve par l'agent artisan)
   -----------------------------------------------------------------------------
   `.eqm-confirm-box` n'avait AUCUNE hauteur bornee et AUCUN defilement : seule
   la variante `--large` en avait. Un message long -- une confirmation qui
   rappelle une alerte client, par exemple -- depassait donc la fenetre en
   PAYSAGE SUR TELEPHONE (hauteur utile ~320 px), et les boutons Valider /
   Annuler devenaient litteralement inatteignables : rien ne defilait.
   C'est le critere WCAG 1.4.10 (reflow), et c'est aussi un cul-de-sac : la
   personne ne peut ni confirmer ni annuler.

   ⚠️ C'EST LE MESSAGE QUI DEFILE, PAS LA BOITE. Faire defiler la boite entiere
   emporterait l'icone, le titre ET les boutons hors de vue -- on retomberait
   sur le meme probleme, avec une barre de defilement en plus. On borne donc la
   hauteur, on empile en colonne, et seul `.eqm-confirm-desc` prend le
   defilement ; les actions restent collees en bas. C'est EXACTEMENT ce que fait
   deja la variante `--large` : on ne reinvente rien, on l'applique a la base.

   `dvh` AVANT `vh` : sur un navigateur mobile, `100vh` ignore la barre d'URL et
   vaut donc PLUS que la hauteur reellement visible -- la boite deborderait
   quand meme. La declaration `vh` reste en repli pour les navigateurs anciens,
   qui ignorent simplement la ligne suivante.
   ============================================================================= */
.eqm-confirm-box {
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
}
.eqm-confirm-box > .eqm-confirm-desc {
  overflow-y: auto;
  /* Le defilement ne doit pas rogner la derniere ligne contre les boutons. */
  padding-bottom: 2px;
}
.eqm-confirm-box > .eqm-confirm-actions {
  margin-top: auto;
  flex-shrink: 0;
}
.eqm-confirm-box > .eqm-confirm-icon,
.eqm-confirm-box > .eqm-confirm-title {
  flex-shrink: 0;
}

/* =============================================================================
   REPRISE DU 12/11/2026 (demande client, sur « Supprimer le groupe »)
   -----------------------------------------------------------------------------
   - Deux boutons de MEME largeur, 48 px de haut (cible tactile §17) : ils
     flottaient au centre en petites pastilles, le geste principal se lisait mal.
   - Icone plus grande, entouree d'un halo : c'est elle qui dit la nature de
     l'action avant meme le titre.
   - En bas d'ecran (telephone) : la poignee de la feuille, comme les modaux du
     socle, et une respiration plus large.
   Vaut pour TOUTES les confirmations : c'est le composant partage (§2).
   ============================================================================= */
.eqm-confirm-icon { width: 64px; height: 64px; font-size: 1.5rem; margin-bottom: 1.1rem; }
.eqm-confirm-icon.danger  { box-shadow: 0 0 0 8px rgba(239, 68, 68, .06); }
.eqm-confirm-icon.amber   { box-shadow: 0 0 0 8px rgba(245, 158, 11, .07); }
.eqm-confirm-icon.info    { box-shadow: 0 0 0 8px rgba(var(--primary-rgb), .06); }
.eqm-confirm-icon.primary { box-shadow: 0 0 0 8px rgba(59, 130, 246, .06); }
.eqm-confirm-title { font-size: 1.15rem; }
.eqm-confirm-desc { max-width: 340px; font-size: .9rem; }
.eqm-confirm-actions { flex-wrap: nowrap; gap: .65rem; }
.eqm-confirm-actions > .eqm-confirm-btn {
    flex: 1 1 0; min-width: 0;
    justify-content: center;
    min-height: 48px; padding: 0 1rem;
    border-radius: 14px;
    font-size: .95rem; font-weight: 600;
}
.eqm-confirm-actions > .eqm-confirm-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.eqm-confirm-btn.ok.danger { box-shadow: 0 8px 20px -6px rgba(239, 68, 68, .45); }
@media (max-width: 768px) {
    .eqm-confirm-box { padding: 2.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
    /* La poignee de la feuille (meme dessin que .eqm-modal-drag-handle). */
    .eqm-confirm-box::before {
        content: ""; position: absolute; top: 10px; left: 50%;
        width: 40px; height: 4px; margin-left: -20px;
        border-radius: 999px; background: rgba(var(--primary-rgb), .25);
    }
    .eqm-confirm-desc { margin-bottom: 1.5rem; }
}
/* Un libelle long passe a la ligne DANS son bouton plutot que d'etre coupe. */
.eqm-confirm-actions > .eqm-confirm-btn { white-space: normal; line-height: 1.2; text-align: center; }
/* Trois boutons (option `extraLabel`) : on autorise le retour a la ligne de la
   rangee, sinon trois libelles se serrent dans 340 px. */
.eqm-confirm-actions:has(#eqmConfirmExtra:not([style*="none"])) { flex-wrap: wrap; }
.eqm-confirm-actions:has(#eqmConfirmExtra:not([style*="none"])) > .eqm-confirm-btn { flex: 1 1 calc(50% - .65rem); }

/* La croix SANS pastille grise derriere (12/11/2026, demande client) : le glyphe
   seul, plus fonce au survol. La cible tactile de 44 px (::after) ne change pas. */
.eqm-confirm-close { background: transparent; color: #94a3b8; font-size: 1.05rem; }
.eqm-confirm-close:hover { background: transparent; color: #334155; }
