/* ===================================
   Micro-Interactions & Delight Effects
   =================================== */

/* Card Hover Enhancements */
.category-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--category-color) 0%, var(--category-color-light) 100%);
  transition: height 0.3s ease;
  z-index: 1;
}

/* Enhanced Hover Effects */
.category-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.category-card:hover::before {
  height: 12px;
}

/* Content Reveal on Hover */
.category-card .category-content {
  transition: transform 0.3s ease;
}

.category-card:hover .category-content {
  transform: translateY(-4px);
}

/* Icon Animation on Hover */
.category-card .category-icon {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.category-card:hover .category-icon {
  transform: scale(1.1) rotate(5deg);
}

/* Shimmer Loading Effect */
.loading-shimmer {
  position: relative;
  overflow: hidden;
}

.loading-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Ripple Effect for Clicks */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  pointer-events: none;
}

.ripple-effect:active::before {
  width: 400px;
  height: 400px;
}

/* Button Micro-Interactions */
.btn-browse-all {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-browse-all::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-browse-all:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(255, 123, 107, 0.4);
}

.btn-browse-all:active::before {
  width: 300px;
  height: 300px;
}

/* Pulse Animation for Important Elements */
.pulse-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 123, 107, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 123, 107, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 123, 107, 0);
  }
}

/* Bounce Animation for Icons */
.bounce-animation {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Floating Animation for Background Orbs */
.floating-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.1;
  pointer-events: none;
  animation: float 20s infinite ease-in-out;
}

.floating-orb:nth-child(1) {
  width: 300px;
  height: 300px;
  background: var(--resources-coral);
  top: -150px;
  left: -150px;
  animation-delay: 0s;
}

.floating-orb:nth-child(2) {
  width: 400px;
  height: 400px;
  background: var(--resources-amber);
  top: 50%;
  right: -200px;
  animation-delay: 5s;
}

.floating-orb:nth-child(3) {
  width: 250px;
  height: 250px;
  background: var(--resources-mint);
  bottom: -125px;
  left: 50%;
  animation-delay: 10s;
}

.floating-orb:nth-child(4) {
  width: 350px;
  height: 350px;
  background: var(--resources-lavender);
  top: 30%;
  left: 30%;
  animation-delay: 15s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(30px, -30px) rotate(90deg);
  }
  50% {
    transform: translate(-20px, 20px) rotate(180deg);
  }
  75% {
    transform: translate(-30px, -20px) rotate(270deg);
  }
}

/* Morphing Blob Animation */
.morphing-blob {
  position: absolute;
  border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
  filter: blur(40px);
  opacity: 0.08;
  pointer-events: none;
  animation: morph 15s infinite ease-in-out;
}

.morphing-blob:nth-child(1) {
  width: 400px;
  height: 400px;
  background: var(--resources-coral);
  top: -200px;
  left: -200px;
  animation-delay: 0s;
}

.morphing-blob:nth-child(2) {
  width: 350px;
  height: 350px;
  background: var(--resources-amber);
  top: 50%;
  right: -175px;
  animation-delay: 3s;
}

.morphing-blob:nth-child(3) {
  width: 300px;
  height: 300px;
  background: var(--resources-mint);
  bottom: -150px;
  left: 50%;
  animation-delay: 6s;
}

@keyframes morph {
  0%, 100% {
    border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%;
    transform: translate(20px, -20px) rotate(90deg);
  }
  50% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    transform: translate(-15px, 15px) rotate(180deg);
  }
  75% {
    border-radius: 50% 30% 60% 40% / 30% 60% 70% 40%;
    transform: translate(-20px, -10px) rotate(270deg);
  }
}

/* Staggered Grid Entrance Animation */
.staggered-entrance {
  opacity: 0;
  transform: translateY(30px) scale(0.9);
  animation: staggeredReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.staggered-entrance:nth-child(1) { animation-delay: 0ms; }
.staggered-entrance:nth-child(2) { animation-delay: 100ms; }
.staggered-entrance:nth-child(3) { animation-delay: 200ms; }
.staggered-entrance:nth-child(4) { animation-delay: 300ms; }
.staggered-entrance:nth-child(5) { animation-delay: 400ms; }
.staggered-entrance:nth-child(6) { animation-delay: 500ms; }
.staggered-entrance:nth-child(7) { animation-delay: 600ms; }
.staggered-entrance:nth-child(8) { animation-delay: 700ms; }

@keyframes staggeredReveal {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Touch Feedback for Mobile */
@media (hover: none) and (pointer: coarse) {
  .category-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .filter-pill:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  .btn-browse-all:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* Focus Ring Enhancements */
.focus-ring {
  transition: all 0.2s ease;
}

.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--resources-coral);
  border-radius: inherit;
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--resources-bg-warm-secondary) 25%,
    var(--resources-coral-light) 50%,
    var(--resources-bg-warm-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: inherit;
}

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

/* Progress Bar Animation */
.progress-bar {
  position: relative;
  overflow: hidden;
  background: var(--resources-bg-warm-secondary);
  border-radius: 10px;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--resources-coral), var(--resources-amber));
  border-radius: inherit;
  animation: progressGrow 2s ease-out forwards;
}

@keyframes progressGrow {
  from {
    width: 0%;
  }
  to {
    width: var(--progress, 0%);
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .category-card:hover {
    transform: translateY(-4px) scale(1.01);
  }
  
  .floating-orb,
  .morphing-blob {
    opacity: 0.05;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .loading-shimmer::before,
  .ripple-effect::before,
  .btn-browse-all::before,
  .floating-orb,
  .morphing-blob,
  .pulse-animation,
  .bounce-animation {
    animation: none;
  }
  
  .category-card,
  .category-card .category-icon,
  .category-card .category-content,
  .btn-browse-all,
  .filter-pill {
    transition: none;
  }
  
  .category-card:hover {
    transform: none;
  }
}

/* Dark Mode Adjustments */
html.dark-mode .loading-shimmer::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
}

html.dark-mode .skeleton {
  background: linear-gradient(
    90deg,
    var(--resources-bg-warm) 25%,
    var(--resources-coral) 50%,
    var(--resources-bg-warm) 75%
  );
  background-size: 200% 100%;
}
