/* ============================================
   NaifarLab Medical Preloader - Premium CSS
   Charte graphique: #2E2A39, #D7D3D2, #E5E2E1
   ============================================ */

/* Reset et base */
* {
    box-sizing: border-box;
}

/* Overlay principal */
.naifarlab-preloader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #E5E2E1 0%, #f5f3f4 50%, #E5E2E1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 1;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Particules décoratives en arrière-plan */
.naifarlab-preloader-overlay::before,
.naifarlab-preloader-overlay::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.04;
    pointer-events: none;
    animation: floatParticle 20s infinite ease-in-out;
}

.naifarlab-preloader-overlay::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #2E2A39 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.naifarlab-preloader-overlay::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #D7D3D2 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation-delay: 5s;
}

@keyframes floatParticle {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    75% {
        transform: translate(20px, 30px) scale(1.05);
    }
}

/* État caché (après chargement) */
.naifarlab-preloader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Container de contenu */
.naifarlab-preloader-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    animation: fadeInScale 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Container du logo */
.naifarlab-logo-container {
    margin-bottom: 50px;
    position: relative;
    animation: logoEntrance 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(-10deg);
    }
    60% {
        transform: scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Logo SVG par défaut */
.naifarlab-logo-svg {
    width: 100%;
    max-width: 450px;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(46, 42, 57, 0.12));
}

/* Animation du microscope */
.microscope-icon {
    animation: microscopeFloat 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes microscopeFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(2deg);
    }
}

/* Logo personnalisé */
.naifarlab-custom-logo {
    max-width: 300px;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(46, 42, 57, 0.15));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Message de bienvenue */
.naifarlab-message {
    color: #2E2A39;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 45px;
    line-height: 1.5;
    letter-spacing: 0.5px;
    animation: messageSlide 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s backwards;
    position: relative;
    padding: 0 20px;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Effet de brillance sur le message */
.naifarlab-message::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #D7D3D2 20%, 
        #2E2A39 50%, 
        #D7D3D2 80%, 
        transparent 100%
    );
    opacity: 0.3;
}

/* Container de progression */
.naifarlab-progress-container {
    margin-bottom: 30px;
    animation: progressFadeIn 1s ease 0.6s backwards;
}

@keyframes progressFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Barre de progression */
.naifarlab-progress-bar {
    width: 100%;
    height: 12px;
    background: linear-gradient(90deg, #d9d6d8 0%, #e8e6e7 50%, #d9d6d8 100%);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        inset 0 2px 6px rgba(46, 42, 57, 0.08),
        0 2px 8px rgba(46, 42, 57, 0.06);
    position: relative;
    margin-bottom: 15px;
}

/* Remplissage de la barre */
.naifarlab-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2E2A39 0%, #4a4550 50%, #2E2A39 100%);
    background-size: 200% 100%;
    border-radius: 20px;
    transition: width 0.3s ease-out;
    position: relative;
    overflow: hidden;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Effet de brillance sur la barre */
.naifarlab-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

/* Texte de pourcentage */
.naifarlab-progress-text {
    text-align: center;
    margin-top: 12px;
}

.naifarlab-progress-percent {
    color: #2E2A39;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(46, 42, 57, 0.1);
}

/* Texte de chargement */
.naifarlab-loading-text {
    color: #6b6570;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Animation des points de chargement */
.naifarlab-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablettes */
@media (max-width: 768px) {
    .naifarlab-preloader-content {
        padding: 30px 20px;
    }
    
    .naifarlab-logo-svg {
        max-width: 350px;
    }
    
    .naifarlab-custom-logo {
        max-width: 220px;
    }
    
    .naifarlab-message {
        font-size: 22px;
        margin-bottom: 35px;
    }
    
    .naifarlab-progress-percent {
        font-size: 16px;
    }
    
    .naifarlab-loading-text {
        font-size: 14px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .naifarlab-preloader-content {
        padding: 20px 15px;
    }
    
    .naifarlab-logo-svg {
        max-width: 280px;
    }
    
    .naifarlab-custom-logo {
        max-width: 180px;
    }
    
    .naifarlab-message {
        font-size: 18px;
        margin-bottom: 30px;
        padding: 0 10px;
    }
    
    .naifarlab-progress-bar {
        height: 10px;
    }
    
    .naifarlab-progress-percent {
        font-size: 15px;
    }
    
    .naifarlab-loading-text {
        font-size: 13px;
    }
    
    .naifarlab-preloader-overlay::before,
    .naifarlab-preloader-overlay::after {
        width: 300px;
        height: 300px;
    }
}

/* ============================================
   ANIMATIONS SUPPLÉMENTAIRES PREMIUM
   ============================================ */

/* Pulse subtil sur le container */
@keyframes subtlePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Animation d'entrée pour le texte */
@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(46, 42, 57, 0.1);
    }
    50% {
        text-shadow: 0 0 20px rgba(46, 42, 57, 0.2);
    }
}

/* Effet de rotation douce pour le logo */
@keyframes gentleRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Bordure animée autour du container */
.naifarlab-preloader-content::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        #2E2A39, 
        #D7D3D2, 
        #2E2A39, 
        #D7D3D2
    );
    background-size: 400% 400%;
    border-radius: 20px;
    z-index: -1;
    opacity: 0.1;
    animation: gradientBorder 8s ease infinite;
    filter: blur(10px);
}

@keyframes gradientBorder {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Effet de verre (glassmorphism) optionnel */
.naifarlab-preloader-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    z-index: -1;
    opacity: 0;
    animation: glassAppear 2s ease 1s forwards;
}

@keyframes glassAppear {
    to {
        opacity: 1;
    }
}