/* MN Preloader CSS */
#mn-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease-out;
    /* Remove default background styles - let inline styles take precedence */
}

/* Background image overlay for better content readability */
#mn-preloader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show overlay when background image is enabled */
#mn-preloader.has-background-image::before {
    opacity: 1;
}

#mn-preloader.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

/* Slide up animation (fade out up) */
#mn-preloader.slide-up {
    transform: translateY(-50px);
    opacity: 0;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}

/* Slide down animation (fade out down) */
#mn-preloader.slide-down {
    transform: translateY(50px);
    opacity: 0;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}

/* Sequential Animation Styles */
.sequential-hidden {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
}

.sequential-animate {
    opacity: 1;
    transform: translateY(0);
}

/* Specific sequential animations for different elements */
.mn-preloader-media.sequential-animate {
    animation: sequentialFadeInUp 0.6s ease-out;
}

.mn-preloader-animation.sequential-animate {
    animation: sequentialFadeInUp 0.6s ease-out;
}

.mn-progress-container.sequential-animate,
.mn-progress-text.sequential-animate {
    animation: sequentialFadeInUp 0.6s ease-out;
}

#mn-preloader.sequential-animate {
    animation: sequentialFadeIn 0.8s ease-out;
}

@keyframes sequentialFadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sequentialFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Page Animation Helpers */
/* Pause animations while preloader is active */
body.mn-preloader-active .animate-on-load,
body.mn-preloader-active .fade-in-on-load,
body.mn-preloader-active .slide-in-on-load,
body.mn-preloader-active [class*="animate-"],
body.mn-preloader-active [class*="fade-in-"],
body.mn-preloader-active [class*="slide-in-"] {
    animation-play-state: paused !important;
    opacity: 0 !important;
    transform: translateY(20px) !important;
}

/* Resume animations after preloader is complete */
body.mn-preloader-complete .animate-on-load,
body.mn-preloader-complete .fade-in-on-load,
body.mn-preloader-complete .slide-in-on-load,
body.mn-preloader-complete [class*="animate-"],
body.mn-preloader-complete [class*="fade-in-"],
body.mn-preloader-complete [class*="slide-in-"] {
    animation-play-state: running !important;
}

/* Common animation classes for easy implementation */
.animate-on-load {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: 0ms;
}

.fade-in-on-load {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
    animation-delay: 0ms;
}

.slide-in-on-load {
    opacity: 0;
    transform: translateX(-30px);
    animation: slideInLeft 0.8s ease-out forwards;
    animation-delay: 0ms;
}

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

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

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mn-preloader-content {
    text-align: center;
    position: relative;
    z-index: 5;
}

.mn-preloader-media {
    margin-bottom: 30px;
}

.mn-preloader-media img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Specific styles for GIF animations */
.mn-preloader-media.mn-media-gif img {
    /* Ensure GIF animations are not paused */
    animation-play-state: running;
    /* Prevent browser from optimizing GIF */
    image-rendering: auto;
    /* Force hardware acceleration for smooth animation */
    transform: translateZ(0);
    will-change: auto;
}

/* Ensure static images load smoothly */
.mn-preloader-media.mn-media-static img {
    image-rendering: auto;
}

.mn-preloader-media video {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
}

/* Animation Types */
.mn-animation-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007cba;
    border-radius: 50%;
    animation: mn-spin 1s linear infinite;
}

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

.mn-animation-dots {
    display: flex;
    gap: 10px;
}

.mn-animation-dots div {
    width: 15px;
    height: 15px;
    background-color: #007cba;
    border-radius: 50%;
    animation: mn-dots 1.4s ease-in-out infinite both;
}

.mn-animation-dots div:nth-child(1) { animation-delay: -0.32s; }
.mn-animation-dots div:nth-child(2) { animation-delay: -0.16s; }

@keyframes mn-dots {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.mn-animation-pulse {
    width: 50px;
    height: 50px;
    background-color: #007cba;
    border-radius: 50%;
    animation: mn-pulse 1.5s ease-in-out infinite;
}

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

.mn-animation-bounce {
    width: 50px;
    height: 50px;
    background-color: #007cba;
    border-radius: 50%;
    animation: mn-bounce 2.0s infinite ease-in-out;
}

@keyframes mn-bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-30px);
    }
    70% {
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

/* Progress Bar */
.mn-progress-container {
    width: 300px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin-top: 120px;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.mn-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.1s ease;
}

.mn-progress-text {
    margin-top: 15px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    z-index: 10;
    color: #333;
    opacity: 0.8;
}

/* Media Positions */
.mn-media-top .mn-preloader-media {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
}

.mn-media-bottom .mn-preloader-media {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
}

.mn-media-center .mn-preloader-media {
    margin-bottom: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    #mn-preloader {
        padding: 20px;
    }
    
    .mn-preloader-media {
        margin-bottom: 20px;
    }
    
    .mn-preloader-media img {
        max-width: 150px;
        max-height: 150px;
    }
    
    .mn-preloader-media video {
        max-width: 250px;
        max-height: 250px;
    }
    
    .mn-progress-container {
        width: 250px;
        height: 5px;
        margin-top: 80px;
    }
    
    .mn-progress-text {
        margin-top: 12px;
        font-size: 13px;
    }
    
    .mn-animation-spinner {
        width: 40px;
        height: 40px;
        border-width: 4px;
    }
    
    .mn-animation-pulse,
    .mn-animation-bounce {
        width: 40px;
        height: 40px;
    }
    
    .mn-animation-dots div {
        width: 14px;
        height: 14px;
        margin: 0 4px;
    }
}

@media (max-width: 480px) {
    #mn-preloader {
        padding: 15px;
    }
    
    .mn-preloader-media {
        margin-bottom: 15px;
    }
    
    .mn-preloader-media img {
        max-width: 100px;
        max-height: 100px;
    }
    
    .mn-preloader-media video {
        max-width: 180px;
        max-height: 180px;
    }
    
    .mn-progress-container {
        width: 200px;
        height: 4px;
        margin-top: 60px;
    }
    
    .mn-progress-text {
        margin-top: 10px;
        font-size: 12px;
    }
    
    .mn-animation-spinner {
        width: 35px;
        height: 35px;
        border-width: 3px;
    }
    
    .mn-animation-pulse,
    .mn-animation-bounce {
        width: 35px;
        height: 35px;
    }
    
    .mn-animation-dots div {
        width: 12px;
        height: 12px;
        margin: 0 3px;
    }
}

/* Extra small devices (phones in portrait, less than 375px) */
@media (max-width: 374px) {
    #mn-preloader {
        padding: 10px;
    }
    
    .mn-preloader-media img {
        max-width: 80px;
        max-height: 80px;
    }
    
    .mn-preloader-media video {
        max-width: 150px;
        max-height: 150px;
    }
    
    .mn-progress-container {
        width: 180px;
        height: 4px;
        margin-top: 50px;
    }
    
    .mn-progress-text {
        margin-top: 8px;
        font-size: 11px;
    }
    
    .mn-animation-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
    
    .mn-animation-pulse,
    .mn-animation-bounce {
        width: 30px;
        height: 30px;
    }
    
    .mn-animation-dots div {
        width: 10px;
        height: 10px;
        margin: 0 2px;
    }
}
