/* ========== LOADER ANIMATION ==========*/

.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    background-image: 
        linear-gradient(rgba(15, 23, 42, 0.9), rgba(30, 58, 95, 0.9)),
        url('../images/logo.png');
    background-size: auto, contain;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: hidden;
}

.loader-content {
    text-align: center;
    position: relative;
}

/* Scale/Justice Logo Animation */
.loader-scale {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
}

.scale-beam {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, #215cca, #6c63ff);
    border-radius: 4px;
}

.scale-pan {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(33, 92, 202, 0.1);
    border: 3px solid #215cca;
    border-radius: 8px;
    top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #6c63ff;
    font-size: 24px;
}

.scale-pan:nth-child(2) {
    left: 0;
    animation: scalePanLeft 3s ease-in-out infinite;
}

.scale-pan:nth-child(3) {
    right: 0;
    animation: scalePanRight 3s ease-in-out infinite;
}

@keyframes scalePanLeft {
    0%, 100% {
        transform: translateY(0) rotateZ(-5deg);
    }
    25% {
        transform: translateY(-20px) rotateZ(-15deg);
    }
    50% {
        transform: translateY(0) rotateZ(-5deg);
    }
    75% {
        transform: translateY(10px) rotateZ(0deg);
    }
}

@keyframes scalePanRight {
    0%, 100% {
        transform: translateY(0) rotateZ(5deg);
    }
    25% {
        transform: translateY(10px) rotateZ(0deg);
    }
    50% {
        transform: translateY(0) rotateZ(5deg);
    }
    75% {
        transform: translateY(-20px) rotateZ(15deg);
    }
}

/* Loading Progress Bar */
.loader-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 30px auto;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #215cca, #6c63ff, #f31212);
    border-radius: 2px;
    animation: progressFill 3s ease-in-out forwards;
}

@keyframes progressFill {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

/* Loading Text */
.loader-text {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 20px;
    letter-spacing: 2px;
}

.loader-text span {
    display: inline-block;
    animation: blink 1.5s ease-in-out infinite;
}

.loader-text span:nth-child(1) {
    animation-delay: 0s;
}

.loader-text span:nth-child(2) {
    animation-delay: 0.3s;
}

.loader-text span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes blink {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Fade Out Animation */
.loader-wrapper.fade-out {
    animation: fadeOutLoader 1s ease-out forwards;
}

@keyframes fadeOutLoader {
    0% {
        opacity: 1;
        visibility: visible;
    }
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

/* Particle Background */
.loader-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(33, 92, 202, 0.3);
    border-radius: 50%;
    animation: float 20s infinite;
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}
