/* ============================================================
   PISCINE LAGON - Keyframe Animations
   ============================================================ */

/* -------------------------------------------------------
   Fade In Animations
   ------------------------------------------------------- */

/* Fade In Up */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

/* Fade In Down */
@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease forwards;
}

/* Fade In Left */
@keyframes fadeInLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease forwards;
}

/* Fade In Right */
@keyframes fadeInRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease forwards;
}

/* Fade In (General) */
@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.animate-fadeIn {
    animation: fadeIn 0.6s ease forwards;
}

/* -------------------------------------------------------
   Scale Animations
   ------------------------------------------------------- */

/* Scale In */
@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scaleIn {
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Scale In Up */
@keyframes scaleInUp {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-scaleInUp {
    animation: scaleInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* -------------------------------------------------------
   Slide Animations
   ------------------------------------------------------- */

/* Slide In from Left */
@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slideInLeft {
    animation: slideInLeft 0.5s ease forwards;
}

/* Slide In from Right */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slideInRight {
    animation: slideInRight 0.5s ease forwards;
}

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

.animate-slideInUp {
    animation: slideInUp 0.5s ease forwards;
}

/* Slide In from Top */
@keyframes slideInDown {
    0% {
        opacity: 0;
        transform: translateY(-100%);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slideInDown {
    animation: slideInDown 0.5s ease forwards;
}

/* -------------------------------------------------------
   Continuous / Looping Animations
   ------------------------------------------------------- */

/* Pulse */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

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

/* Pulse Glow */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 119, 182, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(0, 119, 182, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 119, 182, 0);
    }
}

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

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

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

/* Float with Rotation */
@keyframes floatRotate {
    0% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(2deg);
    }
    50% {
        transform: translateY(-15px) rotate(0deg);
    }
    75% {
        transform: translateY(-8px) rotate(-2deg);
    }
    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

.animate-floatRotate {
    animation: floatRotate 6s ease-in-out infinite;
}

/* Wave */
@keyframes wave {
    0% {
        transform: rotate(0deg);
    }
    10% {
        transform: rotate(14deg);
    }
    20% {
        transform: rotate(-8deg);
    }
    30% {
        transform: rotate(14deg);
    }
    40% {
        transform: rotate(-4deg);
    }
    50% {
        transform: rotate(10deg);
    }
    60% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.animate-wave {
    animation: wave 2.5s ease-in-out infinite;
    transform-origin: 70% 70%;
    display: inline-block;
}

/* Wave Motion (for water effects) */
@keyframes waveMotion {
    0% {
        transform: translateX(0) translateZ(0) scaleY(1);
    }
    50% {
        transform: translateX(-25%) translateZ(0) scaleY(0.55);
    }
    100% {
        transform: translateX(-50%) translateZ(0) scaleY(1);
    }
}

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

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 2s ease infinite;
}

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

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

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

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

/* Slow Spin */
@keyframes spinSlow {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.animate-spinSlow {
    animation: spinSlow 8s linear infinite;
}

/* -------------------------------------------------------
   Shimmer (Loading Placeholder)
   ------------------------------------------------------- */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Shimmer with custom colors for ocean theme */
@keyframes shimmerOcean {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.animate-shimmerOcean {
    background: linear-gradient(
        90deg,
        #CAF0F8 25%,
        #B0E4F5 50%,
        #CAF0F8 75%
    );
    background-size: 200% 100%;
    animation: shimmerOcean 1.5s ease-in-out infinite;
}

/* -------------------------------------------------------
   Typing Cursor Blink
   ------------------------------------------------------- */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.animate-blink {
    animation: blink 0.8s ease-in-out infinite;
}

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.animate-typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid #F77F00;
    animation: typing 3s steps(40, end),
               blink 0.75s step-end infinite;
}

/* -------------------------------------------------------
   Ripple Effect
   ------------------------------------------------------- */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

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

.animate-gradientShift {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

/* -------------------------------------------------------
   Swing
   ------------------------------------------------------- */
@keyframes swing {
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.animate-swing {
    animation: swing 1s ease;
    transform-origin: top center;
}

/* -------------------------------------------------------
   Rubber Band
   ------------------------------------------------------- */
@keyframes rubberBand {
    0% { transform: scale(1); }
    30% { transform: scaleX(1.25) scaleY(0.75); }
    40% { transform: scaleX(0.75) scaleY(1.25); }
    50% { transform: scaleX(1.15) scaleY(0.85); }
    65% { transform: scaleX(0.95) scaleY(1.05); }
    75% { transform: scaleX(1.05) scaleY(0.95); }
    100% { transform: scale(1); }
}

.animate-rubberBand {
    animation: rubberBand 1s ease;
}

/* -------------------------------------------------------
   Jello
   ------------------------------------------------------- */
@keyframes jello {
    0%, 11.1%, 100% { transform: none; }
    22.2% { transform: skewX(-12.5deg) skewY(-12.5deg); }
    33.3% { transform: skewX(6.25deg) skewY(6.25deg); }
    44.4% { transform: skewX(-3.125deg) skewY(-3.125deg); }
    55.5% { transform: skewX(1.5625deg) skewY(1.5625deg); }
    66.6% { transform: skewX(-0.78125deg) skewY(-0.78125deg); }
    77.7% { transform: skewX(0.390625deg) skewY(0.390625deg); }
    88.8% { transform: skewX(-0.1953125deg) skewY(-0.1953125deg); }
}

.animate-jello {
    animation: jello 1s ease;
    transform-origin: center;
}

/* -------------------------------------------------------
   Zoom In Variants
   ------------------------------------------------------- */
@keyframes zoomIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.animate-zoomIn {
    animation: zoomIn 0.5s ease forwards;
}

@keyframes zoomInDown {
    0% {
        opacity: 0;
        transform: scale(0.1) translateY(-1000px);
    }
    60% {
        opacity: 1;
        transform: scale(0.475) translateY(60px);
    }
    100% {
        transform: scale(1) translateY(0);
    }
}

.animate-zoomInDown {
    animation: zoomInDown 0.6s ease forwards;
}

/* -------------------------------------------------------
   Rotate Animations
   ------------------------------------------------------- */
@keyframes rotateIn {
    0% {
        opacity: 0;
        transform: rotate(-200deg);
    }
    100% {
        opacity: 1;
        transform: rotate(0);
    }
}

.animate-rotateIn {
    animation: rotateIn 0.6s ease forwards;
}

@keyframes rotateInDownLeft {
    0% {
        opacity: 0;
        transform: rotate(-45deg);
    }
    100% {
        opacity: 1;
        transform: rotate(0);
    }
}

.animate-rotateInDownLeft {
    animation: rotateInDownLeft 0.6s ease forwards;
    transform-origin: left bottom;
}

/* -------------------------------------------------------
   Flip Animations
   ------------------------------------------------------- */
@keyframes flipInX {
    0% {
        opacity: 0;
        transform: perspective(400px) rotateX(90deg);
    }
    40% {
        transform: perspective(400px) rotateX(-20deg);
    }
    60% {
        transform: perspective(400px) rotateX(10deg);
        opacity: 1;
    }
    80% {
        transform: perspective(400px) rotateX(-5deg);
    }
    100% {
        transform: perspective(400px) rotateX(0);
        opacity: 1;
    }
}

.animate-flipInX {
    animation: flipInX 0.8s ease forwards;
    backface-visibility: visible;
}

@keyframes flipInY {
    0% {
        opacity: 0;
        transform: perspective(400px) rotateY(90deg);
    }
    40% {
        transform: perspective(400px) rotateY(-20deg);
    }
    60% {
        transform: perspective(400px) rotateY(10deg);
        opacity: 1;
    }
    80% {
        transform: perspective(400px) rotateY(-5deg);
    }
    100% {
        transform: perspective(400px) rotateY(0);
        opacity: 1;
    }
}

.animate-flipInY {
    animation: flipInY 0.8s ease forwards;
    backface-visibility: visible;
}

/* -------------------------------------------------------
   Particle / Decoration Animations
   ------------------------------------------------------- */

/* Bubble Rise (for water theme) */
@keyframes bubbleRise {
    0% {
        opacity: 0;
        transform: translateY(100%) scale(0.3);
    }
    20% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(1);
    }
}

.animate-bubbleRise {
    animation: bubbleRise 8s ease-in infinite;
}

/* Star Twinkle */
@keyframes twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.8); }
}

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

/* Heartbeat */
@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

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

/* -------------------------------------------------------
   Loading Animations
   ------------------------------------------------------- */

/* Dot Loader */
@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.dot-loader {
    display: inline-flex;
    gap: 6px;
}

.dot-loader span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0077B6;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.dot-loader span:nth-child(1) { animation-delay: 0s; }
.dot-loader span:nth-child(2) { animation-delay: 0.2s; }
.dot-loader span:nth-child(3) { animation-delay: 0.4s; }

/* Bar Loader */
@keyframes barGrow {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

.bar-loader {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    height: 30px;
}

.bar-loader span {
    width: 4px;
    height: 100%;
    background: #0077B6;
    border-radius: 2px;
    animation: barGrow 1.2s ease-in-out infinite;
}

.bar-loader span:nth-child(1) { animation-delay: 0s; }
.bar-loader span:nth-child(2) { animation-delay: 0.1s; }
.bar-loader span:nth-child(3) { animation-delay: 0.2s; }
.bar-loader span:nth-child(4) { animation-delay: 0.3s; }
.bar-loader span:nth-child(5) { animation-delay: 0.4s; }

/* -------------------------------------------------------
   Utility Animation Delays
   ------------------------------------------------------- */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }
.delay-1500 { animation-delay: 1.5s; }
.delay-2000 { animation-delay: 2s; }

/* -------------------------------------------------------
   Utility Animation Durations
   ------------------------------------------------------- */
.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }
.duration-1500 { animation-duration: 1.5s; }
.duration-2000 { animation-duration: 2s; }
.duration-3000 { animation-duration: 3s; }

/* -------------------------------------------------------
   Reduced Motion Preference
   ------------------------------------------------------- */
@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-bounce,
    .animate-spin,
    .animate-shimmer,
    .animate-blink,
    .animate-wave,
    .animate-heartbeat,
    .animate-twinkle,
    .animate-bubbleRise,
    .animate-waveMotion,
    .animate-gradientShift,
    .animate-pulseGlow,
    .animate-spinSlow,
    .animate-floatRotate,
    .animate-gentleBounce {
        animation: none !important;
    }
}
