/* ==========================================================================
   DVMReady Animations & Micro-interactions
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties for Animation Timing
   -------------------------------------------------------------------------- */
:root {
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------------------------------------------------------------------------
   Scroll-Triggered Animations (Initial State)
   -------------------------------------------------------------------------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
  will-change: opacity, transform;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children animations */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 80ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 160ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 240ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 320ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 400ms; opacity: 1; transform: translateY(0); }

/* --------------------------------------------------------------------------
   Hero Section Animations
   -------------------------------------------------------------------------- */
.hero-animate {
  opacity: 0;
  transform: translateY(30px);
  animation: heroFadeIn 0.8s var(--ease-out) forwards;
}

.hero-animate-delay-1 { animation-delay: 0.1s; }
.hero-animate-delay-2 { animation-delay: 0.2s; }
.hero-animate-delay-3 { animation-delay: 0.3s; }
.hero-animate-delay-4 { animation-delay: 0.4s; }

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

/* --------------------------------------------------------------------------
   Enhanced Hover Effects
   -------------------------------------------------------------------------- */

/* Card hover lift */
.hover-lift {
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
  will-change: transform, box-shadow;
}

.hover-lift:hover,
.hover-lift:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 28px 60px rgba(20, 33, 47, 0.14);
}

/* Button press effect */
.button-press:active {
  transform: scale(0.97);
  transition: transform var(--duration-fast) var(--ease-out);
}

/* Navigation link underline slide */
.nav-link-hover {
  position: relative;
}

.nav-link-hover::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out);
}

.nav-link-hover:hover::after,
.nav-link-hover:focus-visible::after {
  transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   Filter Pill Animations
   -------------------------------------------------------------------------- */
.filter-pill {
  transition: transform var(--duration-fast) var(--ease-bounce),
              background var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out);
}

.filter-pill.is-active {
  transform: scale(1.02);
}

/* --------------------------------------------------------------------------
   Search Input Focus Animation
   -------------------------------------------------------------------------- */
.search-input {
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.search-input:focus {
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

/* Search suggestions dropdown */
.search-suggestions {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.search-suggestions:not([hidden]) {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --------------------------------------------------------------------------
   Icon Animations
   -------------------------------------------------------------------------- */
.icon-pulse {
  animation: iconPulse 2s var(--ease-in-out) infinite;
}

@keyframes iconPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.icon-bounce:hover {
  animation: iconBounce 0.5s var(--ease-bounce);
}

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

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 16px;
  background: var(--text);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 20px 40px rgba(20, 33, 47, 0.2);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100px);
  animation: toastSlideIn 0.4s var(--ease-out) forwards;
}

.toast.toast-exit {
  animation: toastSlideOut 0.3s var(--ease-in-out) forwards;
}

.toast-success { background: #0f766e; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }

@keyframes toastSlideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Empty State Animation
   -------------------------------------------------------------------------- */
.empty-state-illustration {
  animation: emptyStateFloat 3s var(--ease-in-out) infinite;
}

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

/* --------------------------------------------------------------------------
   Loading States
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(20, 33, 47, 0.06) 25%,
    rgba(20, 33, 47, 0.1) 50%,
    rgba(20, 33, 47, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: 8px;
}

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

/* --------------------------------------------------------------------------
   Tool Status Badge Animations
   -------------------------------------------------------------------------- */
.status-live {
  position: relative;
}

.status-live::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* --------------------------------------------------------------------------
   Icon Container Styles
   -------------------------------------------------------------------------- */
.category-icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(215, 161, 104, 0.22));
  color: var(--brand-strong);
}

.category-icon-svg svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* --------------------------------------------------------------------------
   Reduced Motion Support
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-on-scroll,
  .stagger-children > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  
  .hero-animate {
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  .skeleton {
    animation: none;
    background: rgba(20, 33, 47, 0.06);
  }
}

/* --------------------------------------------------------------------------
   Mobile Optimizations
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 80px; /* Account for sticky actions */
  }
  
  .toast {
    width: 100%;
  }
}
