#loading {
    position: relative;
    top: 10px;
    left: 50%; 
    display: inline-flex; 
    justify-content: center;
    align-items: center;
    text-align: center;
    max-width: fit-content;
    margin-right: 60px;
    margin-left: 60px;
    padding: 20px 20px; 
    border: 4px solid transparent; 
    border-radius: 12px; /* Rounded corners */
    transition: opacity 0.5s ease-out;
    animation: loading_pulse 1s infinite, borderGradient 1s linear infinite; /* Combined animations */
    width: auto; 
    box-sizing: border-box;
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), /* Inner background */
                      linear-gradient(to right, #00d4ff, #ff007a, #00d4ff);
    background-clip: padding-box, border-box; 
    background-origin: border-box; 
    background-size: 200% 100%; 
}

#loading.hidden {
    opacity: 0;
    visibility: hidden;
}

@keyframes borderGradient {
    0% {
        background-position: 0% 50%; /* Start at the left */
    }
    50% {
        background-position: 100% 50%; /* Move to the right */
    }
    100% {
        background-position: 0% 50%; /* Return to the left */
    }
}


/* Keyframes for Pulse with Size Change */
@keyframes loading_pulse {
    0% { 
        opacity: 1; 
        transform: translateX(-50%) translateX(-60px) scale(1); /* Base size */
    }
    50% { 
        opacity: 0.95; 
        transform: translateX(-50%) translateX(-60px) scale(0.96);
    }
    100% { 
        opacity: 1; 
        transform: translateX(-50%) translateX(-60px) scale(1); /* Back to base size */
    }
}