/* ========================================
   ARCANE PAGE LOADER
   Magical loading screen
   ======================================== */

/* Overlay Container */
.arcane-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #0A0E27 0%, #050816 50%, #000000 100%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    overflow: hidden; /* Prevent loader scrollbars */
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.arcane-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ========================================
   LOGO IN LOADER - Centered
   ======================================== */

.loader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    animation: logoFadeIn 0.8s ease-out forwards;
}

.loader-logo img {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.6));
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Runic Circle (Larger to fit Logo inside) */
.rune-circle {
    position: relative;
    width: 250px;
    height: 250px;
    margin-bottom: 40px;
}

.rune-circle svg {
    width: 100%;
    height: 100%;
    animation: rotateRune 3s linear infinite;
}

.rune-circle circle {
    fill: none;
    stroke: var(--arcane-emerald);
    stroke-width: 2;
    stroke-dasharray: 628;
    stroke-dashoffset: 628;
    animation: drawCircle 2s ease-in-out infinite alternate;
}

.rune-circle .inner-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* Loading Text */
.loading-text {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--arcane-emerald);
    letter-spacing: 0.3em;
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    margin-bottom: 30px;
    animation: textPulse 1.5s ease-in-out infinite;
}

/* Progress Rune */
.progress-rune {
    width: 300px;
    height: 4px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.progress-rune::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--arcane-emerald) 50%, 
        var(--arcane-gold) 100%
    );
    box-shadow: 0 0 20px var(--arcane-emerald);
    animation: loadProgress 3s ease-in-out forwards;
}

/* Floating Runes */
.floating-rune {
    position: absolute;
    font-size: 24px;
    color: var(--arcane-emerald);
    opacity: 0;
    animation: floatRune 3s ease-in-out infinite;
    text-shadow: 0 0 10px var(--arcane-emerald);
}

.floating-rune:nth-child(1) { top: 20%; left: 20%; animation-delay: 0s; }
.floating-rune:nth-child(2) { top: 30%; right: 15%; animation-delay: 0.5s; }
.floating-rune:nth-child(3) { bottom: 25%; left: 15%; animation-delay: 1s; }
.floating-rune:nth-child(4) { bottom: 20%; right: 20%; animation-delay: 1.5s; }

/* Animations */
@keyframes rotateRune {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.8; }
}

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

@keyframes loadProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes floatRune {
    0% { 
        opacity: 0; 
        transform: translateY(0) rotate(0deg); 
    }
    20% { 
        opacity: 0.6; 
    }
    80% { 
        opacity: 0.6; 
    }
    100% { 
        opacity: 0; 
        transform: translateY(-50px) rotate(360deg); 
    }
}

/* Responsive */
@media (max-width: 768px) {
    .rune-circle {
        width: 150px;
        height: 150px;
    }
    
    .progress-rune {
        width: 80%;
        max-width: 300px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .arcane-loader *,
    .arcane-loader::before,
    .arcane-loader::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
