/**
 * DVMReady - Enhanced Animations
 * Professional animations for a modern veterinary platform
 */

/* ==========================================
   CSS CUSTOM PROPERTIES FOR ANIMATIONS
   ========================================== */
:root {
  --anim-duration-fast: 0.2s;
  --anim-duration-normal: 0.3s;
  --anim-duration-slow: 0.5s;
  --anim-easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --anim-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --anim-easing-entrance: cubic-bezier(0.0, 0, 0.2, 1);
}

/* ==========================================
   FLOATING ELEMENTS ANIMATION
   ========================================== */
@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(2deg);
  }
  50% {
    transform: translateY(-10px) rotate(-1deg);
  }
  75% {
    transform: translateY(-25px) rotate(1deg);
  }
}

@keyframes float-reverse {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(25px) rotate(-2deg);
  }
  50% {
    transform: translateY(10px) rotate(1deg);
  }
  75% {
    transform: translateY(20px) rotate(-1deg);
  }
}

.pc-float-shape {
  animation: float 8s ease-in-out infinite;
}

.pc-float-shape--1 { animation-delay: 0s; animation-duration: 10s; }
.pc-float-shape--2 { animation-delay: -2s; animation-duration: 12s; }
.pc-float-shape--3 { animation-delay: -4s; animation-duration: 9s; }
.pc-float-shape--4 { animation-delay: -6s; animation-duration: 11s; }

/* ==========================================
   ORB PULSE ANIMATION
   ========================================== */
@keyframes orb-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.6;
  }
}

.pc-ambient-orb {
  animation: orb-pulse 6s ease-in-out infinite;
}

.pc-ambient-orb--1 { animation-delay: 0s; }
.pc-ambient-orb--2 { animation-delay: -2s; }
.pc-ambient-orb--3 { animation-delay: -4s; }

/* ==========================================
   GRADIENT SHIFT ANIMATION
   ========================================== */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.pc-gradient-text {
  background-size: 200% 200%;
  animation: gradient-shift 5s ease infinite;
}

/* ==========================================
   SCROLL-TRIGGERED ANIMATIONS
   ========================================== */
[data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--anim-duration-slow) var(--anim-easing-entrance),
              transform var(--anim-duration-slow) var(--anim-easing-entrance);
}

[data-animate].pc-is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-animate="fade-left"] {
  transform: translateX(-30px);
}

[data-animate="fade-left"].pc-is-visible {
  transform: translateX(0);
}

[data-animate="fade-right"] {
  transform: translateX(30px);
}

[data-animate="fade-right"].pc-is-visible {
  transform: translateX(0);
}

[data-animate="fade-scale"] {
  transform: scale(0.9);
}

[data-animate="fade-scale"].pc-is-visible {
  transform: scale(1);
}

[data-animate="fade-rotate"] {
  transform: rotate(-5deg) scale(0.9);
}

[data-animate="fade-rotate"].pc-is-visible {
  transform: rotate(0) scale(1);
}

/* Staggered children animation */
[data-animate-group] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--anim-duration-normal) var(--anim-easing-entrance),
              transform var(--anim-duration-normal) var(--anim-easing-entrance);
}

[data-animate-group].pc-is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
[data-animate-group].pc-is-visible > *:nth-child(2) { transition-delay: 100ms; opacity: 1; transform: translateY(0); }
[data-animate-group].pc-is-visible > *:nth-child(3) { transition-delay: 200ms; opacity: 1; transform: translateY(0); }
[data-animate-group].pc-is-visible > *:nth-child(4) { transition-delay: 300ms; opacity: 1; transform: translateY(0); }
[data-animate-group].pc-is-visible > *:nth-child(5) { transition-delay: 400ms; opacity: 1; transform: translateY(0); }
[data-animate-group].pc-is-visible > *:nth-child(6) { transition-delay: 500ms; opacity: 1; transform: translateY(0); }

/* ==========================================
   CARD HOVER EFFECTS
   ========================================== */
.pc-home-tier-card,
.pc-tool-card,
.pc-study-card {
  transition: transform var(--anim-duration-fast) var(--anim-easing-smooth),
              box-shadow var(--anim-duration-fast) var(--anim-easing-smooth);
}

.pc-home-tier-card:hover,
.pc-tool-card:hover,
.pc-study-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Shine effect on hover */
.pc-home-tier-card::after,
.pc-tool-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
  pointer-events: none;
}

.pc-home-tier-card:hover::after,
.pc-tool-card:hover::after {
  left: 100%;
}

/* ==========================================
   BUTTON ANIMATIONS
   ========================================== */
.pc-btn {
  position: relative;
  overflow: hidden;
  transition: transform var(--anim-duration-fast) var(--anim-easing-smooth),
              box-shadow var(--anim-duration-fast) var(--anim-easing-smooth);
}

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

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

.pc-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(13, 115, 119, 0.3);
}

.pc-btn:active {
  transform: translateY(0);
}

/* ==========================================
   NAV LINK UNDERLINE ANIMATION
   ========================================== */
.pc-nav-link {
  position: relative;
}

.pc-nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--pc-primary);
  transition: width var(--anim-duration-normal) var(--anim-easing-smooth);
}

.pc-nav-link:hover::after,
.pc-nav-link.pc-is-active::after {
  width: 100%;
}

/* ==========================================
   LOADING SPINNER
   ========================================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pc-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

/* ==========================================
   PULSE NOTIFICATION BADGE
   ========================================== */
@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.pc-badge--pulse {
  animation: pulse-badge 2s ease-in-out infinite;
}

/* ==========================================
   TOAST NOTIFICATION ANIMATIONS
   ========================================== */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.pc-toast {
  animation: toast-in var(--anim-duration-normal) var(--anim-easing-entrance);
}

.pc-toast.pc-is-exiting {
  animation: toast-out var(--anim-duration-normal) var(--anim-easing-smooth) forwards;
}

/* ==========================================
   LOGO ANIMATION
   ========================================== */
@keyframes logo-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.pc-logo:hover .pc-logo__icon {
  animation: logo-pulse 0.5s ease-in-out;
}

/* ==========================================
   HERO SECTION ENHANCEMENTS
   ========================================== */
@keyframes hero-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

.pc-hero__badge {
  animation: hero-float 4s ease-in-out infinite;
}

/* Typing cursor animation for hero title */
@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.pc-typing-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
  color: var(--pc-primary);
}

/* ==========================================
   SEARCH INPUT FOCUS ANIMATION
   ========================================== */
.pc-search-input {
  transition: box-shadow var(--anim-duration-fast) var(--anim-easing-smooth),
              border-color var(--anim-duration-fast) var(--anim-easing-smooth),
              transform var(--anim-duration-fast) var(--anim-easing-smooth);
}

.pc-search-input:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.2);
}

/* ==========================================
   PAGE TRANSITION
   ========================================== */
.pc-page-transition {
  position: fixed;
  inset: 0;
  background: var(--pc-bg);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.pc-page-transition.pc-is-active {
  opacity: 1;
  pointer-events: all;
}

/* ==========================================
   SCROLL REVEAL FOR FEATURE CARDS
   ========================================== */
@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pc-feature-card {
  animation: reveal-up 0.6s var(--anim-easing-entrance) backwards;
}

.pc-feature-card:nth-child(1) { animation-delay: 0.1s; }
.pc-feature-card:nth-child(2) { animation-delay: 0.2s; }
.pc-feature-card:nth-child(3) { animation-delay: 0.3s; }
.pc-feature-card:nth-child(4) { animation-delay: 0.4s; }

/* ==========================================
   MOBILE MENU ANIMATIONS
   ========================================== */
@keyframes slide-in-right {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pc-mobile-menu.pc-is-open {
  animation: slide-in-right var(--anim-duration-normal) var(--anim-easing-entrance);
}

.pc-mobile-menu-overlay.pc-is-active {
  animation: fade-in var(--anim-duration-normal) ease;
}

/* Hamburger to X animation */
.pc-mobile-toggle__bar {
  transition: transform var(--anim-duration-fast) ease,
              opacity var(--anim-duration-fast) ease;
}

.pc-mobile-toggle[aria-expanded="true"] .pc-mobile-toggle__bar:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.pc-mobile-toggle[aria-expanded="true"] .pc-mobile-toggle__bar:nth-child(2) {
  opacity: 0;
}

.pc-mobile-toggle[aria-expanded="true"] .pc-mobile-toggle__bar:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================
   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;
  }
  
  [data-animate],
  [data-animate-group] > * {
    opacity: 1;
    transform: none;
  }
}
