/* Store — Enhancements */

/* ============================================
   SKELETON LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(90deg,
      var(--background-color) 0%,
      var(--border-color) 50%,
      var(--background-color) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}


.product-card-skeleton {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.product-card-skeleton .skeleton-image {
  height: 260px;
  background: var(--background-color);
}

.product-card-skeleton .skeleton-content {
  padding: var(--space-6);
}

.product-card-skeleton .skeleton-title {
  height: 24px;
  width: 70%;
  margin-bottom: var(--space-3);
}

.product-card-skeleton .skeleton-category {
  height: 14px;
  width: 40%;
  margin-bottom: var(--space-4);
}

.product-card-skeleton .skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: var(--space-2);
}

.product-card-skeleton .skeleton-text:last-of-type {
  width: 60%;
  margin-bottom: var(--space-5);
}

.product-card-skeleton .skeleton-price {
  height: 32px;
  width: 35%;
  margin-bottom: var(--space-5);
}

.product-card-skeleton .skeleton-button {
  height: 48px;
  width: 100%;
  margin-bottom: 10px;
}


/* ============================================
   ENHANCED MICRO-ANIMATIONS
   ============================================ */

/* Product Card Entrance */
.product-card {
  animation: cardSlideUp 0.5s ease-out;
  animation-fill-mode: both;
}

@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Add to Cart Success Animation */
.add-success-ripple {
  position: fixed;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  width: 200px;
  height: 200px;
  opacity: 0.6;
  animation: rippleExpand 0.6s ease-out forwards;
  pointer-events: none;
  z-index: var(--z-toast);
  will-change: transform, opacity;
}

@keyframes rippleExpand {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Cart Icon Bounce */
.cart-icon.bounce {
  animation: cartBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cartBounce {

  0%,
  100% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.3) rotate(-10deg);
  }

  50% {
    transform: scale(0.9) rotate(5deg);
  }

  75% {
    transform: scale(1.1) rotate(-3deg);
  }
}

/* Floating Animation for Elements */
.float-animation {
  animation: gentleFloat 3s ease-in-out infinite;
}

@keyframes gentleFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Pulse Glow Effect */
.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
  will-change: box-shadow;
  contain: layout style paint;
}


/* Smooth Count Update */
.count-update {
  animation: countPop 0.3s ease-out;
}

@keyframes countPop {
  0% {
    transform: scale(1.5);
  }

  50% {
    transform: scale(0.8);
  }

  100% {
    transform: scale(1);
  }
}


/* ============================================
   SMOOTH PAGE TRANSITIONS
   ============================================ */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.page-transition-exit {
  opacity: 1;
}

.page-transition-exit-active {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}


/* 4. Product Detail Bottom Sheet */
.product-detail-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-toast);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.product-detail-sheet.active {
  opacity: 1;
  pointer-events: auto;
}

.product-detail-sheet .sheet-content {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  max-height: 90dvh;
  background: var(--bg-surface);
  border-radius: 24px 24px 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-overflow-scrolling: touch;
}

.product-detail-sheet.active .sheet-content {
  transform: translateY(0);
}

.sheet-drag-handle {
  display: flex;
  justify-content: center;
  padding: var(--space-3) 0 var(--space-1);
  cursor: grab;
}

.sheet-drag-handle span {
  width: 40px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
}

.sheet-image {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.sheet-image-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--border-light) 0%, var(--border-color) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-5xl);
  color: var(--text-muted);
}

.sheet-body {
  padding: var(--space-5) var(--space-6) var(--space-8);
}

.sheet-body .sheet-category {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.sheet-body .sheet-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 var(--space-2);
  line-height: var(--leading-snug);
}

.sheet-body .sheet-description {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-light);
  margin: 0 0 var(--space-5);
}

.sheet-body .sheet-price {
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-color);
  margin-bottom: var(--space-5);
}

.sheet-body .sheet-price .original-price {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: line-through;
  font-weight: 500;
  margin-left: var(--space-2);
}

.sheet-quantity {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.sheet-quantity button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  background: var(--bg-surface);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

@media (hover: hover) {
  .sheet-quantity button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
  }
}

.sheet-quantity .qty-value {
  font-size: var(--text-lg);
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.sheet-add-btn {
  width: 100%;
  padding: var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  color: white;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  transition: var(--transition);
  box-shadow: var(--shadow-primary);
}

@media (hover: hover) {
  .sheet-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
}

.sheet-add-btn:active {
  transform: scale(0.98);
}

.sheet-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: var(--text-color);
  font-size: var(--text-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-sidebar);
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

@media (hover: hover) {
  .sheet-close-btn:hover {
    background: var(--bg-surface);
    box-shadow: var(--shadow);
  }
}


/* ============================================
   WOW IMPROVEMENTS — CSS
   ============================================ */

/* #3 — Product Card Hover Micro-Animations */
.product-card {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

@media (hover: hover) {
  .product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
  }
}

.product-card .product-image {
  overflow: hidden;
  position: relative;
}

.product-card .product-image img {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) {
  .product-card:hover .product-image img {
    transform: scale(1.03);
  }
}

/* Overlay gradient on hover */
.product-card .product-image::after {
  content: 'Ver detalles \2192';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-8) var(--space-4) var(--space-4);
  background: linear-gradient(transparent, color-mix(in oklch, black 55%, transparent));
  color: white;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  text-align: center;
}

@media (hover: hover) {
  .product-card:hover .product-image::after {
    opacity: 1;
    transform: translateY(0);
  }
}

/* #6 — Skeleton Loading Cards */
.skeleton-card {
  background: var(--bg-surface);
  border-radius: var(--radius, 12px);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
}

.skeleton-shimmer {
  background: linear-gradient(90deg,
      var(--bg-muted) 25%,
      var(--border-color) 37%,
      var(--bg-muted) 63%);
  background-size: 400% 100%;
  animation: skeletonShimmer 1.8s ease infinite;
}

.skeleton-card .skeleton-image {
  width: 100%;
  height: 200px;
}

.skeleton-card .skeleton-line {
  height: 14px;
  margin: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
}

.skeleton-card .skeleton-line.short {
  width: 40%;
}

.skeleton-card .skeleton-line.medium {
  width: 70%;
}

.skeleton-card .skeleton-line.price {
  height: 20px;
  width: 30%;
  margin-top: var(--space-4);
}


/* #4 — Cart Bar Add Pop Animation */
.sticky-cart-bar .cart-bar-count.pop {
  animation: cartCountPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cartCountPop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.5);
  }

  100% {
    transform: scale(1);
  }
}

.sticky-cart-bar.pulse {
  animation: cartBarPulse 0.6s ease;
}

@keyframes cartBarPulse {

  0%,
  100% {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  }

  50% {
    box-shadow: 0 -4px 40px rgba(255, 255, 255, 0.3), 0 -4px 20px rgba(0, 0, 0, 0.15);
  }
}

/* +1 Fly Animation */
.cart-fly-plus {
  position: fixed;
  pointer-events: none;
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--primary-color, var(--primary-color));
  z-index: var(--z-toast);
  animation: flyToCart 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes flyToCart {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }

  60% {
    opacity: 0.8;
    transform: translate(0, -40px) scale(1.3);
  }

  100% {
    opacity: 0;
    transform: translate(0, -80px) scale(0.5);
  }
}

/* #8 — Store Header Parallax */
.store-header {
  position: relative;
  overflow: hidden;
}

.store-header::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: inherit;
  z-index: -1;
  will-change: transform;
}

.store-header .header-overlay {
  backdrop-filter: blur(8px) saturate(150%);
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  background: rgba(255, 255, 255, 0.1);
}

/* #9 — Confetti on Store Save */
.confetti-container {
  position: fixed;
  inset: 0;
  z-index: var(--z-toast);
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  opacity: 0;
  animation: confettiFall 2.5s ease-out forwards;
}

.confetti-piece:nth-child(odd) {
  border-radius: var(--radius-full);
}


/* Success checkmark animation */
.save-success-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.save-success-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.save-success-check {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--success-color), var(--success-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  color: white;
  animation: checkPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  margin-bottom: var(--space-4);
}

.save-success-text {
  font-size: var(--text-lg);
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}


/* #1 — Animated Generation Progress */
.ai-generating-animation {
  position: relative;
}

.ai-generating-animation::before {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  animation: generatingPulse 2s ease-in-out infinite;
}

@keyframes generatingPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.4);
    opacity: 1;
  }
}

.ai-step {
  transition: color 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
}

.ai-step.active {
  color: var(--primary-color, var(--secondary-color));
}

.ai-step.completed {
  color: var(--success-color);
}

.ai-step.completed i::after {
  content: '';
  width: 0.75em;
  height: 0.75em;
  display: inline-block;
  margin-left: 0.3em;
  background: currentColor;
  font-style: normal;
  font-weight: 700;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m9.3 16.6-4.2-4.2-1.4 1.4 5.6 5.6L21 7.7l-1.4-1.4L9.3 16.6z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m9.3 16.6-4.2-4.2-1.4 1.4 5.6 5.6L21 7.7l-1.4-1.4L9.3 16.6z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Generation step progress animation */
.ai-generating-steps .ai-step {
  opacity: 0.4;
  transform: translateX(-8px);
  transition: color 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
}

.ai-generating-steps .ai-step.active {
  opacity: 1;
  transform: translateX(0);
}

.ai-generating-steps .ai-step.completed {
  opacity: 0.8;
  transform: translateX(0);
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }

  .product-card {
    animation: none;
    opacity: 1;
  }

  .add-success-ripple {
    animation: none;
  }

  .cart-icon.bounce {
    animation: none;
  }

  .float-animation {
    animation: none;
  }

  .pulse-glow {
    animation: none;
  }

  .count-update {
    animation: none;
  }

  .skeleton-shimmer {
    animation: none;
  }

  .sticky-cart-bar .cart-bar-count.pop {
    animation: none;
  }

  .sticky-cart-bar.pulse {
    animation: none;
  }

  .cart-fly-plus {
    animation: none;
  }

  .confetti-piece {
    animation: none;
  }

  .save-success-check {
    animation: none;
  }

  .ai-generating-animation::before {
    animation: none;
  }
}
