/* ============================================================
   NovaCare — animations.css
   Keyframes, transitions, micro-interactions
   ============================================================ */

/* ─── Keyframes ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-4px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
@keyframes pulseShadow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13,148,136,0.4); }
  50%       { box-shadow: 0 0 0 10px rgba(13,148,136,0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes rippleAnim {
  to { transform: scale(2.5); opacity: 0; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes heartBeat {
  0%   { transform: scale(1); }
  14%  { transform: scale(1.3); }
  28%  { transform: scale(1); }
  42%  { transform: scale(1.3); }
  70%  { transform: scale(1); }
}
@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes cardFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes borderPulse {
  0%,100% { border-color: var(--color-primary); }
  50%      { border-color: var(--color-primary-lighter); }
}

/* ─── Utility Animation Classes ──────────────────────────── */
.anim-fade-up   { animation: fadeInUp  0.5s ease both; }
.anim-fade-down { animation: fadeInDown 0.5s ease both; }
.anim-fade-left { animation: fadeInLeft 0.5s ease both; }
.anim-fade-right{ animation: fadeInRight 0.5s ease both; }
.anim-scale-in  { animation: scaleIn  0.45s ease both; }
.anim-bounce-in { animation: bounceIn 0.6s ease both; }
.anim-slide-up  { animation: slideUp  0.35s ease both; }
.anim-spin      { animation: spin 1s linear infinite; }
.anim-float     { animation: float 3s ease-in-out infinite; }
.anim-pulse     { animation: pulse 1.8s ease-in-out infinite; }
.anim-heartbeat { animation: heartBeat 1.3s ease-in-out; }

/* Delay utilities */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-8 { animation-delay: 0.8s; }

/* Duration utilities */
.dur-fast   { animation-duration: 0.25s; }
.dur-slow   { animation-duration: 0.8s; }
.dur-slower { animation-duration: 1.2s; }

/* ─── Page Load Animations ───────────────────────────────── */
.hero-left h1      { animation: fadeInLeft 0.7s 0.1s ease both; }
.hero-left p       { animation: fadeInLeft 0.7s 0.25s ease both; }
.hero-eyebrow      { animation: fadeInLeft 0.6s 0.05s ease both; }
.hero-cta-row      { animation: fadeInUp  0.6s 0.35s ease both; }
.trust-badges      { animation: fadeInLeft 0.6s 0.45s ease both; }
.hero-right        { animation: fadeInRight 0.8s 0.2s ease both; }

/* ─── Scroll-triggered animations (IS-VISIBLE state set via JS) */
/* Base state defined in style.css */

/* Hover micro-interactions */
.product-card { will-change: transform, box-shadow; }
.btn { will-change: transform; }

/* ─── Loading Spinner on Buttons ─────────────────────────── */
.btn .fa-spinner { animation: spin 0.8s linear infinite; }
.btn.loading { position: relative; pointer-events: none; }

/* ─── Toast slide-in ─────────────────────────────────────── */
.toast-enter { animation: slideInRight 0.3s cubic-bezier(0.34,1.56,0.64,1) both; }
.toast-leave { animation: slideOutRight 0.3s ease both; }

/* ─── Hero floating badge ────────────────────────────────── */
.hero-deal-badge { animation: float 3s ease-in-out infinite; }

/* ─── Countdown block tick ───────────────────────────────── */
.countdown-block .val { animation: countUp 0.2s ease; }

/* ─── Wishlist heart ─────────────────────────────────────── */
.btn-wishlist.active i { animation: heartBeat 0.6s ease; }

/* ─── Image hover zoom (handled via CSS transform in main) ── */
.product-card-img-wrap { transition: none; } /* overflow handled by parent */

/* ─── Number counter ─────────────────────────────────────── */
[data-counter] { display: inline-block; }

/* ─── Skeleton shimmer ───────────────────────────────────── */
.skeleton-box {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ─── Page transition (for SPA-like feel) ────────────────── */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-content { animation: pageFadeIn 0.35s ease; }

/* ─── Marquee Brands (optional) ──────────────────────────── */
.marquee-track { display: flex; gap: 2rem; animation: marquee 20s linear infinite; width: max-content; }
.marquee-track:hover { animation-play-state: paused; }

/* ─── Dropdown open animation ────────────────────────────── */
.shopping-list-dropdown { animation: slideDown 0.2s ease both; }

/* ─── Compare bar slide up ───────────────────────────────── */
.compare-bar { will-change: bottom; }

/* ─── Filter tag appear ──────────────────────────────────── */
.filter-tag { animation: scaleIn 0.2s ease both; }

/* ─── Back-to-top button ─────────────────────────────────── */
#back-to-top { transition: opacity 0.3s, transform 0.3s, box-shadow 0.3s; }
#back-to-top:hover { box-shadow: 0 6px 20px rgba(13,148,136,0.45); transform: translateY(-2px) !important; }

/* ─── Deal progress bar animated fill ───────────────────── */
.deal-progress-bar { animation: none; }
.deal-progress-bar.animate { transition: width 1.5s cubic-bezier(0.4,0,0.2,1); }

/* ─── Mobile filter overlay ──────────────────────────────── */
.filter-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 950;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.filter-overlay.open { display: block; opacity: 1; }

/* ─── Gradient animated CTA button ──────────────────────── */
.btn-gradient-animate {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary), var(--color-primary));
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  border: none;
  color: #fff;
}

/* ─── Pulsing "In Stock" badge ───────────────────────────── */
.badge-in-stock .pulse-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulseShadow 1.5s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 3px;
}

/* ─── Category pill hover scale ─────────────────────────── */
.condition-pill { transform: translateY(0); }
.condition-pill:hover { transform: translateY(-1px); }

/* ─── Brand logo box ─────────────────────────────────────── */
.brand-logo-box { will-change: transform; }

/* ─── Step card hover ────────────────────────────────────── */
.step-card { will-change: transform; }
.step-card:hover { transform: translateY(-4px); }

/* ─── Value card icon rotate ─────────────────────────────── */
.value-card:hover .value-icon { transform: rotate(-8deg) scale(1.1); }

/* ─── Team card ──────────────────────────────────────────── */
.team-card { will-change: transform; }

/* ─── Reduce motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .anim-float, .hero-deal-badge, .marquee-track { animation: none !important; }
}
