/* Particle animations for AQI popup circles */

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: float 8s ease-in-out infinite;
    will-change: transform, opacity;
}

.particle:nth-child(odd) {
    animation: float-reverse 10s ease-in-out infinite;
}

.particle:nth-child(3n) {
    animation: drift 12s ease-in-out infinite;
}

.particle:nth-child(4n) {
    animation: drift-reverse 14s ease-in-out infinite;
}

.particle:nth-child(5n) {
    animation: float-slow 16s ease-in-out infinite;
}

/* White transparent particles with varied sizes for all AQI levels */
.particle.aqi-1 {
    /* Good - few particles */
    background: rgba(255, 255, 255, 0.3);
    animation-duration: 12s;
}

.particle.aqi-2 {
    /* Good - few particles */
    background: rgba(255, 255, 255, 0.35);
    animation-duration: 10s;
}

.particle.aqi-3 {
    /* Moderate - more particles */
    background: rgba(255, 255, 255, 0.4);
    animation-duration: 8s;
}

.particle.aqi-4 {
    /* Poor - many particles */
    background: rgba(255, 255, 255, 0.45);
    animation-duration: 6s;
}

.particle.aqi-5 {
    /* Very Poor - dense particles */
    background: rgba(255, 255, 255, 0.5);
    animation-duration: 5s;
}

.particle.aqi-6 {
    /* Hazardous - very dense particles */
    background: rgba(255, 255, 255, 0.55);
    animation-duration: 4s;
}

/* Varied particle sizes applied via nth-child selectors */
.particle:nth-child(3n) {
    width: 2px;
    height: 2px;
}

.particle:nth-child(4n) {
    width: 3px;
    height: 3px;
}

.particle:nth-child(5n) {
    width: 4px;
    height: 4px;
}

.particle:nth-child(6n) {
    width: 5px;
    height: 5px;
}

.particle:nth-child(7n) {
    width: 6px;
    height: 6px;
}

.particle:nth-child(8n) {
    width: 7px;
    height: 7px;
}

.particle:nth-child(9n) {
    width: 8px;
    height: 8px;
}

/* Animation keyframes */
@keyframes float {
    0% {
        transform: translateY(100%) translateX(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    50% {
        transform: translateY(-20%) translateX(10px) scale(1);
        opacity: 0.8;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-100%) translateX(-5px) scale(0.3);
        opacity: 0;
    }
}

@keyframes float-reverse {
    0% {
        transform: translateY(100%) translateX(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    50% {
        transform: translateY(-20%) translateX(-10px) scale(1);
        opacity: 0.8;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-100%) translateX(5px) scale(0.3);
        opacity: 0;
    }
}

@keyframes drift {
    0% {
        transform: translateY(100%) translateX(-20px) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    50% {
        transform: translateY(-10%) translateX(20px) scale(1);
        opacity: 0.8;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-100%) translateX(-10px) scale(0.3);
        opacity: 0;
    }
}

@keyframes drift-reverse {
    0% {
        transform: translateY(100%) translateX(20px) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    50% {
        transform: translateY(-10%) translateX(-20px) scale(1);
        opacity: 0.8;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-100%) translateX(10px) scale(0.3);
        opacity: 0;
    }
}

@keyframes float-slow {
    0% {
        transform: translateY(100%) translateX(0) scale(0.3);
        opacity: 0;
    }

    10% {
        opacity: 0.5;
    }

    50% {
        transform: translateY(-30%) translateX(0) scale(0.8);
        opacity: 0.7;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-100%) translateX(0) scale(0.2);
        opacity: 0;
    }
}

/* Performance optimizations */
.particles-container * {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .particle {
        animation: none !important;
        opacity: 0.3 !important;
    }
}

/* Favorites Star Icon Animations */
.star-icon,
.share-icon {
    transition: all 0.3s ease;
    display: inline-block;
    transform-origin: center;
}


/* Corner Star Icon Styling */
.star-icon-corner,
.share-icon-corner {
    transition: all 0.3s ease;
    display: inline-block;
    transform-origin: center;
    font-size: 26px;
    line-height: 1;
}



/* Responsive positioning for mobile */
@media (max-width: 768px) {

    .star-icon-corner,
    .share-icon-corner {
        font-size: 26px;
        padding: 4px;
    }
}

/* Star animation keyframes */
@keyframes star-glow {
    0% {
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.6));
        transform: scale(1);
    }

    100% {
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.9));
        transform: scale(1.05);
    }
}

@keyframes star-pop {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

    100% {
        transform: scale(0.8);
        opacity: 0.3;
    }
}

/* Favorites Modal Animations */
.favorite-item {
    transition: all 0.3s ease;
    border-left: 3px solid;
}

.favorite-item:hover {
    border-left-color: #FFD700;
    background-color: rgba(255, 215, 0, 0.05);
    transform: translateX(5px);
}

.favorite-item.removing {
    animation: slide-out-right 0.5s ease-out forwards;
}

@keyframes slide-out-right {
    0% {
        transform: translateX(0);
        opacity: 1;
        max-height: 100px;
    }

    100% {
        transform: translateX(100%);
        opacity: 0;
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

/* Favorites Button Animation */
.command-favorites {
    transition: all 0.3s ease;
}

.command-favorites:active {
    transform: scale(0.95);
}

/* Language Button - Prevent hover cross-contamination */
#top_language .btn,
#top_language button,
.dropdown-toggle,
.country-dropdown {
    transform: none !important;
}

#top_language .btn:hover,
#top_language button:hover,
.dropdown-toggle:hover,
.country-dropdown:hover {
    transform: none !important;
    scale: none !important;
}

/* Notification Animations */
.alert-favorites {
    animation: slide-in-right 0.5s ease-out;
}

@keyframes slide-in-right {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Favorites Count Badge Animation */
.favorites-count-badge {
    transition: all 0.3s ease;
    animation: pulse 0.6s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Loading Animation for Favorites */
.favorites-loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Smooth transitions for all interactive elements */
.btn-favorites {
    transition: all 0.2s ease;
}

.btn-favorites:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-favorites:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}