/**
 * loading-overlay.css
 * Custom loading overlay with Palladium logo animation
 * Inspired by Strem.io loading screens
 */

.palladium-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 1rem;
}

.palladium-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.palladium-loading-overlay[aria-hidden="true"] {
    pointer-events: none;
}

.palladium-button-loading {
    cursor: wait;
}

.palladium-button-spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-right: 0.5em;
    vertical-align: -0.1em;
    border: 0.12em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: palladiumButtonSpin 0.7s linear infinite;
}

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

.palladium-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: min(90vw, 24rem);
    text-align: center;
}

.palladium-loading-logo-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.palladium-loading-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    z-index: 2;
    animation: logoBreathing 2.5s ease-in-out infinite;
}

/* Animated rings around the logo */
.palladium-loading-ring {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: ringBreathing 2.5s ease-in-out infinite;
}

.palladium-loading-ring:nth-child(1) {
    width: 100%;
    height: 100%;
    animation-delay: 0s;
}

.palladium-loading-ring:nth-child(2) {
    width: 120%;
    height: 120%;
    animation-delay: 0.2s;
}

.palladium-loading-ring:nth-child(3) {
    width: 140%;
    height: 140%;
    animation-delay: 0.4s;
}

/* Spinning gradient ring */
.palladium-loading-spinner {
    position: absolute;
    width: 110%;
    height: 110%;
    border: 3px solid transparent;
    border-top-color: rgba(13, 110, 253, 0.6);
    border-right-color: rgba(13, 110, 253, 0.3);
    border-radius: 50%;
    animation: spinRotate 2s linear infinite;
}

.palladium-loading-text {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    margin: 0;
    animation: textBreathing 2.5s ease-in-out infinite;
}

.palladium-loading-subtext {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
    margin-top: -1rem;
}

/* Loading dots animation */
.palladium-loading-dots {
    display: inline-flex;
    gap: 0.4rem;
    margin-left: 0.3rem;
}

.palladium-loading-dots span {
    width: 6px;
    height: 6px;
    background-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    animation: dotBounce 1.4s infinite ease-in-out both;
}

.palladium-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.palladium-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Keyframe animations */
@keyframes logoBreathing {
    0% {
        opacity: 0.15;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 0.15;
        transform: scale(0.95);
    }
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-8px) scale(1.05);
    }
}

@keyframes ringPulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

@keyframes ringBreathing {
    0% {
        transform: scale(0.95);
        opacity: 0.05;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.25;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.05;
    }
}

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

@keyframes textFade {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes textBreathing {
    0% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.4;
    }
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .palladium-loading-logo-container {
        width: 100px;
        height: 100px;
    }

    .palladium-loading-logo {
        width: 65px;
        height: 65px;
    }

    .palladium-loading-text {
        font-size: 1rem;
    }

    .palladium-loading-subtext {
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .palladium-loading-overlay,
    .palladium-loading-logo,
    .palladium-loading-ring,
    .palladium-loading-spinner,
    .palladium-loading-text,
    .palladium-loading-dots span {
        animation: none;
        transition: none;
    }

    .palladium-button-spinner {
        animation: none;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .palladium-loading-overlay {
        background: rgba(0, 0, 0, 0.92);
    }
}
