/* Weather Alert Animations - Flashing and Attention-Grabbing Effects */

/* Flash Animation - Creates a pulsing light effect */
@keyframes weatherFlash {
    0%, 100% {
        opacity: 0;
    }
    10%, 30%, 50%, 70%, 90% {
        opacity: 0.8;
    }
    20%, 40%, 60%, 80% {
        opacity: 0;
    }
}

/* Detailed Flash Animation - Slower and more prominent */
@keyframes weatherFlashDetailed {
    0%, 100% {
        opacity: 0;
    }
    15%, 45%, 75% {
        opacity: 0.9;
    }
    30%, 60%, 90% {
        opacity: 0.2;
    }
}

/* Icon Pulse - Makes weather icons throb */
@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

/* Icon Bounce - Makes icons bounce up and down */
@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Icon Rotate - Spins icons gently */
@keyframes iconRotate {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

/* Icon Wiggle - Creates a shake effect */
@keyframes iconWiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
    75% {
        transform: rotate(-5deg);
    }
}

/* Icon Shake - Alert shake animation */
@keyframes iconShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Text Glow - Makes text glow periodically */
@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(59, 130, 246, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.5);
    }
}

/* Temperature Pulse - Scales temperature display */
@keyframes tempPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(251, 146, 60, 0.4);
    }
}

/* Alert Badge Pulse */
@keyframes alertBadgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* Card Border Glow */
@keyframes cardBorderGlow {
    0%, 100% {
        border-color: rgb(147, 197, 253);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    50% {
        border-color: rgb(59, 130, 246);
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4), 0 0 20px rgba(59, 130, 246, 0.3);
    }
}

/* Condition Card Slide */
@keyframes conditionSlide {
    0% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}

/* Apply Animations to Elements */

/* Flash overlay on weather cards */
.weather-flash {
    animation: weatherFlash 3s ease-in-out infinite;
}

.weather-flash-detailed {
    animation: weatherFlashDetailed 4s ease-in-out infinite;
}

/* Weather icon animations */
.weather-icon-pulse {
    animation: iconPulse 2s ease-in-out infinite;
    display: inline-block;
}

.weather-icon-bounce {
    animation: iconBounce 2.5s ease-in-out infinite;
    display: inline-block;
}

.weather-icon-rotate {
    animation: iconRotate 3s ease-in-out infinite;
    display: inline-block;
}

.weather-icon-wiggle {
    animation: iconWiggle 2s ease-in-out infinite;
    display: inline-block;
}

.weather-icon-shake {
    animation: iconShake 1.5s ease-in-out infinite;
    display: inline-block;
}

/* Text glow effect */
.weather-text-glow {
    animation: textGlow 3s ease-in-out infinite;
}

/* Temperature pulse */
.weather-temp-pulse {
    animation: tempPulse 2s ease-in-out infinite;
    display: inline-block;
}

/* Alert badge animation */
.weather-alert-badge {
    animation: alertBadgePulse 2s ease-in-out infinite;
}

/* Weather alert card effects */
.weather-alert-card {
    animation: cardBorderGlow 3s ease-in-out infinite;
    position: relative;
}

/* Weather condition card slide */
.weather-condition-card {
    animation: conditionSlide 4s ease-in-out infinite;
}

/* Temperature card effects */
.weather-temp-card {
    animation: conditionSlide 4.5s ease-in-out infinite;
}

/* Hover effects to pause animations */
.weather-alert-card:hover .weather-flash,
.weather-alert-card:hover .weather-flash-detailed {
    animation-play-state: paused;
}

.weather-alert-card:hover .weather-icon-pulse,
.weather-alert-card:hover .weather-icon-bounce,
.weather-alert-card:hover .weather-icon-rotate,
.weather-alert-card:hover .weather-icon-wiggle {
    animation-play-state: paused;
}

/* Make alerts more prominent on mobile */
@media (max-width: 640px) {
    .weather-alert-card {
        border-width: 3px;
    }
    
    .weather-icon-pulse,
    .weather-icon-bounce,
    .weather-icon-rotate,
    .weather-icon-wiggle {
        font-size: 1.5rem;
    }
    
    .weather-alert-badge {
        animation-duration: 1.5s;
    }
}

/* Accessibility - Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .weather-flash,
    .weather-flash-detailed,
    .weather-icon-pulse,
    .weather-icon-bounce,
    .weather-icon-rotate,
    .weather-icon-wiggle,
    .weather-icon-shake,
    .weather-text-glow,
    .weather-temp-pulse,
    .weather-alert-badge,
    .weather-alert-card,
    .weather-condition-card,
    .weather-temp-card {
        animation: none !important;
    }
    
    /* Still maintain visual prominence without motion */
    .weather-alert-card {
        border-width: 3px;
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
    }
    
    .weather-alert-badge {
        transform: scale(1.05);
    }
}

/* Print styles - Remove animations */
@media print {
    .weather-flash,
    .weather-flash-detailed,
    .weather-alert-badge {
        display: none;
    }
    
    .weather-alert-card {
        animation: none;
        border: 2px solid #000;
    }
}
