/* Loading Animation Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4F46E5 0%, #9333EA 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out, transform 0.3s ease-out;
}

body:has(.loading-screen:not(.fade-out)) {
    overflow: hidden;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out, transform 0.3s ease-out;
}

.loading-animation {
    width: 80px;
    height: 80px;
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.loading-animation div {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-animation div:nth-child(1) {
    left: 8px;
    animation: loading-animation1 0.6s infinite;
}

.loading-animation div:nth-child(2) {
    left: 8px;
    animation: loading-animation2 0.6s infinite;
}

.loading-animation div:nth-child(3) {
    left: 32px;
    animation: loading-animation2 0.6s infinite;
}

.loading-animation div:nth-child(4) {
    left: 56px;
    animation: loading-animation3 0.6s infinite;
}

@keyframes loading-animation1 {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes loading-animation3 {
    0% { transform: scale(1); }
    100% { transform: scale(0); }
}

@keyframes loading-animation2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(24px, 0); }
}

.loading-text {
    position: absolute;
    bottom: 30%;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
    animation: fadeText 1.5s infinite;
}

@keyframes fadeText {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

/* History Modal Loading Animation */
#historyLoadingAnimation .loading-animation {
    width: 60px;
    height: 60px;
}

#historyLoadingAnimation .loading-text {
    position: static;
    color: #6B7280;
    font-size: 1rem;
    font-weight: 500;
    animation: none;
    opacity: 1;
}