/**
 * Weather Widget Loading States CSS
 * Loading animations and smooth transitions
 */

/* ============================================
   LOADING STATE
   ============================================ */

.weather-widget-loading {
    position: relative;
    min-height: 200px;
}

.weather-loading-state {
    animation: fadeIn 0.3s ease;
}

.weather-spinner {
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Pulsing animation for loading icon */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   SMOOTH TRANSITIONS
   ============================================ */

.weather-widget {
    transition: all 0.4s ease;
}

.weather-content {
    transition: opacity 0.3s ease;
}

/* Slide in animation for loaded content */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.weather-widget:not(.weather-widget-loading) .weather-content {
    animation: slideInUp 0.5s ease forwards;
}

/* ============================================
   ERROR STATE
   ============================================ */

.weather-widget-error {
    opacity: 0.7;
}

.weather-widget-error i {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* ============================================
   SKELETON LOADING (Alternative)
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-circle {
    border-radius: 50%;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .weather-widget-loading {
        min-height: 150px;
    }
    
    .weather-spinner i {
        font-size: 2rem !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .weather-spinner,
    .weather-loading-state,
    .weather-content,
    .animate-pulse {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATION
   ============================================ */

.weather-widget-loading .weather-animation-container {
    display: none; /* Don't render animations during loading */
}

.weather-widget:not(.weather-widget-loading) .weather-loading-state {
    display: none; /* Hide loading state when loaded */
}

