/* Professional Loading Screen Styles */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #ffffff 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
}

.dark #page-loader {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Loader Container */
.loader-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

/* Logo Animation Container */
.loader-logo-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: logoScalePulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 4px 20px rgba(17, 82, 212, 0.3));
    will-change: transform;
}

.dark .loader-logo {
    filter: drop-shadow(0 4px 20px rgba(96, 165, 250, 0.4));
}

/* Logo Scale & Pulse Animation */
@keyframes logoScalePulse {
    0%, 100% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.08) rotateY(5deg);
        opacity: 0.95;
    }
}

/* Logo Glow Effect */
.loader-logo-wrapper::before {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(17, 82, 212, 0.3) 0%, transparent 70%);
    animation: glowPulse 2s ease-in-out infinite;
    z-index: -1;
}

.dark .loader-logo-wrapper::before {
    background: radial-gradient(circle, rgba(96, 165, 250, 0.4) 0%, transparent 70%);
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Rotating Rings - Geometric Design */
.loader-rings {
    position: absolute;
    inset: -30px;
    pointer-events: none;
}

.loader-ring {
    position: absolute;
    border: 2px solid rgba(17, 82, 212, 0.2);
    border-top-color: rgba(17, 82, 212, 0.6);
    border-radius: 50%;
    animation: ringRotate 2s linear infinite;
}

.dark .loader-ring {
    border-color: rgba(96, 165, 250, 0.2);
    border-top-color: rgba(96, 165, 250, 0.6);
}

.loader-ring:nth-child(1) {
    width: 100%;
    height: 100%;
    animation-duration: 2s;
    animation-direction: normal;
}

.loader-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    animation-duration: 1.5s;
    animation-direction: reverse;
    border-top-color: rgba(59, 130, 246, 0.5);
}

.dark .loader-ring:nth-child(2) {
    border-top-color: rgba(147, 197, 253, 0.5);
}

@keyframes ringRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Progress Bar */
.loader-progress {
    width: 200px;
    height: 4px;
    background: rgba(17, 82, 212, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.dark .loader-progress {
    background: rgba(96, 165, 250, 0.1);
}

.loader-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #1152d4 0%, #3b82f6 50%, #60a5fa 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.loader-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 1.5s infinite;
}

@keyframes progressShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Loading Text (Optional) */
.loader-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation: textFade 1.5s ease-in-out infinite;
}

.dark .loader-text {
    color: #94a3b8;
}

@keyframes textFade {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Floating Particles Background */
.loader-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.loader-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(17, 82, 212, 0.3);
    border-radius: 50%;
    animation: particleFloat 8s infinite ease-in-out;
}

.dark .loader-particle {
    background: rgba(96, 165, 250, 0.3);
}

.loader-particle:nth-child(1) {
    left: 20%;
    top: 20%;
    animation-delay: 0s;
}

.loader-particle:nth-child(2) {
    left: 80%;
    top: 40%;
    animation-delay: 1s;
}

.loader-particle:nth-child(3) {
    left: 40%;
    top: 80%;
    animation-delay: 2s;
}

.loader-particle:nth-child(4) {
    left: 60%;
    top: 10%;
    animation-delay: 3s;
}

.loader-particle:nth-child(5) {
    left: 10%;
    top: 60%;
    animation-delay: 4s;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-30px) translateX(20px);
        opacity: 0.6;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .loader-logo,
    .loader-logo-wrapper::before,
    .loader-ring,
    .loader-text,
    .loader-particle,
    .loader-progress-bar::after {
        animation: none !important;
    }
    
    .loader-logo {
        transform: scale(1);
    }
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .loader-logo-wrapper {
        width: 100px;
        height: 100px;
    }
    
    .loader-progress {
        width: 160px;
    }
    
    .loader-text {
        font-size: 0.75rem;
    }
}
