/* AEC — Alertes personnalisées (toasts + modale de confirmation) */

/* ====================== TOASTS ====================== */
.aec-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.aec-toast {
    position: relative;
    pointer-events: auto;
    min-width: 300px;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .15), 0 2px 6px rgba(0, 0, 0, .08);
    background: #fff;
    border-left: 4px solid #6b7280;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transform: translateX(120%) scale(.92);
    opacity: 0;
    font-size: 13.5px;
    line-height: 1.45;
    color: #1f2937;
    overflow: hidden;
    will-change: transform, opacity;
}

/* Animation d'entrée : slide + scale + rebond visible (cubic-bezier "back") */
@keyframes aecToastIn {
    0%   { transform: translateX(130%) scale(.85); opacity: 0; }
    55%  { transform: translateX(-14px) scale(1.04); opacity: 1; }
    75%  { transform: translateX(6px)   scale(.99); }
    90%  { transform: translateX(-2px)  scale(1.01); }
    100% { transform: translateX(0)     scale(1);   opacity: 1; }
}
@keyframes aecToastOut {
    0%   { transform: translateX(0)     scale(1);   opacity: 1; }
    25%  { transform: translateX(-10px) scale(1.02); }
    100% { transform: translateX(130%)  scale(.9);  opacity: 0; }
}
@keyframes aecIconPop {
    0%   { transform: scale(0)    rotate(-220deg); opacity: 0; }
    55%  { transform: scale(1.25) rotate(15deg);   opacity: 1; }
    80%  { transform: scale(.92)  rotate(-4deg); }
    100% { transform: scale(1)    rotate(0);       opacity: 1; }
}
@keyframes aecIconBreathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.1); }
}
@keyframes aecBodyFadeUp {
    0%   { transform: translateY(10px); opacity: 0; filter: blur(2px); }
    100% { transform: translateY(0);    opacity: 1; filter: blur(0); }
}
@keyframes aecProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
@keyframes aecBorderShimmer {
    0%, 100% { box-shadow: 0 10px 30px rgba(0,0,0,.15), 0 2px 6px rgba(0,0,0,.08); }
    50%      { box-shadow: 0 14px 38px rgba(201,160,56,.3), 0 4px 12px rgba(11,26,51,.1); }
}

.aec-toast.show {
    animation: aecToastIn .9s cubic-bezier(.34, 1.56, .64, 1) forwards;
}
.aec-toast.hiding {
    animation: aecToastOut .5s cubic-bezier(.55, .06, .68, .19) forwards;
}
/* Étape 2 : l'icône explose 250 ms après le début de l'entrée */
.aec-toast.show .toast-icon {
    animation: aecIconPop .75s .25s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
/* Étape 3 : le texte arrive 450 ms après le début (fade + monte + de-blur) */
.aec-toast.show .toast-body {
    animation: aecBodyFadeUp .6s .45s cubic-bezier(.16, 1, .3, 1) backwards;
}
/* Étape 4 : le bouton fermer apparaît à la toute fin */
@keyframes aecCloseFadeIn {
    0%   { opacity: 0; transform: scale(.5) rotate(-90deg); }
    100% { opacity: 1; transform: scale(1)  rotate(0); }
}
.aec-toast.show .toast-close {
    animation: aecCloseFadeIn .4s .7s ease-out backwards;
}

/* Barre de progression auto-dismiss */
.aec-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: .35;
    transform-origin: left center;
    transform: scaleX(1);
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}
.aec-toast.show .aec-toast-progress {
    animation: aecProgress var(--toast-duration, 4500ms) linear forwards;
}
.aec-toast:hover .aec-toast-progress { animation-play-state: paused; }
.aec-toast:hover { animation-play-state: paused; }

.aec-toast.success { border-left-color: #10b981; }
.aec-toast.error   { border-left-color: #ef4444; }
.aec-toast.info    { border-left-color: #3b82f6; }
.aec-toast.warning { border-left-color: #f59e0b; }

.aec-toast .toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}
.aec-toast.success .toast-icon { color: #10b981; }
.aec-toast.error   .toast-icon { color: #ef4444; }
.aec-toast.info    .toast-icon { color: #3b82f6; }
.aec-toast.warning .toast-icon { color: #f59e0b; }

/* Couleur de la barre de progression alignée sur la variante */
.aec-toast.success .aec-toast-progress { background: #10b981; }
.aec-toast.error   .aec-toast-progress { background: #ef4444; }
.aec-toast.info    .aec-toast-progress { background: #3b82f6; }
.aec-toast.warning .aec-toast-progress { background: #f59e0b; }

/* =========================================================
   Variante AEC — carte de notification « marque »
   Refonte vers un registre sobre. La version précédente empilait un fond
   dégradé doré, un halo doré de 38px, un filet dégradé sur trois couleurs,
   une icône qui « respirait » en boucle et une ombre qui pulsait : cinq
   effets simultanés sur une notification que le visiteur lit une fois.
   Ne restent que les moyens utiles à la lecture — un fond blanc franc,
   un filet vert d'identification, une pastille d'icône discrète et une
   ombre portée nette.
   ========================================================= */
.aec-toast.aec {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e8eaed;
    /* Le filet est posé par ::before ; la bordure gauche du toast générique
       est neutralisée pour ne pas doubler l'épaisseur. */
    border-left: none;
    box-shadow:
        0 18px 40px -12px rgba(11, 26, 51, .22),
        0 4px 12px -4px rgba(11, 26, 51, .10);
    padding: 16px 18px 16px 20px;
    min-width: 340px;
    max-width: 440px;
    gap: 14px;
}
/* Filet d'identification : vert AEC uni, sans dégradé. */
.aec-toast.aec::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 3px;
    background: #0a9642;
}
.aec-toast.aec .toast-icon {
    color: #0a9642;
    background: rgba(10, 150, 66, .09);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;   /* carré adouci plutôt que rond : moins « alerte » */
    margin-top: 1px;
    box-shadow: none;
}
.aec-toast.aec .toast-icon svg { display: block; }
/* Une seule animation, celle de l'entrée. Rien ne bouge ensuite : une
   notification qui pulse en continu attire l'œil aux dépens du texte. */
.aec-toast.aec.show .toast-icon {
    animation: aecIconPop .6s .2s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
.aec-toast.aec .toast-body {
    font-size: 13.5px;
    line-height: 1.55;
    color: #0b1a33;
    padding: 4px 0;
}
.aec-toast.aec .toast-body strong { color: #0a9642; }
.aec-toast.aec .toast-close {
    align-self: flex-start;
    margin-top: 4px;
}
.aec-toast.aec .aec-toast-progress {
    background: #0a9642;
    opacity: .28;
    height: 2px;
}
/* L'ombre pulsante (aecBorderShimmer) a été retirée : elle faisait
   respirer toute la carte pendant ses neuf secondes d'affichage. Reste
   l'animation d'entrée, commune aux autres variantes. */

.aec-toast .toast-body { flex: 1; }
.aec-toast .toast-close {
    background: none;
    border: 0;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.aec-toast .toast-close:hover {
    color: #1f2937;
    background: rgba(0, 0, 0, .05);
}

@media (max-width: 600px) {
    .aec-toast-container { top: 10px; right: 10px; left: 10px; }
    .aec-toast { min-width: 0; max-width: 100%; }
}

/* ====================== MODALE DE CONFIRMATION ====================== */
.aec-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 26, 51, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}
.aec-modal-backdrop.show { opacity: 1; visibility: visible; }

.aec-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, .35);
    transform: scale(.92) translateY(8px);
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
}
.aec-modal-backdrop.show .aec-modal { transform: scale(1) translateY(0); }

.aec-modal-icon {
    padding: 24px 20px 4px;
    text-align: center;
    font-size: 38px;
}
.aec-modal-danger  .aec-modal-icon { color: #ef4444; }
.aec-modal-warning .aec-modal-icon { color: #f59e0b; }
.aec-modal-info    .aec-modal-icon { color: #3b82f6; }

.aec-modal-body {
    padding: 14px 26px 22px;
    text-align: center;
}
.aec-modal-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #0b1a33;
}
.aec-modal-message {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.55;
}

.aec-modal-actions {
    padding: 14px 20px;
    background: #f9fafb;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e5e7eb;
}
.aec-modal-actions .btn { min-width: 100px; justify-content: center; }

@media (max-width: 480px) {
    .aec-modal-actions { flex-direction: column-reverse; }
    .aec-modal-actions .btn { width: 100%; }
}
