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

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

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

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

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

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

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

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

@keyframes highlightGrow {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

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

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.8);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@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% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* ===== SCROLL REVEAL ANIMATIONS ===== */

.reveal {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s ease-out;
}

.reveal.animate-in {
    animation: fadeInUp 0.8s ease-out;
}

.reveal-left {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.8s ease-out;
}

.reveal-left.animate-in {
    animation: fadeInLeft 0.8s ease-out;
}

.reveal-right {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.8s ease-out;
}

.reveal-right.animate-in {
    animation: fadeInRight 0.8s ease-out;
}

.reveal-scale {
    opacity: 1;
    transform: scale(1);
    transition: all 0.8s ease-out;
}

.reveal-scale.animate-in {
    animation: scaleIn 0.8s ease-out;
}

/* ===== STAGGER ANIMATIONS ===== */

.stagger-item {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s ease-out;
}

.stagger-item.animate-in {
    animation: slideInFromBottom 0.6s ease-out;
}

.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; }

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

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

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

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

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

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(45, 90, 39, 0.3);
}

/* ===== BUTTON ANIMATIONS ===== */

.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

.btn-slide {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.btn-slide:hover::before {
    left: 100%;
}

/* ===== LOADING ANIMATIONS ===== */

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

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

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

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== PARALLAX EFFECTS ===== */

.parallax {
    transform: translateZ(0);
    transition: transform 0.1s ease-out;
}

.parallax-slow {
    transform: translateY(var(--parallax-offset-slow, 0));
}

.parallax-medium {
    transform: translateY(var(--parallax-offset-medium, 0));
}

.parallax-fast {
    transform: translateY(var(--parallax-offset-fast, 0));
}

/* ===== TYPEWRITER EFFECT ===== */

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

/* ===== GRADIENT ANIMATIONS ===== */

.gradient-shift {
    background: linear-gradient(-45deg, var(--color-primary), var(--color-accent), var(--color-primary-light), var(--color-accent-light));
    background-size: 400% 400%;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===== MORPHING ANIMATIONS ===== */

.morph {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.morph:hover {
    border-radius: 50%;
    transform: rotate(180deg);
}

/* ===== TEXT ANIMATIONS ===== */

.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-primary);
    transform: translateX(-100%);
    animation: textReveal 1s ease-out forwards;
}

@keyframes textReveal {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(100%);
    }
}

.text-glow {
    transition: text-shadow 0.3s ease;
}

.text-glow:hover {
    text-shadow: 0 0 20px rgba(45, 90, 39, 0.5);
}

/* ===== CARD FLIP ANIMATIONS ===== */

.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

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

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius-lg);
}

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

/* ===== PROGRESS ANIMATIONS ===== */

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 2px;
    transform: translateX(-100%);
    animation: progressFill 2s ease-out forwards;
}

@keyframes progressFill {
    to {
        transform: translateX(0);
    }
}

/* ===== ELASTIC ANIMATIONS ===== */

.elastic {
    animation: elastic 2s ease-out;
}

@keyframes elastic {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    75% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* ===== REDUCED MOTION SUPPORT ===== */

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .stagger-item {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }
    
    .parallax,
    .parallax-slow,
    .parallax-medium,
    .parallax-fast {
        transform: none;
    }
    
    .typewriter {
        animation: none;
        border-right: none;
        white-space: normal;
        overflow: visible;
    }
    
    .gradient-shift {
        animation: none;
    }
    
    .float {
        animation: none;
    }
}

