/* ==========================================================================
   SPERO Gadgets & Electronics - Front-End Motion, Transitions & Skeletons
   Hardware-accelerated CSS3 animations & micro-interactions (effects.css)
   ========================================================================== */

:root {
  --spero-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spero-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spero-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --spero-anim-fast: 0.18s cubic-bezier(0.2, 0, 0, 1);
  --spero-anim-normal: 0.28s cubic-bezier(0.2, 0, 0, 1);
  --spero-anim-smooth: 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   1. The Shimmer Loading Skeleton System
   ========================================================================== */
.spero-skeleton {
  position: relative;
  overflow: hidden;
  background-color: #E8E5DF !important;
  color: transparent !important;
  border-color: transparent !important;
  user-select: none;
  pointer-events: none;
}

.spero-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: speroShimmer 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes speroShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Skeleton Atomic Primitives */
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.skeleton-line.sm { height: 10px; }
.skeleton-line.lg { height: 20px; }
.skeleton-line.w-25 { width: 25%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-100 { width: 100%; }

.skeleton-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-img-box {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md, 14px);
  margin-bottom: 12px;
}

.skeleton-pill {
  height: 24px;
  width: 70px;
  border-radius: 9999px;
  display: inline-block;
}

.skeleton-btn {
  height: 42px;
  border-radius: 12px;
  width: 100%;
}

/* Skeleton Composite Review Card */
.skeleton-review-card {
  background: #FFFFFF;
  border: 1px solid var(--spero-gray-200, #E5E7EB);
  border-radius: var(--radius-md, 14px);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* Skeleton Live Search Row */
.skeleton-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

/* Skeleton Quick Look Layout */
.skeleton-ql-modal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   2. Micro-Interactions & Haptic Keyframes
   ========================================================================== */

/* Cart Count Badge Bounce */
@keyframes cartBadgeBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.55); }
  65% { transform: scale(0.85); }
  85% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.cart-badge-bounce {
  animation: cartBadgeBounce 0.5s var(--spero-spring) !important;
}

/* Heart Wishlist Beat */
@keyframes heartBeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.35); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.heart-beat-active {
  animation: heartBeat 0.45s var(--spero-spring) forwards !important;
}

/* Star Rating Pick Bounce */
@keyframes starBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.4) rotate(-8deg); }
  80% { transform: scale(0.9) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.star-interactive-picker i,
.star-interactive-picker .star-btn {
  transition: transform 0.18s var(--spero-spring), color 0.15s ease !important;
  cursor: pointer;
  display: inline-block;
}

.star-interactive-picker i:hover,
.star-interactive-picker i.hovered {
  transform: scale(1.28);
}

.star-interactive-picker i.star-picked {
  animation: starBounce 0.4s var(--spero-spring) forwards;
}

/* Ambient Levitating Float */
@keyframes speroFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(0.5deg);
  }
}

.ambient-float {
  animation: speroFloat 5s ease-in-out infinite;
  will-change: transform;
}

.ambient-float-delay {
  animation: speroFloat 5.8s ease-in-out 1.2s infinite;
  will-change: transform;
}

/* Urgency Pulse for Deals & Badges */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(242, 88, 34, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(242, 88, 34, 0);
  }
}

.pulse-glow {
  animation: pulseGlow 2.2s infinite;
}

/* Modal Spring In */
@keyframes modalSheetPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content-animated {
  animation: modalSheetPop 0.32s var(--spero-spring) forwards;
}

/* Slide Down In (e.g. for prepended new reviews) */
@keyframes slideDownFade {
  0% {
    opacity: 0;
    transform: translateY(-16px);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    max-height: 600px;
    overflow: visible;
  }
}

.slide-down-in {
  animation: slideDownFade 0.45s var(--spero-ease-out) forwards;
}

/* Tactile Active Button Press Feedback */
.btn-card-add,
.product-wishlist-btn,
.action-icon-btn,
.shop-cat-pill,
.trending-chip,
.filter-tab-pill-btn,
.spero-tab-btn,
.btn-spero-primary,
.btn-spero-dark,
.quick-view-trigger-btn {
  transition: transform var(--spero-anim-fast), box-shadow var(--spero-anim-fast), background-color var(--spero-anim-fast) !important;
}

.btn-card-add:active,
.action-icon-btn:active,
.shop-cat-pill:active,
.trending-chip:active,
.btn-spero-primary:active,
.btn-spero-dark:active {
  transform: scale(0.95) !important;
}

/* ==========================================================================
   3. Product Card Hover Lift & Media Transitions
   ========================================================================== */
.featured-product-card,
.shop-product-card,
.category-card-item,
.special-offer-card {
  transition: transform var(--spero-anim-normal), box-shadow var(--spero-anim-normal) !important;
  will-change: transform, box-shadow;
}

.featured-product-card:hover,
.shop-product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08) !important;
}

.featured-product-card .product-img,
.shop-product-card .shop-product-img {
  transition: transform 0.45s var(--spero-ease-out) !important;
  will-change: transform;
}

.featured-product-card:hover .product-img,
.shop-product-card:hover .shop-product-img {
  transform: scale(1.06);
}

/* Category Cards Lift & Bounce */
.category-card-item {
  transition: transform var(--spero-anim-normal), box-shadow var(--spero-anim-normal), border-color var(--spero-anim-normal) !important;
}

.category-card-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.07);
}

.category-card-item:hover .category-icon-box {
  transform: scale(1.1) rotate(-4deg);
  transition: transform 0.3s var(--spero-spring);
}

.category-icon-box {
  transition: transform 0.3s var(--spero-ease-out);
}

/* ==========================================================================
   4. Scroll-Driven Entrance & Stagger Reveal System
   ========================================================================== */
.spero-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s var(--spero-ease-out), transform 0.55s var(--spero-ease-out);
  will-change: opacity, transform;
}

.spero-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger Container */
.spero-reveal-stagger > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.48s var(--spero-ease-out), transform 0.48s var(--spero-ease-out);
  will-change: opacity, transform;
}

.spero-reveal-stagger.is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}

.spero-reveal-stagger.is-revealed > *:nth-child(1) { transition-delay: 0.03s; }
.spero-reveal-stagger.is-revealed > *:nth-child(2) { transition-delay: 0.07s; }
.spero-reveal-stagger.is-revealed > *:nth-child(3) { transition-delay: 0.11s; }
.spero-reveal-stagger.is-revealed > *:nth-child(4) { transition-delay: 0.15s; }
.spero-reveal-stagger.is-revealed > *:nth-child(5) { transition-delay: 0.19s; }
.spero-reveal-stagger.is-revealed > *:nth-child(6) { transition-delay: 0.23s; }
.spero-reveal-stagger.is-revealed > *:nth-child(7) { transition-delay: 0.27s; }
.spero-reveal-stagger.is-revealed > *:nth-child(8) { transition-delay: 0.31s; }

/* Ensure mobile devices always render content immediately without scroll dependency */
@media (max-width: 991px) {
  .spero-reveal,
  .spero-reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   5. Catalogue Layout Morphing (Grid <-> List View)
   ========================================================================== */
#shopProductsContainer {
  transition: opacity 0.22s ease-in-out;
}

#shopProductsContainer.is-transitioning {
  opacity: 0.25;
}

.shop-product-col {
  transition: all 0.3s var(--spero-ease-out);
}

/* PDP Main Gallery Crossfade */
#mainGalleryImg {
  transition: opacity 0.2s ease-in-out, transform 0.25s var(--spero-ease-out);
}

.pdp-thumb-pill.active,
.gallery-thumb-btn.active {
  box-shadow: 0 0 0 2px var(--spero-primary, #F25822), 0 4px 12px rgba(242, 88, 34, 0.25) !important;
  transform: scale(1.05);
}

.pdp-thumb-pill,
.gallery-thumb-btn {
  transition: transform var(--spero-anim-fast), box-shadow var(--spero-anim-fast);
}

/* ==========================================================================
   6. Accessibility & 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;
  }

  .spero-skeleton::after {
    display: none !important;
  }

  .ambient-float,
  .ambient-float-delay,
  .pulse-glow {
    animation: none !important;
  }

  .spero-reveal,
  .spero-reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
