/* ==========================================
   Animations CSS
   Advanced animations using CSS and Intersection Observer
   ========================================== */

/* ==========================================
   Fade In Animations
   ========================================== */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

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

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.fade-in-down {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================
   Slide In Animations
   ========================================== */
.slide-in-left {
    opacity: 0;
    transform: translateX(-100px);
    animation: slideInLeft 0.8s ease forwards;
}

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

.slide-in-right {
    opacity: 0;
    transform: translateX(100px);
    animation: slideInRight 0.8s ease forwards;
}

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

/* ==========================================
   Scale Animations
   ========================================== */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.scale-up {
    transition: transform 0.3s ease;
}

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

/* ==========================================
   Rotate Animations
   ========================================== */
.rotate-in {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

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

.bounce {
    animation: bounce 2s infinite;
}

/* ==========================================
   Pulse Animation
   ========================================== */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.7);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 20px rgba(0, 102, 204, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

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

.shake {
    animation: shake 0.5s;
}

/* ==========================================
   Floating Animation
   ========================================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

/* ==========================================
   Gradient Animation
   ========================================== */
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

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

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

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

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

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

/* ==========================================
   Flip Animation
   ========================================== */
@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    100% {
        transform: perspective(400px) rotateY(360deg);
    }
}

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

/* ==========================================
   Reveal Animation (Left to Right)
   ========================================== */
@keyframes reveal {
    0% {
        clip-path: inset(0 100% 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

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

/* ==========================================
   Glow Effect
   ========================================== */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 102, 204, 0.5),
                    0 0 10px rgba(0, 102, 204, 0.5),
                    0 0 15px rgba(0, 102, 204, 0.5);
    }
    50% {
        box-shadow: 0 0 10px rgba(0, 102, 204, 0.8),
                    0 0 20px rgba(0, 102, 204, 0.8),
                    0 0 30px rgba(0, 102, 204, 0.8);
    }
}

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

/* ==========================================
   Slide Down Animation (for dropdowns)
   ========================================== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-down {
    animation: slideDown 0.3s ease forwards;
}

/* ==========================================
   Wobble Animation
   ========================================== */
@keyframes wobble {
    0%, 100% {
        transform: translateX(0);
    }
    15% {
        transform: translateX(-25px) rotate(-5deg);
    }
    30% {
        transform: translateX(20px) rotate(3deg);
    }
    45% {
        transform: translateX(-15px) rotate(-3deg);
    }
    60% {
        transform: translateX(10px) rotate(2deg);
    }
    75% {
        transform: translateX(-5px) rotate(-1deg);
    }
}

.wobble {
    animation: wobble 1s ease;
}

/* ==========================================
   Zoom In Animation
   ========================================== */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.zoom-in {
    animation: zoomIn 0.5s ease;
}

/* ==========================================
   Ripple Effect
   ========================================== */
@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.7),
                    0 0 0 0 rgba(0, 102, 204, 0.7);
    }
    40% {
        box-shadow: 0 0 0 20px rgba(0, 102, 204, 0),
                    0 0 0 0 rgba(0, 102, 204, 0.7);
    }
    80% {
        box-shadow: 0 0 0 20px rgba(0, 102, 204, 0),
                    0 0 0 40px rgba(0, 102, 204, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0),
                    0 0 0 40px rgba(0, 102, 204, 0);
    }
}

.ripple {
    animation: ripple 2s infinite;
}

/* ==========================================
   Skeleton Loading Animation
   ========================================== */
@keyframes skeleton {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e0e0e0 40px,
        #f0f0f0 80px
    );
    background-size: 200px 100%;
    animation: skeleton 1.2s ease-in-out infinite;
}

/* ==========================================
   Slide Up Animation
   ========================================== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.6s ease forwards;
}

/* ==========================================
   Stagger Animation (for lists)
   ========================================== */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-item:nth-child(6) { transition-delay: 0.6s; }

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

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

/* ==========================================
   Fade Out Animation
   ========================================== */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

/* ==========================================
   Rotate 360
   ========================================== */
@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate-360 {
    animation: rotate360 1s linear infinite;
}

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

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

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

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

/* ==========================================
   Blink Animation
   ========================================== */
@keyframes blink-animation {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.blink {
    animation: blink-animation 1s infinite;
}

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

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

/* ==========================================
   Text Focus In Animation
   ========================================== */
@keyframes textFocusIn {
    0% {
        filter: blur(12px);
        opacity: 0;
    }
    100% {
        filter: blur(0);
        opacity: 1;
    }
}

.text-focus-in {
    animation: textFocusIn 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) both;
}

/* ==========================================
   Parallax Effect (handled by JS)
   ========================================== */
.parallax {
    transition: transform 0.1s ease-out;
}

/* ==========================================
   3D Transform Effects
   ========================================== */
.transform-3d {
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.transform-3d:hover {
    transform: rotateY(5deg) rotateX(5deg);
}

/* ==========================================
   Glassmorphism Effect
   ========================================== */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================
   Smooth Transitions
   ========================================== */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 102, 204, 0.5);
}

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

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

/* ==========================================
   Intersection Observer Classes
   ========================================== */
.observe {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* ==========================================
   Loading Spinner
   ========================================== */
@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spinner 1s linear infinite;
}

/* ==========================================
   Text Animations
   ========================================== */
.text-gradient {
    background: linear-gradient(135deg, #0066cc 0%, #00b4d8 50%, #ff6b35 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 3s linear infinite;
}

/* ==========================================
   Delay Classes
   ========================================== */
.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; }
