/*
 * PopQuiz.ie Preloader Styles
 * Extracted from landing page for better maintainability
 */

/* Preloader Container */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #F1F1F1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

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

.preloader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

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

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: linear-gradient(45deg, #59B4B5, #5EE1E3);
    border-radius: 50%;
    animation: particleFloat 8s linear infinite;
    opacity: 0.6;
}

/* Particle positions */
.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 6s; }
.particle:nth-child(8) { left: 80%; animation-delay: 7s; }
.particle:nth-child(9) { left: 90%; animation-delay: 1.5s; }
.particle:nth-child(10) { left: 15%; animation-delay: 2.5s; }

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

/* Preloader Logo */
.preloader-logo {
    width: 200px;
    height: auto;
    margin-bottom: 50px;
    animation: logoMagic 3s ease-in-out infinite;
    position: relative;
    z-index: 10;
}

@keyframes logoMagic {
    0%, 100% {
        transform: scale(1) rotateY(0deg);
        filter: drop-shadow(0 10px 20px rgba(89, 180, 181, 0.3));
    }
    25% {
        transform: scale(1.1) rotateY(5deg);
        filter: drop-shadow(0 15px 30px rgba(94, 225, 227, 0.4));
    }
    50% {
        transform: scale(1.05) rotateY(0deg);
        filter: drop-shadow(0 20px 40px rgba(89, 180, 181, 0.5));
    }
    75% {
        transform: scale(1.1) rotateY(-5deg);
        filter: drop-shadow(0 15px 30px rgba(94, 225, 227, 0.4));
    }
}

/* Spinner Rings */
.preloader-spinner {
    width: 80px;
    height: 80px;
    position: relative;
    margin-bottom: 40px;
}

.spinner-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

.spinner-ring:nth-child(1) {
    width: 80px;
    height: 80px;
    border-top: 3px solid #59B4B5;
    border-right: 3px solid #5EE1E3;
    animation: spinFast 1.5s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-bottom: 3px solid #29414F;
    border-left: 3px solid #0C5783;
    animation: spinSlow 2s linear infinite reverse;
}

.spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top: 2px solid #5EE1E3;
    border-right: 2px solid #59B4B5;
    animation: spinFast 1s linear infinite;
}

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

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

/* Preloader Text */
.preloader-text {
    color: #29414F;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 30px;
    letter-spacing: 1px;
    animation: textGlow 2s ease-in-out infinite;
    text-transform: uppercase;
    position: relative;
}

.preloader-text::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #59B4B5, #5EE1E3);
    animation: underlineGrow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% {
        opacity: 0.7;
        text-shadow: 0 0 10px rgba(89, 180, 181, 0.3);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(94, 225, 227, 0.6);
    }
}

@keyframes underlineGrow {
    0%, 100% { width: 0; }
    50% { width: 100%; }
}

/* Wave Bars */
.preloader-wave {
    display: flex;
    gap: 8px;
    align-items: end;
    height: 40px;
    margin-bottom: 20px;
}

.wave-bar {
    width: 6px;
    background: linear-gradient(to top, #59B4B5, #5EE1E3);
    border-radius: 3px;
    animation: waveAnimation 1.5s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-bar:nth-child(6) { animation-delay: 0.3s; }
.wave-bar:nth-child(7) { animation-delay: 0.2s; }
.wave-bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes waveAnimation {
    0%, 100% { height: 10px; }
    50% { height: 40px; }
}

/* Floating Orbs */
.preloader-orbs {
    display: flex;
    gap: 15px;
    align-items: center;
}

.orb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #5EE1E3, #59B4B5);
    animation: orbFloat 2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(94, 225, 227, 0.5);
}

.orb:nth-child(1) { animation-delay: 0s; }
.orb:nth-child(2) { animation-delay: 0.4s; }
.orb:nth-child(3) { animation-delay: 0.8s; }
.orb:nth-child(4) { animation-delay: 0.4s; }
.orb:nth-child(5) { animation-delay: 0s; }

@keyframes orbFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
        box-shadow: 0 0 15px rgba(94, 225, 227, 0.5);
    }
    50% {
        transform: translateY(-20px) scale(1.2);
        box-shadow: 0 0 25px rgba(94, 225, 227, 0.8);
    }
}

/* Hide body content while loading */
body.loading .main-content {
    opacity: 0;
}

.main-content {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Marquee Animation (used on landing page) */
@keyframes marquee {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-25%); }
}

.animate-marquee {
    animation: marquee 15s linear infinite;
}

.animate-marquee:hover {
    animation-play-state: paused;
}
