/* ===== CUSTOM ANIMATIONS FOR PAWSPECT ===== */

/* ===== DIRECTIONAL PAGE TRANSITIONS ===== */

/* Slide Out Animations - For exiting pages */
@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

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

/* Slide In Animations - For entering pages */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Directional Transition Classes - Slowed down for visibility */
/* Forward navigation: old page slides left, new page enters from right */
.page-transition-forward-out {
    animation: slideOutLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.page-transition-forward-in {
    animation: slideInFromRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Backward navigation: old page slides right, new page enters from left */
.page-transition-backward-out {
    animation: slideOutRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.page-transition-backward-in {
    animation: slideInFromLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Default page entry (first load or unknown direction) */
.page-transition-default {
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated content wrapper - only wraps the main content, not navigation */
.animated-content-wrapper {
    width: 100%;
    min-height: 100%;
    display: block;
}

/* Page Transition Animations */
@keyframes pageTransitionFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pageTransitionSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageTransitionSlideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Apply page transition class */
.page-transition {
    animation: pageTransitionFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger children animations for list items */
.stagger-animation > * {
    opacity: 0;
    animation: pageTransitionSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-animation > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-animation > *:nth-child(10) { animation-delay: 0.5s; }

/* Bounce Animation for CTAs */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.bounce-on-hover:hover {
    animation: bounce 0.6s ease-in-out;
}

/* Shake Animation for Errors */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

/* Glow Effect for Important Elements */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 137, 123, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 137, 123, 0.8), 0 0 30px rgba(0, 137, 123, 0.6);
    }
}

.glow-effect {
    animation: glow 2s ease-in-out infinite;
}

/* Flip Card Animation */
.flip-card {
    perspective: 1000px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
    position: absolute;
    width: 100%;
    height: 100%;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Shimmer Loading Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s linear infinite;
}

/* Fade In Up for Cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scale In Animation */
@keyframes scaleInCenter {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleInCenter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rotate In Animation */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.rotate-in {
    animation: rotateIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Heartbeat Animation for Notifications */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(0.9);
    }
}

.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* Float Animation for Hero Elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Gradient Shift Background */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-shift {
    background: linear-gradient(
        270deg,
        #00897B,
        #4DB6AC,
        #80CBC4,
        #4DB6AC,
        #00897B
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

/* Text Reveal Animation */
@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.text-reveal {
    opacity: 0;
    animation: textReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Confetti Effect (Celebration Animation) */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #FF7043;
    animation: confetti-fall 3s linear infinite;
}

/* Ripple Effect for Buttons (CSS-only) */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

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

.ripple-effect:active::after {
    width: 300px;
    height: 300px;
}

/* Blur In Animation */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

.blur-in {
    animation: blurIn 0.6s ease-out;
}

/* Type Writer Effect for Text */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid #00897B;
    white-space: nowrap;
    animation: typewriter 3s steps(40) 1s 1 normal both;
}

/* Zoom On Hover */
.zoom-on-hover {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-on-hover:hover {
    transform: scale(1.1);
}

/* Tilt Effect on Hover */
.tilt-on-hover {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tilt-on-hover:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Icon Spin on Hover */
.icon-spin-hover:hover {
    animation: spin 0.6s linear;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Attention Seeker - Tada Animation */
@keyframes tada {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    10%, 20% {
        transform: scale(0.9) rotate(-3deg);
    }
    30%, 50%, 70%, 90% {
        transform: scale(1.1) rotate(3deg);
    }
    40%, 60%, 80% {
        transform: scale(1.1) rotate(-3deg);
    }
}

.tada-animation {
    animation: tada 1s ease-in-out;
}

/* Slide In from Bottom Navigation Transition */
@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-bottom {
    animation: slideInBottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accordion Expand Animation */
@keyframes accordionExpand {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 500px;
        opacity: 1;
    }
}

.accordion-expand {
    animation: accordionExpand 0.4s ease-out;
    overflow: hidden;
}

/* Mobile-specific animations */
@media (max-width: 599.98px) {
    /* Reduce animation complexity on mobile for performance */
    .page-transition {
        animation-duration: 0.3s;
    }
    
    .stagger-animation > * {
        animation-duration: 0.3s;
    }
    
    /* Disable complex animations on mobile */
    .float-animation,
    .gradient-shift {
        animation: none;
    }
}

/* Reduced Motion Support - Accessibility */
@media (prefers-reduced-motion: reduce) {
    /* Disable specific animations for accessibility, but allow page transitions */
    .bounce-on-hover:hover,
    .float-animation,
    .gradient-shift,
    .heartbeat,
    .glow-effect,
    .shimmer {
        animation: none !important;
    }
    
    /* Reduce duration for page transitions but don't eliminate them completely */
    .page-transition,
    .page-transition-default,
    .page-transition-forward-in,
    .page-transition-forward-out,
    .page-transition-backward-in,
    .page-transition-backward-out,
    .animated-content-wrapper {
        animation-duration: 0.5s !important;
    }
    
    /* Make stagger animations instant for accessibility */
    .stagger-animation > * {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
    }
}
