/* Preloader / Loading Screen */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    padding: 20px;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* 3D Logo Container */
.preloader-content {
    text-align: center;
    perspective: 1000px;
    position: relative;
    z-index: 10;
}

/* 3D Rotating Logo */
.logo-3d {
    font-size: 6rem;
    font-weight: 800;
    letter-spacing: 0.2rem;
    margin-bottom: 2rem;
    transform-style: preserve-3d;
    animation: rotate3D 3s ease-in-out infinite;
    position: relative;
    z-index: 5;
}

.logo-3d .logo-part-1 {
    color: #ffffff;
    display: inline-block;
    text-shadow: 
        0 1px 0 #ccc,
        0 2px 0 #c9c9c9,
        0 3px 0 #bbb,
        0 4px 0 #b9b9b9,
        0 5px 0 #aaa,
        0 6px 1px rgba(0,0,0,.1),
        0 0 5px rgba(0,0,0,.1),
        0 1px 3px rgba(0,0,0,.3),
        0 3px 5px rgba(0,0,0,.2),
        0 5px 10px rgba(0,0,0,.25),
        0 10px 10px rgba(0,0,0,.2),
        0 20px 20px rgba(0,0,0,.15);
}

.logo-3d .logo-part-2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    text-shadow: 
        0 1px 0 #764ba2,
        0 2px 0 #667eea,
        0 3px 0 #764ba2,
        0 4px 0 #667eea,
        0 5px 10px rgba(102, 126, 234, 0.5),
        0 10px 20px rgba(118, 75, 162, 0.3);
}

@keyframes rotate3D {
    0%, 100% {
        transform: rotateY(-15deg) rotateX(10deg);
    }
    50% {
        transform: rotateY(15deg) rotateX(-10deg);
    }
}

/* Orbiting Particles */
.particles-container {
    position: absolute;
    width: 550px;
    height: 550px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.particle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--gradient-1);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
    z-index: 2;
}

.particle-1 {
    top: 0;
    left: 50%;
    animation: orbit1 4s linear infinite;
}

.particle-2 {
    top: 50%;
    right: 0;
    animation: orbit2 4s linear infinite;
}

.particle-3 {
    bottom: 0;
    left: 50%;
    animation: orbit3 4s linear infinite;
}

.particle-4 {
    top: 50%;
    left: 0;
    animation: orbit4 4s linear infinite;
}

@keyframes orbit1 {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) translateX(275px) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) translateX(275px) rotate(-360deg);
    }
}

@keyframes orbit2 {
    0% {
        transform: translate(50%, -50%) rotate(90deg) translateX(275px) rotate(-90deg);
    }
    100% {
        transform: translate(50%, -50%) rotate(450deg) translateX(275px) rotate(-450deg);
    }
}

@keyframes orbit3 {
    0% {
        transform: translate(-50%, 50%) rotate(180deg) translateX(275px) rotate(-180deg);
    }
    100% {
        transform: translate(-50%, 50%) rotate(540deg) translateX(275px) rotate(-540deg);
    }
}

@keyframes orbit4 {
    0% {
        transform: translate(-50%, -50%) rotate(270deg) translateX(275px) rotate(-270deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(630deg) translateX(275px) rotate(-630deg);
    }
}

/* Glowing Ring */
.glow-ring {
    width: 500px;
    height: 500px;
    border: 3px solid transparent;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(var(--dark-bg), var(--dark-bg)) padding-box,
                linear-gradient(135deg, #667eea, #764ba2, #f093fb, #667eea) border-box;
    animation: rotateRing 8s linear infinite;
    z-index: 0;
}

@keyframes rotateRing {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.glow-ring::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    background: inherit;
    filter: blur(20px);
    opacity: 0.3;
    z-index: -1;
}

/* Loading Progress */
.loading-progress {
    margin-top: 3rem;
    position: relative;
    z-index: 5;
}

.progress-bar-preloader {
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.progress-fill-preloader {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 10px;
    width: 0%;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.8);
    transition: width 0.3s ease;
}

.loading-text {
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-percentage {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Floating Icons */
.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}

.float-icon {
    position: absolute;
    font-size: 3rem;
    color: rgba(99, 102, 241, 0.15);
    animation: floatIcon 6s ease-in-out infinite;
}

.float-icon:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.float-icon:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 1s;
}

.float-icon:nth-child(3) {
    bottom: 20%;
    left: 15%;
    animation-delay: 2s;
}

.float-icon:nth-child(4) {
    bottom: 15%;
    right: 10%;
    animation-delay: 3s;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.15;
    }
    50% {
        transform: translateY(-30px) rotate(180deg);
        opacity: 0.3;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .logo-3d {
        font-size: 4rem;
    }
    
    .glow-ring {
        width: 350px;
        height: 350px;
    }
    
    .particles-container {
        width: 400px;
        height: 400px;
    }
    
    @keyframes orbit1 {
        0% {
            transform: translate(-50%, -50%) rotate(0deg) translateX(200px) rotate(0deg);
        }
        100% {
            transform: translate(-50%, -50%) rotate(360deg) translateX(200px) rotate(-360deg);
        }
    }
    
    @keyframes orbit2 {
        0% {
            transform: translate(50%, -50%) rotate(90deg) translateX(200px) rotate(-90deg);
        }
        100% {
            transform: translate(50%, -50%) rotate(450deg) translateX(200px) rotate(-450deg);
        }
    }
    
    @keyframes orbit3 {
        0% {
            transform: translate(-50%, 50%) rotate(180deg) translateX(200px) rotate(-180deg);
        }
        100% {
            transform: translate(-50%, 50%) rotate(540deg) translateX(200px) rotate(-540deg);
        }
    }
    
    @keyframes orbit4 {
        0% {
            transform: translate(-50%, -50%) rotate(270deg) translateX(200px) rotate(-270deg);
        }
        100% {
            transform: translate(-50%, -50%) rotate(630deg) translateX(200px) rotate(-630deg);
        }
    }
    
    .progress-bar-preloader {
        width: 250px;
    }
    
    .float-icon {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .preloader-content {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }
    
    .logo-3d {
        font-size: 2.5rem;
        letter-spacing: 0.1rem;
    }
    
    .glow-ring {
        width: 250px;
        height: 250px;
    }
    
    .particles-container {
        width: 280px;
        height: 280px;
    }
    
    @keyframes orbit1 {
        0% {
            transform: translate(-50%, -50%) rotate(0deg) translateX(140px) rotate(0deg);
        }
        100% {
            transform: translate(-50%, -50%) rotate(360deg) translateX(140px) rotate(-360deg);
        }
    }
    
    @keyframes orbit2 {
        0% {
            transform: translate(50%, -50%) rotate(90deg) translateX(140px) rotate(-90deg);
        }
        100% {
            transform: translate(50%, -50%) rotate(450deg) translateX(140px) rotate(-450deg);
        }
    }
    
    @keyframes orbit3 {
        0% {
            transform: translate(-50%, 50%) rotate(180deg) translateX(140px) rotate(-180deg);
        }
        100% {
            transform: translate(-50%, 50%) rotate(540deg) translateX(140px) rotate(-540deg);
        }
    }
    
    @keyframes orbit4 {
        0% {
            transform: translate(-50%, -50%) rotate(270deg) translateX(140px) rotate(-270deg);
        }
        100% {
            transform: translate(-50%, -50%) rotate(630deg) translateX(140px) rotate(-630deg);
        }
    }
    
    .particle {
        width: 12px;
        height: 12px;
    }
    
    .progress-bar-preloader {
        width: 90%;
        max-width: 250px;
    }
    
    .loading-text {
        font-size: 0.85rem;
    }
    
    .loading-percentage {
        font-size: 1.2rem;
    }
    
    .float-icon {
        font-size: 1.5rem;
    }
}

