/*
 * animations.css — T019 (R10/AC10.2)
 *
 * Couche d'animations VISUELLES AUTOMATIQUES de la page live, déclenchées par
 * animations_controller.js sur les events d'enchère (nouvelle enchère, nouveau
 * leader, fin de lot). Mobile-first et performant : uniquement transform/opacity
 * (pas de reflow lourd). Charte : or #C9A961 / #E8C875 sur fond sombre.
 *
 * Les animations DÉCLENCHABLES MANUELLEMENT par l'admin (marteau, confettis,
 * welcome, congratulations) sont BRIQUE 2 — non couvertes ici.
 *
 * Linké dans app/views/layouts/live.html.erb.
 */

/* Conteneurs hôtes : permet de positionner les éléments éphémères injectés.
   (.video-wrap est déjà position:relative dans theme_live ; on garde une
   redondance défensive sans rien casser.) */
.lot-info-panel { position: relative; }
.video-wrap     { position: relative; }

/* ── new-bid : pulse subtil du panneau ───────────────────────────────────── */
@keyframes anim-pulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.012); }
  100% { transform: scale(1); }
}
.anim-pulse { animation: anim-pulse 0.45s ease-out; will-change: transform; }

/* ── new-bid : montant flottant « + €X » qui monte et s'efface ───────────── */
@keyframes anim-float-up {
  0%   { transform: translate(-50%, 0) scale(0.9); opacity: 0; }
  15%  { transform: translate(-50%, -6px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -42px) scale(1); opacity: 0; }
}
.anim-float-amount {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translate(-50%, 0);
  pointer-events: none;
  z-index: 30;
  font-family: var(--sans, sans-serif);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #E8C875;
  text-shadow: 0 0 18px rgba(232, 200, 117, 0.55);
  animation: anim-float-up 1.25s ease-out forwards;
  will-change: transform, opacity;
}

/* ── new-bid : highlight bref de la dernière ligne du flux d'enchères ─────── */
@keyframes anim-row-flash {
  0%   { background: rgba(232, 200, 117, 0.28); }
  100% { background: rgba(201, 169, 97, 0.06); }
}
.anim-row-flash { animation: anim-row-flash 0.85s ease-out; }

/* ── new-leader : flash doré / glow marqué sur le panneau ────────────────── */
@keyframes anim-gold-flash {
  0%   { box-shadow: 0 0 0 0 rgba(232, 200, 117, 0); }
  20%  { box-shadow: 0 0 0 2px rgba(232, 200, 117, 0.85), 0 0 32px 4px rgba(201, 169, 97, 0.55); }
  100% { box-shadow: 0 0 0 0 rgba(232, 200, 117, 0); }
}
.anim-gold-flash { animation: anim-gold-flash 1.1s ease-out; will-change: box-shadow; }

/* ── new-leader : badge éphémère « NEW LEADER » ──────────────────────────── */
@keyframes anim-leader-badge {
  0%   { transform: translate(-50%, 8px) scale(0.85); opacity: 0; }
  12%  { transform: translate(-50%, 0) scale(1);      opacity: 1; }
  80%  { transform: translate(-50%, 0) scale(1);      opacity: 1; }
  100% { transform: translate(-50%, -8px) scale(0.95); opacity: 0; }
}
.anim-leader-badge {
  position: absolute;
  top: -0.65rem;
  left: 50%;
  transform: translate(-50%, 0);
  pointer-events: none;
  z-index: 40;
  background: linear-gradient(100deg, #C9A961, #E8C875);
  color: #0E0B08;
  font-family: var(--sans, sans-serif);
  font-weight: 800;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(201, 169, 97, 0.5);
  animation: anim-leader-badge 2.2s ease-out forwards;
  will-change: transform, opacity;
}

/* ── lot-sold : overlay « SOLD » sur le stage vidéo ──────────────────────── */
@keyframes anim-sold-in {
  0%   { transform: scale(1.18); opacity: 0; }
  18%  { transform: scale(1);    opacity: 1; }
  82%  { transform: scale(1);    opacity: 1; }
  100% { transform: scale(0.98); opacity: 0; }
}
.anim-sold-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: radial-gradient(ellipse at center, rgba(14, 11, 8, 0.78), rgba(14, 11, 8, 0.94));
  pointer-events: none;
  animation: anim-sold-in 4.5s ease-in-out forwards;
  will-change: transform, opacity;
}
.anim-sold-overlay__title {
  font-family: var(--serif, var(--sans, serif));
  font-weight: 600;
  font-size: clamp(2.6rem, 12vw, 5rem);
  letter-spacing: 0.18em;
  color: #E8C875;
  text-shadow: 0 0 40px rgba(232, 200, 117, 0.6);
}
.anim-sold-overlay__price {
  font-family: var(--sans, sans-serif);
  font-weight: 800;
  font-size: clamp(1.1rem, 5vw, 1.8rem);
  color: #FAF8F4;
  letter-spacing: 0.02em;
}
.anim-sold-overlay__winner {
  font-family: var(--sans, sans-serif);
  font-weight: 500;
  font-size: 0.95rem;
  color: rgba(250, 248, 244, 0.75);
}

/* ── Accessibilité : prefers-reduced-motion ──────────────────────────────── */
/* On neutralise le mouvement (transform/box-shadow animés) tout en gardant une
   apparition/disparition discrète pour les overlays informatifs (SOLD/badge). */
@media (prefers-reduced-motion: reduce) {
  .anim-pulse,
  .anim-gold-flash,
  .anim-row-flash {
    animation: none !important;
  }
  .anim-float-amount {
    /* Non injecté par le JS en reduced-motion ; neutralisé par sécurité. */
    display: none !important;
  }
  .anim-leader-badge {
    animation: none !important;
    opacity: 1;
    transform: translate(-50%, 0);
  }
  .anim-sold-overlay {
    animation: none !important;
    opacity: 1;
  }
  .anim-sold-overlay__title {
    text-shadow: none;
  }
}
