/* Global Forest Impact Enhanced Animations */

/* Stats Container Animations */
.stats-container {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.stats-container.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Individual Stat Items */
.stat-item {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Enhanced Stat Number Styling */
.stat-number {
    position: relative;
    font-weight: 800;
    background: linear-gradient(135deg, #B7E4C7 0%, #52B788 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(183, 228, 199, 0.5);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.stat-item.stat-visible .stat-number {
    animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    }
    50% {
        filter: drop-shadow(0 4px 16px rgba(183, 228, 199, 0.6));
    }
}

/* World Map Animations */
.world-map {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
}

.world-map.animated {
    opacity: 1;
    transform: translateY(0);
}

/* SVG Path Animations */
.country-path {
    opacity: 0;
    transform-origin: center;
    transition: all 0.5s ease;
}

.country-path.path-visible {
    opacity: 1;
    animation: fade-in-scale 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fade-in-scale {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Circle Pulse Animation */
.country-path[cx].pulse-animation {
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}

/* Connection Lines Animation */
#world-map-svg line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0;
}

#world-map-svg line.line-visible {
    animation: draw-line 1.5s ease forwards;
}

@keyframes draw-line {
    to {
        stroke-dashoffset: 0;
        opacity: 0.3;
    }
}

/* Enhanced Interactive Hover Effects */
.country-path:hover {
    filter: brightness(1.3);
    cursor: pointer;
    transform: scale(1.05);
    transition: all 0.3s ease;
}

/* Progress Circle Animation for Stats */
.stat-item::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #52B788;
    opacity: 0;
    transition: opacity 0.5s ease 0.3s;
}

.stat-item.stat-visible::before {
    opacity: 0.3;
    animation: rotate-circle 3s linear infinite;
}

@keyframes rotate-circle {
    100% {
        transform: translateX(-50%) rotate(360deg);
    }
}

/* Background Gradient Animation */
.global-impact-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        circle at 50% 50%,
        rgba(183, 228, 199, 0.1) 0%,
        transparent 70%
    );
    opacity: 0;
    animation: pulse-background 4s ease-in-out infinite;
}

@keyframes pulse-background {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Tooltip Enhancement */
.impact-tooltip {
    animation: tooltip-appear 0.3s ease;
}

@keyframes tooltip-appear {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .stat-item {
        margin-bottom: 20px;
    }

    .country-path:hover {
        transform: scale(1.02);
    }

    .stat-number {
        font-size: 2.5rem;
    }
}

/* Additional Visual Effects */
.stats-container::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #52B788, transparent);
    opacity: 0;
    transition: opacity 0.8s ease 1s;
}

.stats-container.animated::after {
    opacity: 1;
}

/* Map Container Glow Effect */
.map-container {
    position: relative;
}

.map-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(
        circle,
        rgba(82, 183, 136, 0.2) 0%,
        transparent 70%
    );
    border-radius: 50%;
    opacity: 0;
    animation: map-glow 4s ease-in-out infinite;
}

@keyframes map-glow {
    0%, 100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Loading state for numbers during counting */
.stat-number.counting {
    animation: number-pulse 0.5s ease infinite;
}

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