/* Professional Page Preloader Styles */
.page-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #03143A;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

/* Animated background pattern */
.page-preloader::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(199, 5, 50, 0.1) 0%, transparent 70%);
    animation: rotate-bg 20s linear infinite;
}

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

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

.preloader-content {
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 500px;
    width: 90%;
}

/* SVG Logo Container */
.preloader-logo-container {
    margin-bottom: 50px;
    position: relative;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-logo-svg {
    width: 300px;
    height: auto;
    filter: drop-shadow(0 10px 40px rgba(0, 0, 0, 0.3));
}

/* SVG Path Animations */
.logo-path {
    fill: white;
    stroke: white;
    stroke-width: 0;
    opacity: 0;
    animation: draw-logo 2s ease forwards;
}

.logo-path:nth-child(1) { animation-delay: 0s; }
.logo-path:nth-child(2) { animation-delay: 0.05s; }
.logo-path:nth-child(3) { animation-delay: 0.1s; }
.logo-path:nth-child(4) { animation-delay: 0.15s; }
.logo-path:nth-child(5) { animation-delay: 0.2s; }
.logo-path:nth-child(6) { animation-delay: 0.25s; }
.logo-path:nth-child(7) { animation-delay: 0.3s; }
.logo-path:nth-child(8) { animation-delay: 0.35s; }
.logo-path:nth-child(9) { animation-delay: 0.4s; }
.logo-path:nth-child(10) { animation-delay: 0.45s; }
.logo-path:nth-child(11) { animation-delay: 0.5s; }
.logo-path:nth-child(12) { animation-delay: 0.55s; }
.logo-path:nth-child(13) { animation-delay: 0.6s; }
.logo-path:nth-child(14) { animation-delay: 0.65s; }

@keyframes draw-logo {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Facility text animation */
.facility-text .text-path {
    fill: #C70532;
    opacity: 0;
    animation: fade-in-text 1s ease forwards;
    animation-delay: 0.8s;
}

@keyframes fade-in-text {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Progress Bar */
.preloader-progress {
    margin-bottom: 30px;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #C70532 0%, #E91E63 50%, #C70532 100%);
    background-size: 200% 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: shimmer 2s linear infinite;
    box-shadow: 0 0 20px rgba(199, 5, 50, 0.5);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-percentage {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* Loading Text */
.preloader-text {
    color: white;
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.loading-text-main {
    animation: text-glow 2s ease-in-out infinite;
}

.loading-text-dots {
    display: inline-block;
    width: 30px;
    text-align: left;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes text-glow {
    0%, 100% {
        opacity: 0.7;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Prevent scrolling while loading */
body.loading {
    overflow: hidden;
}

/* Page content animation */
body:not(.loading) > *:not(.page-preloader) {
    animation: page-appear 0.8s ease forwards;
}

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

/* Mobile responsiveness */
@media (max-width: 768px) {
    .preloader-logo-svg {
        width: 200px;
    }
    
    .preloader-text {
        font-size: 1.1rem;
    }
    
    .preloader-logo-container {
        height: 80px;
        margin-bottom: 40px;
    }
}

/* High performance mode for slow devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01s !important;
        animation-delay: 0s !important;
    }
    
    .page-preloader::before {
        animation: none;
    }
}