/**
 * Loading Screen Styles
 * Consistent with website's blue color scheme and modern design
 */

/* Loading Screen Container */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color, #1a365d), var(--secondary-color, #4a6fa5));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Loading Content Container */
.loading-content {
    text-align: center;
    color: var(--neutral-white, #ffffff);
    max-width: 400px;
    padding: 20px;
}

/* Logo and Brand */
.loading-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: logoFloat 2s ease-in-out infinite;
    display: block;
}

.loading-brand {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    animation: brandGlow 2s ease-in-out infinite alternate;
}

.loading-tagline {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Loading Animation Container */
.loading-animation {
    margin: 2rem 0;
    position: relative;
}

/* Spinning Game Controller */
.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    position: relative;
    animation: spin 2s linear infinite;
}

.loading-spinner::before {
    content: '🎮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    animation: controllerPulse 1.5s ease-in-out infinite;
}

/* Progress Bar Container */
.loading-progress {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem auto;
    position: relative;
}

/* Progress Bar Fill */
.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffffff, #e2e8f0, #ffffff);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.loading-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progressShine 2s ease-in-out infinite;
}

/* Progress Text */
.loading-progress-text {
    font-size: 0.9rem;
    margin-top: 1rem;
    opacity: 0.8;
    font-weight: 500;
}

/* Loading Dots Animation */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

/* Floating Particles */
.loading-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.loading-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: particleFloat 8s linear infinite;
}

.loading-particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 6s;
}

.loading-particle:nth-child(2) {
    left: 20%;
    animation-delay: 1s;
    animation-duration: 8s;
}

.loading-particle:nth-child(3) {
    left: 30%;
    animation-delay: 2s;
    animation-duration: 7s;
}

.loading-particle:nth-child(4) {
    left: 40%;
    animation-delay: 3s;
    animation-duration: 9s;
}

.loading-particle:nth-child(5) {
    left: 50%;
    animation-delay: 4s;
    animation-duration: 6s;
}

.loading-particle:nth-child(6) {
    left: 60%;
    animation-delay: 5s;
    animation-duration: 8s;
}

.loading-particle:nth-child(7) {
    left: 70%;
    animation-delay: 6s;
    animation-duration: 7s;
}

.loading-particle:nth-child(8) {
    left: 80%;
    animation-delay: 7s;
    animation-duration: 9s;
}

.loading-particle:nth-child(9) {
    left: 90%;
    animation-delay: 8s;
    animation-duration: 6s;
}

/* Keyframe Animations */
@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes brandGlow {
    0% {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    100% {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px rgba(255, 255, 255, 0.4);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

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

@keyframes progressShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .loading-content {
        padding: 15px;
        max-width: 320px;
    }
    
    .loading-logo {
        font-size: 3rem;
        margin-bottom: 0.8rem;
    }
    
    .loading-brand {
        font-size: 1.5rem;
        margin-bottom: 0.4rem;
    }
    
    .loading-tagline {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .loading-spinner {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }
    
    .loading-spinner::before {
        font-size: 2.5rem;
    }
    
    .loading-progress {
        max-width: 250px;
        height: 5px;
    }
    
    .loading-progress-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .loading-content {
        padding: 10px;
        max-width: 280px;
    }
    
    .loading-logo {
        font-size: 2.5rem;
    }
    
    .loading-brand {
        font-size: 1.3rem;
    }
    
    .loading-tagline {
        font-size: 0.8rem;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-spinner::before {
        font-size: 2rem;
    }
    
    .loading-progress {
        max-width: 200px;
        height: 4px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .loading-screen {
        background: #000000;
    }
    
    .loading-progress {
        background: #333333;
        border: 1px solid #ffffff;
    }
    
    .loading-progress-fill {
        background: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .loading-logo,
    .loading-brand,
    .loading-spinner,
    .loading-spinner::before,
    .loading-progress-fill::after,
    .loading-dot,
    .loading-particle {
        animation: none;
    }
    
    .loading-spinner::before {
        transform: translate(-50%, -50%);
    }
}

/* Print styles */
@media print {
    .loading-screen {
        display: none;
    }
}