/* Animation Library for Gita App */

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -15px, 0);
    }
    70% {
        transform: translate3d(0, -7px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

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

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

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

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 107, 53, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.8), 0 0 30px rgba(255, 107, 53, 0.6);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: currentColor;
    }
}

/* Page Flip Animations */
@keyframes flipLeft {
    0% {
        transform: rotateY(0deg);
        z-index: 2;
    }
    25% {
        transform: rotateY(-45deg);
        z-index: 2;
    }
    50% {
        transform: rotateY(-90deg);
        z-index: 1;
    }
    75% {
        transform: rotateY(-135deg);
        z-index: 1;
    }
    100% {
        transform: rotateY(-180deg);
        z-index: 1;
    }
}

@keyframes flipRight {
    0% {
        transform: rotateY(0deg);
        z-index: 2;
    }
    25% {
        transform: rotateY(45deg);
        z-index: 2;
    }
    50% {
        transform: rotateY(90deg);
        z-index: 1;
    }
    75% {
        transform: rotateY(135deg);
        z-index: 1;
    }
    100% {
        transform: rotateY(180deg);
        z-index: 1;
    }
}

@keyframes pageFlipLeft {
    0% {
        transform: rotateY(0deg) translateZ(1px);
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    50% {
        transform: rotateY(-90deg) translateZ(1px);
        box-shadow: 
            0 20px 40px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
    100% {
        transform: rotateY(-180deg) translateZ(1px);
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
}

@keyframes pageFlipRight {
    0% {
        transform: rotateY(0deg) translateZ(1px);
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    50% {
        transform: rotateY(90deg) translateZ(1px);
        box-shadow: 
            0 20px 40px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
    100% {
        transform: rotateY(180deg) translateZ(1px);
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
}

/* Mandala Rotation Animation */
@keyframes mandalaRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes mandalaCounterRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

/* Progress Bar Animation */
@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width);
    }
}

/* Toast Animation */
@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Button Click Animation */
@keyframes buttonClick {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* Hover Animations */
@keyframes hoverLift {
    from {
        transform: translateY(0);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    to {
        transform: translateY(-4px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    }
}

@keyframes hoverGlow {
    from {
        box-shadow: 0 0 5px rgba(255, 107, 53, 0.3);
    }
    to {
        box-shadow: 0 0 15px rgba(255, 107, 53, 0.6);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.5s ease-out forwards;
}

.animate-slide-in-up {
    animation: slideInUp 0.5s ease-out forwards;
}

.animate-slide-in-down {
    animation: slideInDown 0.5s ease-out forwards;
}

.animate-zoom-in {
    animation: zoomIn 0.4s ease-out forwards;
}

.animate-bounce {
    animation: bounce 1s ease-out;
}

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

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

.animate-spin {
    animation: spin 1s linear infinite;
}

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

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

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

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

.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    background-size: 200px 100%;
    animation: shimmer 2s infinite;
}

/* Hover Animation Classes */
.hover-lift:hover {
    animation: hoverLift 0.3s ease-out forwards;
}

.hover-glow:hover {
    animation: hoverGlow 0.3s ease-out forwards;
}

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

.hover-pulse:hover {
    animation: pulse 0.6s ease-out;
}

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

.hover-wiggle:hover {
    animation: wiggle 0.6s ease-out;
}

/* Click Animation Classes */
.clicked {
    animation: buttonClick 0.2s ease-out;
}

/* Loading Animation Classes */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

.loading-bounce {
    animation: bounce 1s infinite;
}

.loading-shimmer {
    animation: shimmer 2s infinite;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        rgba(255, 255, 255, 0.1) 100%);
    background-size: 200px 100%;
}

/* Page Flip Animation Classes */
.flipping-left .page-left {
    animation: pageFlipLeft 0.8s ease-in-out forwards;
}

.flipping-right .page-right {
    animation: pageFlipRight 0.8s ease-in-out forwards;
}

/* Stagger Animations */
.stagger-fade-in > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-fade-in > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-fade-in > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-fade-in > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-fade-in > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-fade-in > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-fade-in > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-fade-in > *:nth-child(8) { animation-delay: 0.8s; }

/* Mandala Animations */
.mandala-layer:nth-child(1) {
    animation: mandalaRotate 20s linear infinite;
}

.mandala-layer:nth-child(2) {
    animation: mandalaCounterRotate 15s linear infinite;
}

.mandala-layer:nth-child(3) {
    animation: mandalaRotate 25s linear infinite;
}

.central-om {
    animation: gentleFloat 4s ease-in-out infinite;
}

/* Toast Animations */
.toast {
    animation: toastSlideIn 0.3s ease-out forwards;
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease-out forwards;
}

/* Progress Bar Animations */
.progress-bar {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.animated {
    animation: progressFill 2s ease-out forwards;
}

/* Scroll Triggered Animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax Animation */
.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

/* Performance Optimizations */
.animate-gpu {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 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;
        scroll-behavior: auto !important;
    }
    
    .animate-float,
    .animate-pulse,
    .animate-heartbeat,
    .animate-spin,
    .animate-bounce {
        animation: none !important;
    }
    
    .mandala-layer {
        animation: none !important;
    }
    
    .central-om {
        animation: none !important;
    }
}

/* High Performance Mode */
.performance-mode * {
    will-change: auto !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
}

/* Focus Animations */
.focus-ring:focus {
    animation: pulse 0.6s ease-out;
}

/* Text Animations */
.typewriter-text {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid currentColor;
    animation: 
        typewriter 3s steps(40, end),
        blink 0.75s step-end infinite;
}

/* Page Transition Animations */
.page-transition-enter {
    opacity: 0;
    transform: translateX(100%);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.5s ease-out;
}

.page-transition-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateX(-100%);
    transition: all 0.5s ease-out;
}

/* Micro-interactions */
.micro-bounce {
    transition: transform 0.1s ease-out;
}

.micro-bounce:active {
    transform: scale(0.98);
}

.micro-lift {
    transition: transform 0.2s ease-out;
}

.micro-lift:hover {
    transform: translateY(-1px);
}

.micro-glow {
    transition: box-shadow 0.2s ease-out;
}

.micro-glow:hover {
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
}

/* Loading States */
.skeleton-loading {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 25%, 
        rgba(255, 255, 255, 0.3) 50%, 
        rgba(255, 255, 255, 0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Success/Error States */
.success-pulse {
    animation: pulse 0.6s ease-out;
    background-color: var(--success-color);
}

.error-shake {
    animation: shake 0.5s ease-out;
    background-color: var(--error-color);
}