/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 50%, #3B82F6 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.loading-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(96, 165, 250, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(147, 197, 253, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
    animation: floatBubbles 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes floatBubbles {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.8; }
    50% { transform: translateY(-20px) scale(1.05); opacity: 1; }
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Loading Container */
.loading-container {
    text-align: center;
    animation: fadeInScale 0.6s ease;
    position: relative;
    z-index: 1;
}

/* Loading GIF */
.loading-gif {
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
    animation: float 3s ease-in-out infinite;
}

.loading-gif img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(96, 165, 250, 0.6)) drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

/* Animated Loading Text */
.loading-text {
    font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 2.8rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: 14px;
    text-transform: uppercase;
    position: relative;
    text-shadow: 
        0 0 20px rgba(96, 165, 250, 0.8),
        0 0 40px rgba(59, 130, 246, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 0 80px rgba(147, 197, 253, 0.3);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Letter animation - wave effect */
.loading-text span {
    display: inline-block;
    animation: glowWave 1.5s ease-in-out infinite;
}

.loading-text span:nth-child(1) { animation-delay: 0s; }
.loading-text span:nth-child(2) { animation-delay: 0.1s; }
.loading-text span:nth-child(3) { animation-delay: 0.2s; }
.loading-text span:nth-child(4) { animation-delay: 0.3s; }
.loading-text span:nth-child(5) { animation-delay: 0.4s; }
.loading-text span:nth-child(6) { animation-delay: 0.5s; }
.loading-text span:nth-child(7) { animation-delay: 0.6s; }

/* Animated dots after LOADING */
.loading-dots {
    display: inline-block;
    width: 40px;
    text-align: left;
    color: #FFFFFF;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

@keyframes glowWave {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 1;
        text-shadow: 
            0 0 20px rgba(96, 165, 250, 0.8),
            0 0 40px rgba(59, 130, 246, 0.5),
            0 4px 8px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: translateY(-20px) scale(1.15);
        opacity: 0.9;
        text-shadow: 
            0 0 30px rgba(147, 197, 253, 1),
            0 0 60px rgba(96, 165, 250, 0.8),
            0 0 100px rgba(59, 130, 246, 0.6),
            0 6px 12px rgba(0, 0, 0, 0.4);
    }
}

/* Float animation for GIF */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-15px) rotate(5deg);
    }
    66% {
        transform: translateY(-10px) rotate(-5deg);
    }
}

/* Fade in scale animation */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Progress bar */
.loading-progress {
    margin-top: 35px;
    width: 400px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #60A5FA, #93C5FD, #BFDBFE, #93C5FD, #60A5FA);
    background-size: 300% 100%;
    animation: progressSlide 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    border-radius: 20px;
    box-shadow: 
        0 0 20px rgba(96, 165, 250, 0.8),
        0 0 40px rgba(147, 197, 253, 0.6),
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

@keyframes progressSlide {
    0% {
        background-position: 0% 0%;
        width: 0%;
    }
    50% {
        background-position: 100% 0%;
        width: 100%;
    }
    100% {
        background-position: 0% 0%;
        width: 0%;
    }
}

/* Spinner (fallback if no GIF) */
.loading-spinner {
    width: 80px;
    height: 80px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid #60A5FA;
    border-right: 5px solid #93C5FD;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin: 0 auto 40px;
    box-shadow: 
        0 0 30px rgba(96, 165, 250, 0.6),
        0 0 60px rgba(59, 130, 246, 0.4),
        inset 0 0 20px rgba(96, 165, 250, 0.3);
    position: relative;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

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

/* Responsive */
@media (max-width: 768px) {
    .loading-gif {
        width: 90px;
        height: 90px;
        margin-bottom: 30px;
    }
    
    .loading-text {
        font-size: 2rem;
        letter-spacing: 8px;
    }
    
    .loading-progress {
        width: 280px;
    }
    
    .loading-spinner {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .loading-gif {
        width: 70px;
        height: 70px;
    }
    
    .loading-text {
        font-size: 1.5rem;
        letter-spacing: 6px;
    }
    
    .loading-progress {
        width: 220px;
        height: 4px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
}
