/* Animated Loading Indicators with Playful Character Designs */

/* Heart-beating loader for donations */
.heart-loader {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.heart-loader div {
    position: absolute;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ff6b6b;
    animation: heart-beat 1.2s infinite ease-in-out both;
}

.heart-loader div:nth-child(1) { animation-delay: -0.24s; }
.heart-loader div:nth-child(2) { animation-delay: -0.12s; }
.heart-loader div:nth-child(3) { animation-delay: 0; }

@keyframes heart-beat {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Helping hands loader */
.helping-hands {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.helping-hands::before,
.helping-hands::after {
    content: '🤝';
    position: absolute;
    font-size: 2rem;
    animation: hands-wave 2s infinite ease-in-out;
}

.helping-hands::before {
    top: 0;
    left: 0;
    animation-delay: 0s;
}

.helping-hands::after {
    top: 20px;
    left: 20px;
    animation-delay: 1s;
}

@keyframes hands-wave {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(15deg) scale(1.1);
        opacity: 0.7;
    }
}

/* Coin donation loader */
.coin-loader {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.coin-loader div {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    animation: coin-drop 1.5s infinite ease-in-out;
}

.coin-loader div:nth-child(1) {
    left: 8px;
    animation-delay: 0s;
}

.coin-loader div:nth-child(2) {
    left: 32px;
    animation-delay: -0.5s;
}

.coin-loader div:nth-child(3) {
    left: 56px;
    animation-delay: -1s;
}

@keyframes coin-drop {
    0%, 100% {
        top: 8px;
        height: 64px;
        opacity: 1;
    }
    50% {
        top: 24px;
        height: 32px;
        opacity: 0.7;
    }
}

/* Care rainbow loader */
.care-rainbow {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 40px;
}

.care-rainbow div {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: rainbow-bounce 1.4s infinite ease-in-out both;
}

.care-rainbow div:nth-child(1) {
    left: 8px;
    background: #ff6b6b;
    animation-delay: -0.32s;
}

.care-rainbow div:nth-child(2) {
    left: 24px;
    background: #ffa726;
    animation-delay: -0.16s;
}

.care-rainbow div:nth-child(3) {
    left: 40px;
    background: #66bb6a;
    animation-delay: 0s;
}

.care-rainbow div:nth-child(4) {
    left: 56px;
    background: #42a5f5;
    animation-delay: 0.16s;
}

@keyframes rainbow-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Hope star loader */
.hope-stars {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.hope-stars::before,
.hope-stars::after {
    content: '⭐';
    position: absolute;
    font-size: 1.5rem;
    animation: star-twinkle 2s infinite ease-in-out;
}

.hope-stars::before {
    top: 10px;
    left: 10px;
    animation-delay: 0s;
}

.hope-stars::after {
    top: 30px;
    left: 40px;
    animation-delay: 1s;
}

@keyframes star-twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
}

/* Loading overlay component */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content h3 {
    margin-top: 20px;
    font-weight: 600;
    color: #81c784;
}

.loading-content p {
    margin-top: 10px;
    opacity: 0.8;
    font-size: 1rem;
}

/* Dark theme adjustments */
[data-theme="dark"] .loading-overlay {
    background: rgba(26, 26, 26, 0.9);
}

[data-theme="dark"] .loading-content h3 {
    color: #81c784;
}

[data-theme="dark"] .loading-content p {
    color: #e2e8f0;
}

/* Page transition loader */
.page-loader {
    display: inline-block;
    margin: 20px auto;
    text-align: center;
}

/* Button loading states */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: button-spin 1s linear infinite;
}

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

/* Campaign card loading skeleton */
.campaign-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 15px;
    height: 400px;
    margin-bottom: 2rem;
}

[data-theme="dark"] .campaign-skeleton {
    background: linear-gradient(90deg, #2d2d2d 25%, #404040 50%, #2d2d2d 75%);
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Donation progress loader */
.donation-progress {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 60px;
}

.donation-progress::before {
    content: '💝';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    animation: gift-pulse 1.5s infinite ease-in-out;
}

@keyframes gift-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Success celebration animation */
.success-celebration {
    display: inline-block;
    position: relative;
    width: 100px;
    height: 100px;
}

.success-celebration::before {
    content: '🎉';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    animation: celebration-bounce 0.6s infinite alternate;
}

@keyframes celebration-bounce {
    0% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) scale(1.1) rotate(10deg);
    }
}

/* Utility classes */
.loader-small {
    transform: scale(0.7);
}

.loader-large {
    transform: scale(1.3);
}

.text-loading {
    opacity: 0.6;
    animation: text-fade 1.5s infinite alternate;
}

@keyframes text-fade {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}