/* ==========================================================
   animations.css — Micro-interactions & polish UX global
   boutique.morgannriu.fr — v2026042219
   Additif pur : greffe via selectors, non-invasif
   ========================================================== */

/* ── 1. Smooth scroll global ─────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── 1b. Reveal on scroll ────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* ── 4. Scroll-to-top button ─────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  bottom: 90px; /* above mobile cart bar */
  right: 20px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: none;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover, #6b4de8));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  will-change: opacity, transform;
}
.scroll-top-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.scroll-top-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.scroll-top-btn svg {
  width: 20px;
  height: 20px;
}

/* ── 5. Loading states ───────────────────────────────────── */
.btn--loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}
.btn--loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ── 6. Toast stack amélioré ─────────────────────────────── */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}
.toast {
  position: relative;
  min-width: 240px;
  max-width: 340px;
  padding: 12px 36px 16px 16px;
  border-radius: var(--radius-sm, 8px);
  font-size: 14px;
  line-height: 1.4;
  color: #fff;
  background: #1e2530;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  overflow: hidden;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast--show {
  opacity: 1;
  transform: none;
}
.toast--info  { background: #1e2530; border-left: 3px solid var(--color-accent); }
.toast--success { background: #0f2318; border-left: 3px solid var(--color-success, #4ade80); }
.toast--error { background: #2b1010; border-left: 3px solid #f97171; }
.toast__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: auto;
}
.toast__close:hover { color: #fff; }
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: rgba(255,255,255,0.2);
  transform-origin: left;
  animation: toast-progress 3.2s linear forwards;
}
@keyframes toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── 7. Wishlist heart animation ─────────────────────────── */
@keyframes heart-beat {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
@keyframes heart-break {
  0%   { transform: scale(1) rotate(0deg); }
  30%  { transform: scale(1.2) rotate(-8deg); }
  60%  { transform: scale(0.8) rotate(8deg); }
  100% { transform: scale(1) rotate(0deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .wishlist-btn.heart--beat { animation: heart-beat 0.3s ease-out; }
  .wishlist-btn.heart--break { animation: heart-break 0.35s ease-out; }
}
.wishlist-btn.heart--active svg,
.wishlist-btn.heart--active i { color: #e05252 !important; fill: #e05252 !important; }

/* ── 8. Product card hover premium ──────────────────────── */
.product-card {
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
  position: relative;
  overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .product-card:hover {
    transform: translateY(-4px) scale(1.005);
    box-shadow: var(--shadow-lg);
  }
}
.product-card__img-wrap {
  position: relative;
  overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .product-card:hover .product-card__img-wrap img,
  .product-card:hover > a img,
  .product-card:hover .card-img img {
    transform: scale(1.04);
    transition: transform 0.35s ease-out;
  }
}
/* Overlay « Voir le produit » RETIRÉ.
   `.product-card::after` était déjà défini dans style.css (`content:''; inset:0`) pour
   étendre la zone cliquable à toute la carte. Un pseudo-élément ne peut pas servir aux
   deux : animations.css étant chargé en dernier, il écrasait `inset:0` par bottom/left/
   right et faisait perdre la zone cliquable. Son libellé était en outre codé en dur en
   français, donc affiché tel quel sur la version anglaise. Depuis le 07/08 chaque carte
   porte un bouton « Voir le produit » visible : l'overlay faisait doublon. */


/* ── 9. Lazy image fade-in ───────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  img.lazy-pending {
    opacity: 0;
    transition: opacity 0.4s ease;
  }
  img.lazy-loaded { opacity: 1; }
}

/* ── 10. Ripple effect ───────────────────────────────────── */
.btn-ripple-host {
  position: relative;
  overflow: hidden;
}
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  pointer-events: none;
  transform: scale(0);
  animation: ripple-expand 0.6s ease-out forwards;
}
@keyframes ripple-expand {
  to { transform: scale(4); opacity: 0; }
}

/* ── 11. Animations d'ambiance ───────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .nav-brand {
    animation: nav-float 4s ease-in-out infinite;
  }
  @keyframes nav-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-2px); }
  }

  .badge-new, [class*="badge-new"], .tag-new {
    animation: badge-glow 2s ease-in-out infinite;
  }
  @keyframes badge-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124,92,255,0.4); }
    50%       { box-shadow: 0 0 0 6px rgba(124,92,255,0); }
  }
}

/* Focus states premium */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Exit-intent popup ───────────────────────────────────── */
.exit-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.exit-popup-overlay.is-open { opacity: 1; }
.exit-popup {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 36px 32px 28px;
  max-width: 440px;
  width: 90%;
  position: relative;
  transform: scale(0.92) translateY(16px);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.exit-popup-overlay.is-open .exit-popup { transform: none; }
.exit-popup__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.exit-popup__close:hover { color: var(--color-text); }
.exit-popup h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}
.exit-popup p {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}
.exit-popup form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.exit-popup input[type="email"] {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
}
.exit-popup button[type="submit"] {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.exit-popup button[type="submit"]:hover { opacity: 0.88; }
.exit-popup__msg {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
}
.exit-popup__msg.ok { color: var(--color-success, #4ade80); }
.exit-popup__msg.err { color: #f97171; }
