/* ============================================================
   FIX SPLASH SCREEN: V6 (LUMINOSITÀ 0.7)
   ============================================================ */

#loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2147483647 !important;
    
    /* SFONDO 0.7
       Start: 30% scuro in alto (per far vedere il cielo).
       End: 70% scuro in basso (per far risaltare la scritta).
    */
    background: 
        linear-gradient(180deg, rgba(35, 26, 56, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%),
        url('../splash_bg.png') !important;
        
    background-size: cover !important;
    background-position: center bottom !important;
    background-repeat: no-repeat !important;
    
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    
    transition: opacity 0.3s ease-out !important;
}

/* Bagliore ambientale dietro al logo */
.splash-glow-bg {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(90, 123, 237, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: breathe 3s infinite ease-in-out;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px; /* Spazio ridotto */
    position: relative;
    z-index: 2;
}

/* ============================================================
   FIX FLUIDITÀ SPLASH SCREEN (LOOP PERFETTO)
   ============================================================ */

.splash-logo {
    font-family: 'Manrope', sans-serif;
    font-size: 42px !important;
    font-weight: 800 !important;
    letter-spacing: -1px !important;
    display: block !important;
    
    /* IL SEGRETO DELLA FLUIDITÀ:
       Start (Blu) -> Luce (Bianco) -> End (Blu).
       Inizia e finisce con lo stesso colore (#5A7FFF), così non vedi lo scatto.
    */
    background-image: linear-gradient(
        90deg,
        #5A7FFF 0%,    /* Blu Indaco */
        #D926A9 25%,   /* Rosa Fucsia */
        #FFFFFF 50%,   /* LUCE CENTRALE */
        #D926A9 75%,   /* Rosa Fucsia */
        #5A7FFF 100%   /* Blu Indaco (Chiude il cerchio) */
    ) !important;
    
    /* La dimensione deve essere 200% per contenere tutto il ciclo */
    background-size: 200% auto !important;
    
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    
    /* Animazione lineare (senza accelerazioni/frenate) */
    animation: splashFlow 3s linear infinite !important;
    
    opacity: 1 !important;
    visibility: visible !important;
}

/* ============================================================
   SPLASH ICON (UNIFICATO: ANIMAZIONE + GLOW)
   ============================================================ */
.splash-icon svg {
    /* 1. Dimensioni e Stato Iniziale */
    width: 60px;
    height: 60px;
    opacity: 0;
    transform: translateY(20px);

    /* 2. Animazioni Combinate (Entrata scattante + Galleggiamento lento) */
    animation: slideUpFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards, 
               float 6s ease-in-out infinite 0.8s;

    /* 3. Stile Visuale (Spessore aumentato per catturare il colore) */
    stroke-width: 2.5px !important;
   
    /* 4. Visibilità */
    overflow: visible !important; /* Fondamentale per non tagliare l'ombra luminosa */
}

/* Barra */
.splash-bar {
    width: 140px;
    height: 4px; /* Un pixel più alta per visibilità */
    background: rgba(255, 255, 255, 0.1); /* Sfondo del binario più visibile */
    border-radius: 10px;
    overflow: hidden;
    margin-top: 15px;
    opacity: 0;
    /* Animazione di comparsa dell'intera barra */
    animation: fadeIn 0.5s ease 0.2s forwards;
    
    /* FIX ALLINEAMENTO: Assicura che il contenuto parta da sinistra */
    display: flex;
    justify-content: flex-start; 
}

.splash-bar-fill {
    height: 100%;
    width: 0%; /* Parte TASSATIVAMENTE da 0 */
    background: linear-gradient(90deg, #5A7BED, #C764E3);
    box-shadow: 0 0 15px rgba(90, 123, 237, 0.6); /* Glow più intenso */
    border-radius: 10px;
    
    /* FIX ANIMAZIONE:
       - Duration: 1.8s (copre quasi tutto il tempo di attesa di 2s)
       - Timing: Ease-Out (parte veloce, rallenta alla fine) per senso di caricamento
       - Delay: 0.3s (aspetta che appaia il logo)
    */
    animation: loadBar 1.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

/* Footer */
.splash-footer {
    position: absolute;
    bottom: 40px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Manrope', sans-serif;
    opacity: 0;
    animation: fadeIn 1s ease 0.5s forwards;
}

/* ============================================================
   EFFETTO METEORE (SPLASH SCREEN) - V6 (Full Screen)
   ============================================================ */

.meteor-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1; 
    pointer-events: none;
}

.meteor-container span {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Più grandi e visibili */
    width: 6px; 
    height: 6px;
    background: #fff;
    border-radius: 50%;
    /* Bagliore più forte */
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2), 
                0 0 0 8px rgba(255, 255, 255, 0.1), 
                0 0 24px rgba(255, 255, 255, 1);
    animation: meteor 3s linear infinite;
    opacity: 0;
}

/* La coda della cometa (Più spessa) */
.meteor-container span::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: 2px; /* Coda più spessa */
    background: linear-gradient(90deg, #fff, transparent);
}

/* --- FIX BUG TRANSITION SPLASH SCREEN --- */

/* 1. Gestione Overlay Padre */
#loading-overlay.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    /* Lasciamo una transizione sullo sfondo per l'effetto dissolvenza */
    transition: opacity 0.4s ease-out, visibility 0.4s !important;
}

/* 2. KILLER SWITCH: Contenuto Interno */
/* Appena aggiungiamo la classe .hidden, tutto il contenuto interno deve sparire
   LEGGERMENTE prima dello sfondo, per evitare l'effetto "fantasma" */
#loading-overlay.hidden * {
    opacity: 0 !important;
    animation: none !important; /* Ferma le meteore e il logo */
    transition: opacity 0.2s ease-out !important; /* Sparisci veloce */
}

/* --- DISTRIBUZIONE A TUTTO SCHERMO --- */
/* Usiamo percentuali per coprire tutto lo schermo dall'alto al basso */

/* In alto a destra */
.meteor-container span:nth-child(1) { top: 0%; right: 0; animation-delay: 0s; animation-duration: 2.5s; }

/* Centro destra */
.meteor-container span:nth-child(2) { top: 40%; right: -100px; animation-delay: 0.2s; animation-duration: 3s; }

/* In basso a destra (per coprire la parte bassa) */
.meteor-container span:nth-child(3) { top: 80%; right: -50px; animation-delay: 0.4s; animation-duration: 2s; }

/* In alto centrale */
.meteor-container span:nth-child(4) { top: -50px; right: 40%; animation-delay: 0.6s; animation-duration: 1.5s; }

/* Centro schermo */
.meteor-container span:nth-child(5) { top: 50%; right: 20%; animation-delay: 0.8s; animation-duration: 2.5s; }

/* Molto in basso */
.meteor-container span:nth-child(6) { top: 90%; right: 10%; animation-delay: 1s; animation-duration: 3s; }

/* In alto a sinistra */
.meteor-container span:nth-child(7) { top: 10%; right: 60%; animation-delay: 1.2s; animation-duration: 1.75s; }

/* Casuale centro */
.meteor-container span:nth-child(8) { top: 30%; right: 30%; animation-delay: 1.4s; animation-duration: 1.25s; }

/* Casuale basso */
.meteor-container span:nth-child(9) { top: 70%; right: 50%; animation-delay: 0.75s; animation-duration: 2.25s; }
