/**
 * DXR Store - Space Loader
 * Premium sci-fi loading experience
 */

/* ============================
   SPACE LOADER OVERLAY
   ============================ */
#splash-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #0a0a12 0%, #020204 50%, #000000 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-out;
    overflow: hidden;
}

/* ============================
   STARFIELD BACKGROUND
   ============================ */
.space-starfield {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: starTwinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

.star.small { width: 1px; height: 1px; opacity: 0.4; }
.star.medium { width: 2px; height: 2px; opacity: 0.6; box-shadow: 0 0 3px rgba(255,255,255,0.3); }
.star.large { width: 3px; height: 3px; opacity: 0.8; box-shadow: 0 0 6px rgba(0, 195, 255, 0.5); }

@keyframes starTwinkle {
    0%, 100% { opacity: var(--base-opacity, 0.4); transform: scale(1); }
    50% { opacity: calc(var(--base-opacity, 0.4) + 0.3); transform: scale(1.2); }
}

/* Parallax layers */
.star-layer {
    position: absolute;
    inset: 0;
}

.star-layer.layer-1 { animation: starDrift 60s linear infinite; }
.star-layer.layer-2 { animation: starDrift 90s linear infinite reverse; }
.star-layer.layer-3 { animation: starDrift 120s linear infinite; }

@keyframes starDrift {
    0% { transform: translateY(0) translateX(0); }
    100% { transform: translateY(-20px) translateX(10px); }
}

/* Nebula glow effects */
.space-nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: nebulaFloat 12s ease-in-out infinite;
}

.nebula-1 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #00C3FF 0%, transparent 70%);
    top: -10%; left: -10%;
}

.nebula-2 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #107C10 0%, transparent 70%);
    bottom: -10%; right: -10%;
    animation-delay: 6s;
}

.nebula-3 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
    top: 40%; left: 60%;
    animation-delay: 3s;
    opacity: 0.1;
}

@keyframes nebulaFloat {
    0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.15; }
    50% { transform: scale(1.1) translate(10px, -10px); opacity: 0.25; }
}

/* ============================
   CENTRAL LOADER - SCI-FI
   ============================ */
.space-loader-content {
    position: relative;
    z-index: 10;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Holographic ring container */
.holo-ring-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 30px;
}

/* Outer scanning ring */
.holo-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: ringRotate 3s linear infinite;
}

.holo-ring::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        #00C3FF 60deg,
        transparent 120deg,
        transparent 240deg,
        #107C10 300deg,
        transparent 360deg
    );
    mask: radial-gradient(transparent 68%, #000 70%, #000 100%);
    -webkit-mask: radial-gradient(transparent 68%, #000 70%, #000 100%);
}

.holo-ring.ring-2 {
    inset: 15px;
    animation: ringRotate 4s linear infinite reverse;
}

.holo-ring.ring-2::before {
    background: conic-gradient(
        from 180deg,
        transparent 0deg,
        rgba(139, 92, 246, 0.8) 40deg,
        transparent 80deg,
        transparent 280deg,
        rgba(0, 195, 255, 0.6) 320deg,
        transparent 360deg
    );
    mask: radial-gradient(transparent 65%, #000 67%, #000 100%);
    -webkit-mask: radial-gradient(transparent 65%, #000 67%, #000 100%);
}

.holo-ring.ring-3 {
    inset: 30px;
    animation: ringRotate 5s linear infinite;
}

.holo-ring.ring-3::before {
    background: conic-gradient(
        from 90deg,
        transparent 0deg,
        rgba(16, 124, 16, 0.7) 30deg,
        transparent 60deg
    );
    mask: radial-gradient(transparent 60%, #000 62%, #000 100%);
    -webkit-mask: radial-gradient(transparent 60%, #000 62%, #000 100%);
}

@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Central core with logo */
.holo-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110px;
    height: 110px;
    background: radial-gradient(circle, rgba(0, 195, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: corePulse 2s ease-in-out infinite;
}

.holo-core::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(0, 195, 255, 0.3);
    animation: coreGlow 2s ease-in-out infinite;
}

@keyframes corePulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes coreGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 195, 255, 0.3), inset 0 0 20px rgba(0, 195, 255, 0.1); }
    50% { box-shadow: 0 0 40px rgba(0, 195, 255, 0.5), inset 0 0 30px rgba(0, 195, 255, 0.2); }
}

.space-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 50%;
    filter: drop-shadow(0 0 20px rgba(0, 195, 255, 0.6));
}

/* Orbiting particles */
.orbit-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #00C3FF;
    border-radius: 50%;
    box-shadow: 0 0 10px #00C3FF, 0 0 20px rgba(0, 195, 255, 0.5);
    animation: orbitParticle 3s linear infinite;
}

.orbit-particle:nth-child(2) {
    animation-delay: -1s;
    background: #107C10;
    box-shadow: 0 0 10px #107C10, 0 0 20px rgba(16, 124, 16, 0.5);
}

.orbit-particle:nth-child(3) {
    animation-delay: -2s;
    background: #8b5cf6;
    box-shadow: 0 0 10px #8b5cf6, 0 0 20px rgba(139, 92, 246, 0.5);
}

@keyframes orbitParticle {
    0% { transform: rotate(0deg) translateX(95px) rotate(0deg); opacity: 1; }
    50% { opacity: 0.5; }
    100% { transform: rotate(360deg) translateX(95px) rotate(-360deg); opacity: 1; }
}

/* ============================
   TYPOGRAPHY
   ============================ */
.space-title {
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 8px;
    margin: 0;
    background: linear-gradient(180deg, #ffffff 0%, #888888 50%, #ffffff 100%);
    background-size: 100% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShine 3s ease-in-out infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(0, 195, 255, 0.4));
}

@keyframes titleShine {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 0% 100%; }
}

.space-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 12px;
    letter-spacing: 2px;
    animation: subtitleFade 2s ease-in-out infinite;
}

@keyframes subtitleFade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* ============================
   LOADING INDICATOR
   ============================ */
.space-loading-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 40px;
    overflow: hidden;
    position: relative;
}

.space-loading-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #107C10, #00C3FF, #8b5cf6);
    background-size: 200% 100%;
    animation: loadingProgress 2s ease-in-out infinite, loadingGradient 3s linear infinite;
    border-radius: 3px;
    box-shadow: 0 0 15px rgba(0, 195, 255, 0.6);
}

@keyframes loadingProgress {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

@keyframes loadingGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.space-loading-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 16px;
    letter-spacing: 1px;
}

/* ============================
   SCANNING LINES (Subtle)
   ============================ */
.scan-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 195, 255, 0.01) 2px,
        rgba(0, 195, 255, 0.01) 4px
    );
    pointer-events: none;
    animation: scanMove 8s linear infinite;
}

@keyframes scanMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* ============================
   REDUCED MOTION
   ============================ */
@media (prefers-reduced-motion: reduce) {
    .star,
    .star-layer,
    .space-nebula,
    .holo-ring,
    .holo-core,
    .orbit-particle,
    .space-title,
    .space-subtitle,
    .space-loading-bar::before,
    .scan-lines {
        animation: none !important;
    }
    
    .holo-ring::before {
        background: conic-gradient(from 0deg, rgba(0, 195, 255, 0.5) 0deg, transparent 90deg);
    }
    
    .holo-core {
        transform: translate(-50%, -50%);
        box-shadow: 0 0 30px rgba(0, 195, 255, 0.4);
    }
    
    .orbit-particle {
        display: none;
    }
    
    .space-loading-bar::before {
        transform: translateX(0);
        width: 60%;
        animation: reducedPulse 2s ease-in-out infinite !important;
    }
    
    .star {
        opacity: 0.3 !important;
    }
}

@keyframes reducedPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 480px) {
    .holo-ring-container {
        width: 160px;
        height: 160px;
    }
    
    .holo-core {
        width: 90px;
        height: 90px;
    }
    
    .space-logo {
        width: 65px;
        height: 65px;
    }
    
    .orbit-particle {
        width: 5px;
        height: 5px;
    }
    
    @keyframes orbitParticle {
        0% { transform: rotate(0deg) translateX(75px) rotate(0deg); opacity: 1; }
        50% { opacity: 0.5; }
        100% { transform: rotate(360deg) translateX(75px) rotate(-360deg); opacity: 1; }
    }
    
    .space-title {
        font-size: 32px;
        letter-spacing: 5px;
    }
    
    .space-subtitle {
        font-size: 12px;
    }
    
    .space-loading-bar {
        width: 160px;
    }
}

/* ============================
   TAB VISIBILITY (via JS class)
   ============================ */
#splash-screen.tab-hidden * {
    animation-play-state: paused !important;
}
