/* ═══════════════════════════════════════
   ANIMATIONS & MICRO-INTERACTIONS
   PiècesExpress Pro
   ═══════════════════════════════════════ */

/* ─── Keyframes ─── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.3); }
  28% { transform: scale(1); }
  42% { transform: scale(1.15); }
  56% { transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(225,29,46,0.2); }
  50% { box-shadow: 0 0 20px rgba(225,29,46,0.4), 0 0 40px rgba(225,29,46,0.15); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rotateIn {
  from { opacity: 0; transform: rotate(-10deg) scale(0.9); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}

@keyframes borderPulse {
  0%, 100% { border-color: rgba(225,29,46,0.2); }
  50% { border-color: rgba(225,29,46,0.5); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes flipIn {
  from { opacity: 0; transform: perspective(600px) rotateX(-10deg) translateY(20px); }
  to { opacity: 1; transform: perspective(600px) rotateX(0) translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes redLine {
  from { width: 0; }
  to { width: 60px; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(25px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heroGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ─── Animation Classes ─── */
.slide-up {
  animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-fu {
  animation: slideUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-sd {
  animation: slideDown 0.35s ease both;
}

.anim-fi {
  animation: fadeIn 0.4s ease both;
}

.anim-si {
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-flip {
  animation: flipIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-sl {
  animation: slideInLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-sr {
  animation: slideInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Delays */
.delay-1, .d1 { animation-delay: 0.08s; }
.delay-2, .d2 { animation-delay: 0.16s; }
.delay-3, .d3 { animation-delay: 0.24s; }
.delay-4, .d4 { animation-delay: 0.32s; }
.delay-5, .d5 { animation-delay: 0.4s; }

/* ─── Scroll Reveal (IntersectionObserver) ─── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* ─── Card Professional Hover ─── */
.card, .product-card {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.35s ease !important;
}
.product-card:hover {
  transform: translateY(-6px) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 0 1px rgba(229,62,62,0.15) !important;
}

/* ─── Hover Glow Effect ─── */
.hover-glow {
  transition: box-shadow 0.3s ease;
}
.hover-glow:hover {
  box-shadow: 0 0 25px rgba(225,29,46,0.2), 0 8px 30px rgba(0,0,0,0.3);
}

/* ─── Loading Skeleton ─── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ─── Cart Add Confirmation ─── */
@keyframes cartBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.2); }
  50% { transform: scale(0.9); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.cart-added {
  animation: cartBounce 0.5s ease;
}

/* ─── Badge Pop ─── */
@keyframes badgePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.badge-pop {
  animation: badgePop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ─── Button Ripple Effect ─── */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
}
.ripple:active::after {
  opacity: 1;
}

/* ─── Button Hover Lift ─── */
.btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease !important;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

/* ─── Toast Notification ─── */
.toast-n {
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Image Hover Zoom ─── */
.img-zoom {
  overflow: hidden;
}
.img-zoom img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.img-zoom:hover img {
  transform: scale(1.08);
}

/* ─── Product Image Hover ─── */
.product-card .pc-img img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.product-card:hover .pc-img img {
  transform: scale(1.06);
}

/* ─── Underline Reveal on Hover ─── */
.link-reveal {
  position: relative;
}
.link-reveal::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.link-reveal:hover::after {
  width: 100%;
}

/* ─── Section Title Red Bar ─── */
.section-title {
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #E53E3E, #E53E3E88);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.section-title.visible::after,
.slide-up.section-title::after {
  width: 50px;
  animation: redLine 0.8s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── Hero Gradient Shimmer ─── */
.hero-highlight {
  background: linear-gradient(90deg, #E53E3E, #FF6B6B, #E53E3E);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: heroGradient 4s ease-in-out infinite;
}

/* ─── Table Row Hover ─── */
table tbody tr {
  transition: background 0.2s ease, transform 0.15s ease;
}
table tbody tr:hover {
  background: rgba(229,62,62,0.04) !important;
}

/* ─── Category Card Image Hover ─── */
.crs-cat .crs-cat-img {
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), filter 0.5s ease !important;
}

/* ─── Carousel Card Hover ─── */
.crs-brand-logo, .crs-cat-img {
  transition: filter 0.4s ease, transform 0.5s cubic-bezier(.4,0,.2,1) !important;
}

/* ─── Flash Message ─── */
.flash {
  animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── Stagger Children ─── */
.stagger > *:nth-child(1) { animation-delay: 0s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.06s; }
.stagger > *:nth-child(4) { animation-delay: 0.09s; }
.stagger > *:nth-child(5) { animation-delay: 0.12s; }
.stagger > *:nth-child(6) { animation-delay: 0.15s; }
.stagger > *:nth-child(7) { animation-delay: 0.18s; }
.stagger > *:nth-child(8) { animation-delay: 0.21s; }
.stagger > *:nth-child(9) { animation-delay: 0.24s; }
.stagger > *:nth-child(10) { animation-delay: 0.27s; }

/* ─── Product Grid Stagger ─── */
.products-grid .product-filter-wrap,
.products-grid .product-card,
.g3 > * {
  animation: cardReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.products-grid > *:nth-child(1) { animation-delay: 0s; }
.products-grid > *:nth-child(2) { animation-delay: 0.06s; }
.products-grid > *:nth-child(3) { animation-delay: 0.12s; }
.products-grid > *:nth-child(4) { animation-delay: 0.18s; }
.products-grid > *:nth-child(5) { animation-delay: 0.24s; }
.products-grid > *:nth-child(6) { animation-delay: 0.3s; }
.products-grid > *:nth-child(7) { animation-delay: 0.36s; }
.products-grid > *:nth-child(8) { animation-delay: 0.42s; }

.g3 > *:nth-child(1) { animation-delay: 0s; }
.g3 > *:nth-child(2) { animation-delay: 0.05s; }
.g3 > *:nth-child(3) { animation-delay: 0.1s; }
.g3 > *:nth-child(4) { animation-delay: 0.15s; }
.g3 > *:nth-child(5) { animation-delay: 0.2s; }
.g3 > *:nth-child(6) { animation-delay: 0.25s; }

/* ─── Smooth Page Load ─── */
body {
  animation: fadeIn 0.3s ease both;
}

/* ─── Admin Tab Hover ─── */
.adm-tab {
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease !important;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
