/* ============================================================
   MPL - PRELOADER ANIMATION (Cricket Ball Bounce + Logo Reveal)
   Same exact animated loader from jt20.in
   ============================================================ */

.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0f1e 0%, #0f172a 50%, #1e293b 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    transition: opacity 0.35s ease-out, visibility 0.35s ease-out;
}

.loader-wrapper.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    position: relative;
    user-select: none;
}

/* ===== PERFECT CRICKET BALL ===== */
.ball-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.cricket-ball {
    width: 100%;
    height: 100%;
    position: relative;
    animation: ballBounceWithLogo 1.3s cubic-bezier(0.4, 0.1, 0.3, 1) forwards;
}

/* Realistic 3D Ball with Logo */
.ball-3d {
    width: 100%;
    height: 100%;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: ballSpin 0.25s linear infinite;
}

/* Seam Lines */
.ball-3d::before {
    content: '';
    position: absolute;
    width: 72%;
    height: 3px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.95));
    top: 50%;
    left: 14%;
    transform: translateY(-50%);
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

.ball-3d::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 72%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.95));
    top: 14%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

@keyframes ballSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* BALL BOUNCE ANIMATION */
@keyframes ballBounceWithLogo {
    0% {
        transform: translateY(-250px);
        animation-timing-function: ease-in;
    }
    12% {
        transform: translateY(0px);
        animation-timing-function: ease-out;
    }
    22% {
        transform: translateY(-150px);
        animation-timing-function: ease-in;
    }
    38% {
        transform: translateY(0px);
        animation-timing-function: ease-out;
    }
    48% {
        transform: translateY(-80px);
        animation-timing-function: ease-in;
    }
    62% {
        transform: translateY(0px);
        animation-timing-function: ease-out;
    }
    70% {
        transform: translateY(-60px);
        animation-timing-function: ease-in;
    }
    75% {
        transform: translateY(-60px) scale(0.3);
        opacity: 0;
    }
    80%, 100% {
        transform: translateY(-60px) scale(0);
        opacity: 0;
    }
}

/* Ball Shadow */
.ball-shadow {
    width: 100px;
    height: 15px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.2), transparent);
    border-radius: 50%;
    margin: -15px auto 0;
    filter: blur(3px);
    animation: shadowEffect 1.3s ease-in-out forwards;
}

@keyframes shadowEffect {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.6);
    }
    12%, 38%, 62% {
        opacity: 0.9;
        transform: scale(1);
    }
    70%, 80% {
        opacity: 0.1;
        transform: scale(0.3);
    }
}

/* ===== LOGO ANIMATION ===== */
.logo-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0px;
    height: 0px;
    opacity: 0;
    z-index: 20;
    animation: logoZoomAtThirdBounceUp 1.3s ease-out forwards;
}

@keyframes logoZoomAtThirdBounceUp {
    0%, 68% {
        width: 0px;
        height: 0px;
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    72% {
        width: 50px;
        height: 50px;
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.4);
    }
    78% {
        width: 120px;
        height: 120px;
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    88%, 100% {
        width: 140px;
        height: 140px;
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 193, 7, 0.15), transparent);
    padding: 8px;
    box-shadow: 0 0 40px rgba(255, 193, 7, 0.5);
    animation: logoGlow 1s ease-in-out infinite;
}

@keyframes logoGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px #ffc107);
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 25px #ff8c00);
        transform: scale(1.02);
    }
}

/* Rotating Ring Around Logo */
.logo-ring {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 156px;
    height: 156px;
    border-radius: 50%;
    border: 2px solid rgba(255, 193, 7, 0.3);
    border-top: 3px solid #ffc107;
    border-right: 2px solid #ff8c00;
    animation: ringRotate 2s linear infinite;
}

@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Particle Effects */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #ffc107, #ff8c00);
    border-radius: 50%;
    opacity: 0;
    animation: particleBurst 1.3s ease-out forwards;
}

.particle:nth-child(1) { top: 40%; left: 35%; animation-delay: 0s; }
.particle:nth-child(2) { top: 55%; left: 60%; animation-delay: 0.05s; }
.particle:nth-child(3) { top: 45%; left: 48%; animation-delay: 0.02s; }
.particle:nth-child(4) { top: 60%; left: 40%; animation-delay: 0.08s; }
.particle:nth-child(5) { top: 35%; left: 55%; animation-delay: 0.03s; }
.particle:nth-child(6) { top: 50%; left: 30%; animation-delay: 0.06s; }
.particle:nth-child(7) { top: 65%; left: 52%; animation-delay: 0.1s; }
.particle:nth-child(8) { top: 38%; left: 65%; animation-delay: 0.07s; }

@keyframes particleBurst {
    0%, 70% {
        opacity: 0;
        transform: scale(0) translate(0, 0);
    }
    74% {
        opacity: 1;
        transform: scale(1.5) translate(-10px, -20px);
    }
    82% {
        opacity: 0.5;
        transform: scale(1) translate(-20px, -40px);
    }
    100% {
        opacity: 0;
        transform: scale(0) translate(-30px, -60px);
    }
}

/* Text Section */
.loader-text {
    text-align: center;
    margin-top: 100px;
    position: relative;
    z-index: 15;
}

.loader-text h2 {
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffc107, #ff8c00);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
}

.progress-simple {
    width: 240px;
    margin: 12px auto 0;
}

.progress-track {
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ffc107, #ff8c00);
    animation: fillProgress 1.3s linear forwards;
}

@keyframes fillProgress {
    0%   { width: 0%; }
    100% { width: 100%; }
}

/* Bottom Powered By CricTournament Branding */
.loader-brand-bottom {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    pointer-events: none;
    z-index: 30;
}

.loader-brand-by {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.loader-brand-name {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #ffffff;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.loader-brand-name span {
    color: #e11d48;
}

@media (max-width: 576px) {
    .ball-shadow { width: 70px; }
    .loader-text { margin-top: 70px; }
    .logo-ring { width: 124px; height: 124px; top: -6px; left: -6px; }
    @keyframes logoZoomAtThirdBounceUp {
        0%, 68% { width: 0px; height: 0px; opacity: 0; transform: translate(-50%, -50%) scale(0); }
        72% { width: 40px; height: 40px; opacity: 0.7; transform: translate(-50%, -50%) scale(0.4); }
        78% { width: 95px; height: 95px; opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
        88%, 100% { width: 112px; height: 112px; opacity: 1; transform: translate(-50%, -50%) scale(1); }
    }
    .loader-text h2 { font-size: 1rem; letter-spacing: 1.5px; }
    .progress-simple { width: 190px; }
    .loader-brand-bottom { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}
