/* --- PRELOADER WRAPPER --- */
#nexus-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #020202;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
}

#nexus-preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- ANIMATED RINGS --- */
.loader-ring {
    position: relative;
    width: 20vw; /* responsive */
    max-width: 120px;
    height: 20vw; /* responsive */
    max-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring-1 {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #4f46e5;
    border-right-color: rgba(79, 70, 229, 0.3);
    animation: spin 3s linear infinite;
}

.ring-2 {
    position: absolute;
    width: 70%;
    height: 70%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-bottom-color: #06b6d4;
    border-left-color: rgba(6, 182, 212, 0.3);
    animation: spin-reverse 1.5s linear infinite;
}

.core {
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-core 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.2);
}

/* --- TEXT & BAR --- */
.loading-text {
    margin-top: 5vw; /* responsive spacing */
    font-family: 'Courier New', monospace;
    font-size: 3vw;
    max-font-size: 12px;
    letter-spacing: 0.5vw;
    color: #6b7280;
    text-transform: uppercase;
}

.dots::after {
    content: '.';
    animation: dots 1.5s steps(5, end) infinite;
}

.progress-container {
    width: 50vw; /* responsive width */
    max-width: 200px;
    height: 2px;
    background: #111;
    margin-top: 3vw;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #06b6d4);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    transition: width 0.2s ease-out;
}

/* --- KEYFRAMES --- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-reverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes pulse-core {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

/* --- MOBILE MEDIA QUERY --- */
@media (max-width: 480px) {
    .loader-ring {
        width: 30vw;
        height: 30vw;
    }

    .loading-text {
        font-size: 4vw;
        margin-top: 6vw;
        letter-spacing: 0.3vw;
    }

    .progress-container {
        width: 70vw;
    }
}
