/**
 * FundedRocks Animations
 * Enhanced animation library
 *
 * @package FundedRocks
 */

/* ============================================
   BASE ANIMATIONS
   ============================================ */

/* Fade In Up */
.animate-fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In Down */
.animate-fade-in-down {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-fade-in-down.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In */
.animate-fade-in {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-fade-in.visible {
    opacity: 1;
}

/* Scale In */
.animate-scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Slide In Left */
.animate-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide In Right */
.animate-slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Blur In */
.animate-blur-in {
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.6s ease-out,
                filter 0.6s ease-out;
}

.animate-blur-in.visible {
    opacity: 1;
    filter: blur(0);
}

/* Zoom In */
.animate-zoom-in {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-zoom-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Rotate In */
.animate-rotate-in {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
    transition: opacity 0.6s ease-out,
                transform 0.6s ease-out;
}

.animate-rotate-in.visible {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ============================================
   STAGGER DELAYS
   ============================================ */
.delay-100 { transition-delay: 0.1s !important; }
.delay-200 { transition-delay: 0.2s !important; }
.delay-300 { transition-delay: 0.3s !important; }
.delay-400 { transition-delay: 0.4s !important; }
.delay-500 { transition-delay: 0.5s !important; }
.delay-600 { transition-delay: 0.6s !important; }
.delay-700 { transition-delay: 0.7s !important; }
.delay-800 { transition-delay: 0.8s !important; }
.delay-900 { transition-delay: 0.9s !important; }
.delay-1000 { transition-delay: 1s !important; }

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Pulse Dot (for badges) */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

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

/* Bounce */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-15px);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

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

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

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

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

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

/* Ping */
@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

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

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

/* Glow */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(124, 58, 237, 0.4);
    }
}

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

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

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

/* Shimmer (for loading states) */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

/* Draw Line (for SVG paths) */
@keyframes draw-line {
    to {
        stroke-dashoffset: 0;
    }
}

.animate-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw-line 2s ease-out forwards;
}

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

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.animate-typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--primary);
    animation: typewriter 3s steps(30) forwards,
               blink 0.75s step-end infinite;
}

/* ============================================
   HOVER ANIMATIONS
   ============================================ */

/* Lift */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Scale */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Glow */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
}

/* Rotate */
.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Slide Icon */
.hover-slide-icon {
    transition: transform 0.3s ease;
}

.hover-slide-icon:hover svg {
    transform: translateX(5px);
}

/* Border Highlight */
.hover-border {
    transition: border-color 0.3s ease;
}

.hover-border:hover {
    border-color: var(--primary);
}

/* Background Fill */
.hover-fill {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hover-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    z-index: -1;
}

.hover-fill:hover::before {
    width: 100%;
}

/* ============================================
   SCROLL-TRIGGERED EFFECTS
   ============================================ */

/* Parallax (use with JS) */
.parallax {
    will-change: transform;
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease, transform 0.8s ease;
}

.reveal.revealed {
    opacity: 1;
    visibility: visible;
}

.reveal-up {
    transform: translateY(50px);
}

.reveal-up.revealed {
    transform: translateY(0);
}

.reveal-left {
    transform: translateX(-50px);
}

.reveal-left.revealed {
    transform: translateX(0);
}

.reveal-right {
    transform: translateX(50px);
}

.reveal-right.revealed {
    transform: translateX(0);
}

.reveal-scale {
    transform: scale(0.8);
}

.reveal-scale.revealed {
    transform: scale(1);
}

/* ============================================
   LOADING STATES
   ============================================ */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-100) 25%,
        var(--gray-200) 50%,
        var(--gray-100) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* Dots Loading */
@keyframes dots {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: dots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

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

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

/* Underline Animation */
.animated-underline {
    position: relative;
}

.animated-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.animated-underline:hover::after {
    width: 100%;
}

/* Text Gradient Animation */
.animated-text-gradient {
    background: linear-gradient(
        90deg,
        var(--primary),
        var(--primary-light),
        var(--secondary),
        var(--primary)
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 5s ease infinite;
}

/* Counter Animation (handled by JS, this is just styling) */
.counter-value {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* Progress Bar Animation */
@keyframes progress {
    from {
        width: 0;
    }
}

.animate-progress {
    animation: progress 1.5s ease-out forwards;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-fade-in-up,
    .animate-fade-in-down,
    .animate-fade-in,
    .animate-scale-in,
    .animate-slide-left,
    .animate-slide-right,
    .animate-blur-in,
    .animate-zoom-in,
    .animate-rotate-in {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

/* Mobile: Reduce animation intensity */
@media (max-width: 768px) {
    .animate-fade-in-up,
    .animate-slide-left,
    .animate-slide-right {
        transform: translateY(20px);
    }
    
    .animate-slide-left,
    .animate-slide-right {
        transform: translateY(20px);
    }
}
