/* =============================================================================
   EQM NOTIFICATION — rendu UNIQUE des toasts du monorepo (cf. CLAUDE.md §4, §17)
   Usage : eqmToast(type, titre, message, duree)  —  cf. js/script-toast.js

   QUATRE COPIES, à garder RIGOUREUSEMENT IDENTIQUES :
     apps/equimondo/css/eqm-notify.css
     apps/gestion/css/eqm-notify.css
     apps/opaddock/assets/css/eqm-notify.css
     shared/assets/css/eqm-notify.css

   La duplication est STRUCTURELLE, pas un oubli : shared/ n'est jamais exposé
   par Apache (CLAUDE.md §0), donc equimondo et gestion ne peuvent pas charger
   depuis shared/ — chaque DocumentRoot doit servir la sienne. Ne modifiez
   JAMAIS une seule copie : c'est ainsi que le back-office s'est retrouvé, des
   mois durant, à afficher « Titre — message » sur une ligne pendant que les
   deux autres applications affichaient la structure à deux lignes du design
   system. Toute évolution se reporte sur les quatre.
   ============================================================================= */

#eqmNotifyContainer {
   position: fixed;
   top: 1.5rem;
   right: 1.5rem;
   z-index: 10003;
   display: flex;
   flex-direction: column;
   gap: .75rem;
   max-width: 400px;
   width: calc(100vw - 2rem);
   pointer-events: none
}

.eqm-notify {
   display: flex;
   align-items: center;
   gap: 1rem;
   padding: 1rem 1.25rem;
   border-radius: 1rem;
   box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .18), 0 0 0 1px rgba(255, 255, 255, .5);
   pointer-events: auto;
   animation: eqmNotifyIn .35s cubic-bezier(.4, 0, .2, 1) forwards;
   transform-origin: top right;
   position: relative;
   overflow: hidden
}

.eqm-notify::before {
   content: '';
   position: absolute;
   bottom: 0;
   left: 0;
   right: 0;
   height: 3px;
   /* La barre se VIDE DE GAUCHE A DROITE. `transform-origin` ne s'herite PAS : sans
      cette ligne le pseudo-element retombe sur la valeur par defaut (50% 50%) et le
      scaleX() le retrecit par les DEUX bouts vers le centre -- la barre paraissait
      decalee, et finissait en point au milieu du toast. Le `top right` porte par
      .eqm-notify sert a son animation d'ENTREE, il ne descend pas jusqu'ici. */
   transform-origin: left center;
   background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .06));
   animation: eqmNotifyProgress var(--eqm-notify-dur, 4000ms) linear forwards
}

.eqm-notify.success::before {
   background: linear-gradient(90deg, var(--primary), var(--primary-light));
   animation: eqmNotifyProgress var(--eqm-notify-dur, 4000ms) linear forwards
}

.eqm-notify.error::before {
   background: linear-gradient(90deg, #ef4444, #f87171);
   animation: eqmNotifyProgress var(--eqm-notify-dur, 4000ms) linear forwards
}

.eqm-notify.info::before {
   background: linear-gradient(90deg, #3b82f6, #60a5fa);
   animation: eqmNotifyProgress var(--eqm-notify-dur, 4000ms) linear forwards
}

.eqm-notify.warning::before {
   background: linear-gradient(90deg, #f59e0b, #fbbf24);
   animation: eqmNotifyProgress var(--eqm-notify-dur, 4000ms) linear forwards
}

@keyframes eqmNotifyProgress {
   from {
      transform: scaleX(1)
   }

   to {
      transform: scaleX(0)
   }
}

.eqm-notify.hide {
   animation: eqmNotifyOut .25s ease forwards
}

@keyframes eqmNotifyIn {
   from {
      opacity: 0;
      transform: translateX(120%) scale(.9)
   }

   to {
      opacity: 1;
      transform: translateX(0) scale(1)
   }
}

@keyframes eqmNotifyOut {
   from {
      opacity: 1;
      transform: translateX(0) scale(1)
   }

   to {
      opacity: 0;
      transform: translateX(120%) scale(.95)
   }
}

.eqm-notify-icon {
   width: 44px;
   height: 44px;
   border-radius: 50%;
   flex-shrink: 0;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1.25rem;
   transition: transform .3s
}

.eqm-notify:hover .eqm-notify-icon {
   transform: scale(1.05)
}

.eqm-notify.success {
   background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
   border: 1px solid rgba(var(--primary-rgb), .2)
}

.eqm-notify.success .eqm-notify-icon {
   background: linear-gradient(135deg, var(--primary), var(--primary-dark));
   color: #fff;
   box-shadow: 0 4px 14px -2px rgba(var(--primary-rgb), .5)
}

.eqm-notify.error {
   background: linear-gradient(135deg, #fef2f2, #fee2e2);
   border: 1px solid rgba(239, 68, 68, .2)
}

.eqm-notify.error .eqm-notify-icon {
   background: linear-gradient(135deg, #ef4444, #dc2626);
   color: #fff;
   box-shadow: 0 4px 14px -2px rgba(239, 68, 68, .5)
}

.eqm-notify.info {
   background: linear-gradient(135deg, #eff6ff, #dbeafe);
   border: 1px solid rgba(59, 130, 246, .2)
}

.eqm-notify.info .eqm-notify-icon {
   background: linear-gradient(135deg, #3b82f6, #2563eb);
   color: #fff;
   box-shadow: 0 4px 14px -2px rgba(59, 130, 246, .5)
}

.eqm-notify.warning {
   background: linear-gradient(135deg, #fffbeb, #fef3c7);
   border: 1px solid rgba(245, 158, 11, .2)
}

.eqm-notify.warning .eqm-notify-icon {
   background: linear-gradient(135deg, #f59e0b, #d97706);
   color: #fff;
   box-shadow: 0 4px 14px -2px rgba(245, 158, 11, .5)
}

.eqm-notify-body {
   flex: 1;
   min-width: 0;
   padding-top: 1px;
}

/* Titre en gras sur la première ligne (structure deux lignes du design system :
   titre + message), pour ne plus concaténer avec un tiret cadratin. */
.eqm-notify-title {
   display: block;
   font-size: .94rem;
   font-weight: 700;
   color: var(--slate-800, #1e293b);
   line-height: 1.35;
}
.eqm-notify-title + .eqm-notify-message {
   margin-top: 2px;
   font-weight: 500;
   color: var(--slate-500, #64748b);
}

.eqm-notify-close {
   width: 32px;
   height: 32px;
   border-radius: 50%;
   border: none;
   background: rgba(0, 0, 0, .06);
   color: #64748b;
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: .75rem;
   flex-shrink: 0;
   transition: all .2s
}

.eqm-notify-close:hover {
   background: rgba(0, 0, 0, .1);
   color: #1e293b
}

.eqm-notify-message {
   font-size: .9375rem;
   font-weight: 500;
   color: #1e293b;
   line-height: 1.4
}

/* =============================================================================
   TABLETTE ET TELEPHONE (15/11/2026)
   -----------------------------------------------------------------------------
   - La croix etait un ovale : style.css impose `min-height: 44px !important` a
     tout bouton sous 1024 px, et elle n'en fait que 32 de large. Elle garde un
     rond de 36 px a l'oeil ; sa zone de toucher atteint 44 px par un ::after.
   - Sur telephone, le toast arrivait de la DROITE (translateX), comme sur PC :
     il traversait l'ecran en biais. Il descend desormais du haut et remonte en
     partant, sous l'encoche (safe-area), pleine largeur avec la marge de page.
   - Un peu plus compact : sur 360 px, l'icone de 44 px et 1.25rem de padding
     laissaient deux mots par ligne au message.
   ============================================================================= */
@media (max-width: 1024px) {
   /* Pas de barre de temps restant en bas du toast sur tablette et telephone
      (demande client, 15/11/2026) : sur un petit ecran elle se lisait comme un
      chargement en cours. Le toast se ferme toujours seul, au meme delai. */
   .eqm-notify::before,
   .eqm-notify.success::before,
   .eqm-notify.error::before,
   .eqm-notify.info::before,
   .eqm-notify.warning::before {
      display: none
   }
   .eqm-notify-close {
      position: relative;
      width: 36px;
      height: 36px;
      min-height: 36px !important;
      padding: 0;
      background: rgba(255, 255, 255, .75);
      box-shadow: 0 1px 3px rgba(15, 23, 42, .08)
   }
   .eqm-notify-close::after {
      content: "";
      position: absolute;
      inset: -4px;
      border-radius: 50%
   }
}

@media(max-width:640px) {
   #eqmNotifyContainer {
      top: calc(.75rem + env(safe-area-inset-top, 0px));
      right: 1rem;
      left: 1rem;
      width: auto;
      max-width: none;
      gap: .5rem
   }
   .eqm-notify {
      gap: .85rem;
      padding: .85rem .85rem .95rem 1rem;
      border-radius: 20px;
      transform-origin: top center;
      animation-name: eqmNotifyInMob
   }
   .eqm-notify.hide {
      animation-name: eqmNotifyOutMob
   }
   .eqm-notify-icon {
      width: 40px;
      height: 40px;
      font-size: 1.05rem
   }
   .eqm-notify-title {
      font-size: .95rem
   }
   .eqm-notify-message,
   .eqm-notify-title + .eqm-notify-message {
      font-size: .9rem;
      line-height: 1.4
   }
}

@keyframes eqmNotifyInMob {
   from {
      opacity: 0;
      transform: translateY(-120%) scale(.96)
   }

   to {
      opacity: 1;
      transform: translateY(0) scale(1)
   }
}

@keyframes eqmNotifyOutMob {
   from {
      opacity: 1;
      transform: translateY(0) scale(1)
   }

   to {
      opacity: 0;
      transform: translateY(-110%) scale(.96)
   }
}

/* Respect de prefers-reduced-motion : pas de glissement ni de barre animée. */
@media (prefers-reduced-motion: reduce) {
   .eqm-notify {
      animation: none;
      opacity: 1;
      transform: none;
   }
   .eqm-notify.hide {
      animation: none;
      opacity: 0;
   }
   .eqm-notify::before,
   .eqm-notify.success::before,
   .eqm-notify.error::before,
   .eqm-notify.info::before,
   .eqm-notify.warning::before {
      animation: none;
   }
   .eqm-notify:hover .eqm-notify-icon {
      transform: none;
   }
}
