.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, 
                rgba(17, 24, 39, 0.95) 0%, 
                rgba(31, 41, 55, 0.95) 50%, 
                rgba(55, 65, 81, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.spinner-container {
    width: 6rem;
    height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, 
                rgba(99, 102, 241, 0.3) 0%, 
                rgba(168, 85, 247, 0.3) 50%, 
                rgba(236, 72, 153, 0.3) 100%);
    border-radius: 50%;
    position: relative;
    box-shadow: 
        0 0 40px rgba(99, 102, 241, 0.6),
        0 0 80px rgba(168, 85, 247, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    animation: pulse-container 3s ease-in-out infinite;
}

.spinner-container::before {
    content: '';
    position: absolute;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, 
                transparent 0deg, 
                rgba(99, 102, 241, 0.4) 60deg, 
                rgba(168, 85, 247, 0.4) 120deg, 
                rgba(236, 72, 153, 0.4) 180deg, 
                transparent 240deg, 
                transparent 360deg);
    animation: rotate 4s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-container {
    0%, 100% {
        box-shadow: 
            0 0 40px rgba(99, 102, 241, 0.6),
            0 0 80px rgba(168, 85, 247, 0.4),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 60px rgba(99, 102, 241, 0.8),
            0 0 120px rgba(168, 85, 247, 0.6),
            0 0 160px rgba(236, 72, 153, 0.4),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }
}

.spinner-border {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.6));
}

.loading-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
    text-shadow: 
        0 0 20px rgba(99, 102, 241, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
    background: linear-gradient(135deg, 
                rgba(255, 255, 255, 1) 0%, 
                rgba(168, 85, 247, 0.9) 50%, 
                rgba(99, 102, 241, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-subtext {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    text-align: center;
    max-width: 400px;
    margin-bottom: 2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    font-weight: 400;
    line-height: 1.4;
}

/* Progress bar */
.loading-overlay .progress {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-overlay .progress-bar {
    background: linear-gradient(90deg, 
                rgba(99, 102, 241, 1) 0%, 
                rgba(168, 85, 247, 1) 50%, 
                rgba(236, 72, 153, 1) 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
    border-radius: 10px;
}

/* Dot animation for the loading indicator */
.loading-dots::after {
    display: inline-block;
    animation: dotty steps(1, end) 1.5s infinite;
    content: '';
}

@keyframes dotty {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

/* Pulsing animation for buttons */
@keyframes pulse-button {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    70% {
        transform: scale(1.03);
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.pulse-animation {
    animation: pulse-button 1.5s infinite;
}

/* Mobile adjustments */
@media (max-width: 767.98px) {
    .loading-text {
        font-size: 1.3rem;
        letter-spacing: 0.5px;
    }
    
    .loading-subtext {
        font-size: 0.9rem;
        max-width: 320px;
        margin-bottom: 1.5rem;
    }
    
    .spinner-container {
        width: 5rem;
        height: 5rem;
        margin-bottom: 1.5rem;
    }
    
    .loading-overlay .progress {
        width: 90%;
        max-width: 300px;
    }
}