/* Fullscreen Overlay */
#preloader {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-light);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

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

/* Loader Wrapper */
.loader {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Rings */
.loader span {
    position: absolute;
    border: 4px solid transparent;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 100%;
    height: 100%;
    animation: spin 1.2s linear infinite;
}

.loader span:nth-child(2) {
    border-top-color: var(--color-secondary);
    animation-delay: 0.2s;
}

.loader span:nth-child(3) {
    border-top-color: var(--color-accent);
    animation-delay: 0.4s;
}

.loader span:nth-child(4) {
    border-top-color: var(--color-warm);
    animation-delay: 0.6s;
}

/* Centered Text */
.loader-text {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-secondary);
    letter-spacing: 2px;
    animation: fadePulse 1.5s infinite ease-in-out;
}

/* Spin Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg) scale(0.9);
        opacity: 0.6;
    }

    50% {
        transform: rotate(180deg) scale(1.05);
        opacity: 1;
    }

    100% {
        transform: rotate(360deg) scale(0.9);
        opacity: 0.6;
    }
}

/* Pulse effect for text */
@keyframes fadePulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}
