/* ==========================================
   GoGreenThinkTank - Advanced Animations
   ========================================== */

/* Scroll-triggered animations */
@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(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@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% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(135, 169, 107, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(135, 169, 107, 0.8);
    }
    100% {
        box-shadow: 0 0 5px rgba(135, 169, 107, 0.5);
    }
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 0.5;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Counter animation */
@keyframes countUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Parallax scrolling effect */
@keyframes parallaxScroll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50px);
    }
}

/* Card hover effects */
@keyframes cardLift {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 20px 25px -5px rgba(135, 169, 107, 0.2);
    }
}

/* Loading spinner */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Gradient animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Text reveal animation */
@keyframes textReveal {
    0% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}

/* Stagger animations for lists */
.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Animation classes */
.animate-fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease forwards;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-wiggle {
    animation: wiggle 1s ease-in-out;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-gradient {
    background: linear-gradient(-45deg, #87A96B, #4A90A4, #B8E6B8, #FF8A80);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Hover animations */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(135, 169, 107, 0.2);
}

.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-tilt {
    transition: transform 0.3s ease;
}

.hover-tilt:hover {
    transform: perspective(1000px) rotateX(10deg) rotateY(-10deg);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Scroll indicators */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(135, 169, 107, 0.2);
    z-index: 9999;
}

.scroll-progress {
    height: 100%;
    background: linear-gradient(90deg, #87A96B, #4A90A4);
    width: 0%;
    transition: width 0.3s ease;
}

/* Intersection Observer animations */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left-on-scroll {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-left-on-scroll.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right-on-scroll {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-right-on-scroll.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in-on-scroll {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in-on-scroll.visible {
    opacity: 1;
    transform: scale(1);
}

/* Counter animations */
.counter {
    font-weight: bold;
    font-size: 2rem;
}

.counter.animate {
    animation: countUp 1s ease forwards;
}

/* Button ripple effect */
.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;
}

/* Carousel animations */
.carousel-slide {
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.carousel-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.carousel-slide.prev {
    transform: translateX(-100%);
}

/* Form animations */
.form-input {
    transition: all 0.3s ease;
}

.form-input:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(135, 169, 107, 0.1);
}

.form-label {
    transition: all 0.3s ease;
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    transform: translateY(-1.5rem) scale(0.85);
    color: #87A96B;
}

/* Error 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 ease-in-out;
}

/* Success pulse animation */
@keyframes successPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-pulse {
    animation: successPulse 0.6s ease-in-out;
}

/* Mobile-specific animations */
@media (max-width: 768px) {
    /* Reduce motion for mobile performance */
    .parallax-layer {
        transform: none !important;
        background-attachment: scroll;
    }
    
    /* Simplified hover effects for touch devices */
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover,
    .hover-tilt:hover {
        transform: none;
    }
}

/* Reduced motion preferences */
@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;
    }
    
    .parallax-layer {
        transform: none !important;
    }
}

/* ========================================== 
   Additional animation classes for data-attributes
   ========================================== */

/* Core animation classes that can be triggered by JavaScript */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-down {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-down.visible {
    opacity: 1;
    transform: translateY(0);
}

.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);
}
