/* ============================================
   PRELOADER STYLES
   Modern, responsive preloader with multiple animation types
   ============================================ */

/* Preloader Container - Covers entire screen */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

/* Hidden state */
#preloader.preloader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Preloader Content Container */
.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    animation: fadeInUp 0.6s ease-out;
}

/* Logo/Image Container */
.preloader-logo {
    max-width: 200px;
    max-height: 100px;
    object-fit: contain;
    animation: pulse 3s ease-in-out infinite;
}

/* Lottie Animation Container */
.preloader-lottie {
    width: 200px;
    height: 200px;
    max-width: 80vw;
    max-height: 200px;
}

/* Hide logo when Lottie is active */
.preloader-logo.hidden {
    display: none;
}

/* Spinner Animation - HIDDEN */
.preloader-spinner {
    display: none; /* Hidden as requested */
    width: 50px;
    height: 50px;
    border: 4px solid rgba(16, 185, 129, 0.1);
    border-top-color: #10b981;
    border-right-color: #10b981;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

/* Dots Animation */
.preloader-dots {
    display: flex;
    gap: 10px;
}

.preloader-dots .dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: #10b981;
    animation: bounce 1.4s ease-in-out infinite;
}

.preloader-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.preloader-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* Pulse Animation */
.preloader-pulse {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #10b981;
    animation: pulse-ring 1.5s ease-out infinite;
}

/* Loading Text - Increased Size */
.preloader-text {
    font-family: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1f2937;
    font-size: 28px; /* Increased from 16px */
    font-weight: 600; /* Made bolder */
    margin-top: 15px;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Progress Bar (Optional) */
.preloader-progress {
    width: 250px;
    height: 4px;
    background-color: rgba(16, 185, 129, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.preloader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.7;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.02);
        opacity: 0.9;
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes progress {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media screen and (max-width: 768px) {
    .preloader-content {
        padding: 30px 20px;
        max-width: 90%;
    }
    
    .preloader-logo {
        max-width: 180px; /* Larger logo on mobile */
        max-height: 90px;
        margin-bottom: 30px;
        animation: fadeInScale 0.6s ease-out; /* Smooth entrance */
    }
    
    .preloader-text {
        font-size: 32px !important; /* MUCH LARGER text for mobile */
        font-weight: 700 !important; /* Extra bold */
        line-height: 1.4;
        letter-spacing: 1px;
        animation: fadeInUp 0.8s ease-out 0.2s both; /* Smooth animation */
    }
    
    .preloader-spinner {
        width: 50px;
        height: 50px;
        border-width: 5px; /* Thicker border for visibility */
    }
}

@media screen and (max-width: 480px) {
    .preloader-text {
        font-size: 28px !important; /* Large and very readable */
        padding: 0 15px;
    }
    
    .preloader-logo {
        max-width: 160px;
        max-height: 80px;
    }
}

/* Smooth fade in animations for mobile */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RED DOT SPLASH ANIMATION (Flutter-inspired Journey)
   Animation: Small white circle travels to fill red hole, then white splash expands
   ============================================ */

/* Container for red dot splash */
.red-dot-splash-container {
    position: relative;
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

/* Medium white circle with red hole in center (stationary target) */
.red-dot-splash-center {
    position: absolute;
    width: 96px;
    height: 96px;
    background: #ffffff;
    border-radius: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Red hole in the center (the target) */
.red-dot-splash-center::after {
    content: '';
    width: 24px;
    height: 24px;
    background: #D6303C;
    border-radius: 50%;
}

/* White splash overlay (expands after circle fills hole) */
.red-dot-splash-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    background: #ffffff;
    border-radius: 50%;
    z-index: 1000;
    opacity: 0;
    aspect-ratio: 1 / 1; /* Force perfect circle */
}

.red-dot-splash-ring-1 {
    animation: white-splash-expand 0.5s ease-out 1.3s forwards;
}

/* Hide other rings (not used in journey animation) */
.red-dot-splash-ring-2,
.red-dot-splash-ring-3,
.red-dot-splash-ring-4 {
    display: none;
}

/* Small white circle (the moving/traveling circle) */
.red-dot-particle {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 3;
}

/* Particle 1: The traveling circle that fills the hole */
.red-dot-particle-1 {
    left: -80px; /* Start position: left of center */
    animation: journey-to-center 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

/* Hide other particles (not used in journey animation) */
.red-dot-particle-2,
.red-dot-particle-3,
.red-dot-particle-4,
.red-dot-particle-5,
.red-dot-particle-6,
.red-dot-particle-7,
.red-dot-particle-8 {
    display: none;
}

/* Journey Animation Keyframes */

/* Small circle travels from left to center and fills the red hole */
@keyframes journey-to-center {
    0% {
        left: -80px;
        opacity: 1;
        transform: scale(1);
    }
    80% {
        left: 50%;
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    90% {
        left: 50%;
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    100% {
        left: 50%;
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* White splash expands from center to cover entire screen */
@keyframes white-splash-expand {
    0% {
        width: 24px;
        height: 24px;
        opacity: 1;
    }
    50% {
        width: 150vmax;
        height: 150vmax;
        opacity: 1;
    }
    100% {
        width: 250vmax;
        height: 250vmax;
        opacity: 1;
    }
}

/* Red dot splash mobile responsive */
@media screen and (max-width: 768px) {
    .red-dot-splash-container {
        width: 100%;
        height: 150px;
    }
    
    .red-dot-splash-center {
        width: 72px;
        height: 72px;
    }
    
    .red-dot-splash-center::after {
        width: 18px;
        height: 18px;
    }
    
    .red-dot-particle {
        width: 18px;
        height: 18px;
    }
    
    .red-dot-particle-1 {
        left: -60px; /* Closer start position on mobile */
    }
}

/* ============================================
   CONTENT HIDING (until preloader is done)
   ============================================ */

body.preloader-active {
    overflow: hidden;
}

body.preloader-active .page-content {
    opacity: 0;
    visibility: hidden;
}

body.preloader-done .page-content {
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
