/* index.css - Stili specifici per la Landing Page / Vetrina */

/* Impostazione Tema Base (Rosso) per la pagina esterna */
body {
    --theme-color: #ff1a1a;
    --theme-dark: #8a0303;
    --theme-glow: rgba(255, 26, 26, 0.6);
    --theme-glow-light: rgba(138, 3, 3, 0.2);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* Classi di utilità per stratificazione sfondi animati e controllo testo */
.relative-sec {
    position: relative;
    overflow: hidden;
}
.relative-z {
    position: relative;
    z-index: 10;
}
.nowrap {
    white-space: nowrap;
}
.mobile-break {
    display: none;
}

/* Modifiche Header per il bottone di Login (preservando il badge per l'altezza) */
.header-right-actions {
    display: flex;
    align-items: center;
    gap: 0; /* Rimosso il gap per non sommare spazio vuoto tra bottone e badge invisibile */
}

.header-auth-btn {
    margin-top: 0 !important;
    padding: 10px 22px !important;
    width: auto !important;
    font-size: 0.9em !important;
    border-radius: 8px !important; /* Angoli un po' più tondi */
}

.main-header {
    width: 100%;
    position: relative;
    z-index: 20; /* Sopra le animazioni di background */
}

.index-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0; /* Modificato: il padding ora è gestito dalle sezioni fullscreen */
    max-width: 100%; /* Modificato: tolto il limite di 1200px per far espandere i background */
    margin: 0 auto;
    width: 100%;
}

/* ====================================
   ARCHITETTURA A SEZIONI FULL-SCREEN 
   ==================================== */
.fullscreen-section {
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* Fix WebViews per blocchi statici a schermo intero */
    min-height: 100svh; /* Usa svh per non rischiare che i testi sul fondo vengano coperti dai browser mobile */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    box-sizing: border-box;
}

/* Specifico per la prima sezione che ingloba l'header e gli sfondi animati */
.hero-wrapper {
    padding: 0;
    justify-content: flex-start;
    position: relative;
    overflow: hidden; /* Nasconde ciò che esce dalla griglia/particelle */
    background-color: #000;
}

/* Alternanza Sfondi delle Sezioni statiche */
.section-dark {
    background-color: transparent; 
}

.section-light {
    background-color: #0d0d0d;
    border-top: 1px solid #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
}

/* ==============================================
   NUOVI SFONDI ANIMATI HERO (Vita alla Vetrina)
   ============================================== */

/* 1. Effetto CRT/Scanline Terminale */
.scanlines {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.2) 50%,
        rgba(0,0,0,0.2)
    );
    background-size: 100% 4px;
    z-index: 10;
    pointer-events: none; /* Non intralciare i click */
}

/* 2. Griglia Digitale in Prospettiva (Visibilità aumentata da 0.1 a 0.35) */
.digital-grid {
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 200%;
    height: 150%;
    background-image: 
        linear-gradient(to right, rgba(255, 26, 26, 0.35) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 26, 26, 0.35) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg);
    animation: gridMove 20s linear infinite;
    z-index: 1;
    pointer-events: none;
    /* Sfumatura in alto per fondersi col nero */
    mask-image: linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0));
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0));
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 0 400px; }
}

/* 3. Contenitore Particelle di Tempo JS */
.time-stream-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.time-particle {
    position: absolute;
    color: var(--theme-color);
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    opacity: 0;
    bottom: -50px;
    text-shadow: 0 0 10px var(--theme-color);
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.8); opacity: 0; }
    20% { opacity: 0.3; }
    80% { opacity: 0.3; }
    100% { transform: translateY(-100vh) scale(1.2); opacity: 0; }
}


/* ==============================
   HERO SECTION (Testo centrato)
   ============================== */
.hero-section {
    flex: 1; /* Prende tutto lo spazio rimanente sotto l'header */
    display: flex;
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 800px; /* Limite interno per il testo */
    text-align: center; /* Testo centrato per design fullscreen */
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 15; /* Sopra griglia e particelle, sotto scanline */
}

.hero-content {
    width: 100%;
}

.hero-content h1 {
    color: var(--theme-color);
    font-size: 2.5em;
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--theme-glow);
    line-height: 1.2;
}

.hero-content p {
    color: #ccc;
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.hero-content p.highlight {
    color: #fff;
    font-weight: bold;
}

.fake-timer {
    margin-top: 30px;
    font-size: 3em;
    font-weight: bold;
    color: #444;
    letter-spacing: 5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Pulsazione forte per richiamare urgenza */
.fake-timer .neon-text {
    color: var(--theme-color);
    text-shadow: 0 0 15px var(--theme-glow);
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; text-shadow: 0 0 15px var(--theme-glow); }
    50% { opacity: 0.6; text-shadow: 0 0 5px var(--theme-glow-light); }
}

/* ================================
   FEATURES SECTION (Griglia a 3)
   ================================ */
.features-section {
    width: 100%;
    max-width: 1200px; 
    text-align: center;
}

.features-section h2 {
    color: #fff;
    font-size: 1.8em;
    letter-spacing: 2px;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* ------------------------------------------------------------------
   TICKER DINAMICO BOT NELLA VETRINA (Scorrevole in stile Dashboard)
   ------------------------------------------------------------------ */
#landing-ticker-reserved-space {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 800px; /* Limita la larghezza dello scorrimento */
    height: 45px;
    margin: 0 auto 30px auto; /* Centrato, con spazio sotto prima delle card */
}

#landing-ticker-container {
    height: 100%;
    width: 100%;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

/* Accende lo stile cyber-blue solo quando c'è l'animazione */
#landing-ticker-container.active-ticker {
    background-color: #001226 !important;
    border: 1px solid #00d4ff !important;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.4), inset 0 0 8px rgba(0, 212, 255, 0.1) !important;
}

.landing-ticker-text {
    position: absolute;
    white-space: nowrap;
    color: #00d4ff;
    font-weight: bold;
    font-size: 1.2em;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
    will-change: transform, left; /* Ottimizzazione GPU */
    animation: landingTickerSlide 10s linear forwards;
}

@keyframes landingTickerSlide {
    0% { left: 100%; transform: translateX(0); }
    100% { left: 0%; transform: translateX(-100%); }
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    perspective: 1000px; /* Necessario per il 3D tilt */
}

/* Restyling Feature Card base */
.feature-card {
    background: linear-gradient(145deg, #111111, #080808);
    border: 1px solid #222;
    padding: 40px 30px;
    border-radius: 12px;
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    /* Transform transition per far fluire il reset JS */
    transition: transform 0.2s ease-out, box-shadow 0.4s ease, border-color 0.4s ease;
    transform-style: preserve-3d;
    /* Rimuove l'alone di tocco dai dispositivi mobili */
    -webkit-tap-highlight-color: transparent;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--theme-color), transparent);
    opacity: 0.2;
    transition: opacity 0.4s ease;
}

.feature-icon {
    font-size: 2.5em;
    color: var(--theme-color);
    margin-bottom: 20px;
    display: inline-block;
    text-shadow: 0 0 15px var(--theme-glow);
    transition: transform 0.3s ease;
}

.feature-card h3 {
    color: var(--theme-color);
    margin-bottom: 15px;
    font-size: 1.3em;
    transform: translateZ(20px);
}

.feature-card p {
    color: #999;
    font-size: 0.95em;
    line-height: 1.6;
    transform: translateZ(10px);
}


/* ==========================================
   ANIMAZIONI SPECIFICHE CARD HOVER E SFONDI
   ========================================== */

/* Sfondo Rete (Section Light) */
.network-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(circle at center, rgba(255, 26, 26, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.3;
    animation: drift 40s linear infinite;
    z-index: 1;
}
@keyframes drift {
    0% { background-position: 0 0; }
    100% { background-position: -300px 300px; }
}

/* Card 1: Cerchia (Onda Radar - Base posizionamento) */
.radar-ring {
    position: absolute;
    top: 55px; /* Centrato approssimativamente sull'icona */
    left: 45px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--theme-color);
    opacity: 0;
    transform: scale(1);
}

/* Card 2: Tempo (Raggio Laser/Trasferimento - Base posizionamento) */
.transfer-beam {
    position: absolute;
    top: 65px;
    left: -100%;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--theme-color), transparent);
    box-shadow: 0 0 10px var(--theme-color);
    opacity: 0;
}

/* Card 3: Strategia (Scacchiera Sfondo - Base posizionamento) */
.chess-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(45deg, #181818 25%, transparent 25%, transparent 75%, #181818 75%, #181818), 
        linear-gradient(45deg, #181818 25%, transparent 25%, transparent 75%, #181818 75%, #181818);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 0;
}

/* =============================================================
   REGOLE HOVER ESCLUSIVE PER DISPOSITIVI CON MOUSE (PC) 
   Sui touch (smartphone/tablet) l'hover non resterà incastrato
   ============================================================= */
@media (hover: hover) and (pointer: fine) {
    .feature-card:hover {
        border-color: var(--theme-dark);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 20px var(--theme-glow-light);
    }
    .feature-card:hover::before {
        opacity: 1;
    }
    .feature-card:hover .feature-icon:not(.knight-icon) {
        transform: scale(1.1) translateZ(30px);
    }
    .card-cerchia:hover .radar-ring {
        animation: radarPulse 2s ease-out infinite;
    }
    .card-cerchia:hover .radar-ring.delay {
        animation-delay: 1s;
    }
    .card-tempo:hover .transfer-beam {
        animation: shootBeam 1.5s ease-in-out infinite;
    }
    .card-strategia:hover .chess-bg {
        opacity: 0.4;
    }
    .card-strategia:hover .knight-icon {
        animation: knightJumpReturn 2.5s ease-in-out infinite;
    }
}


/* ==================================================================
   ANIMAZIONI ONE-SHOT & GLOW DA SCROLL (PC, Tablet, Smartphone)
   Si attivano quando la card centra l'area di trigger nello schermo
   ================================================================== */
.feature-card.touch-once-active {
    border-color: var(--theme-dark);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 20px var(--theme-glow-light);
}
.feature-card.touch-once-active::before {
    opacity: 1;
}
.feature-card.touch-once-active .feature-icon:not(.knight-icon) {
    transform: scale(1.1) translateZ(30px);
}

.card-cerchia.touch-once-active .radar-ring {
    animation: radarPulse 2s ease-out 1;
}
.card-cerchia.touch-once-active .radar-ring.delay {
    /* La prima card termina il ciclo a 3 secondi esatti (2s animazione + 1s delay) */
    animation-delay: 1s;
}
.card-tempo.touch-once-active .transfer-beam {
    /* Allineato a 3s esatti per sincro perfetto con il JS e le altre card */
    animation: shootBeam 3s ease-in-out 1;
}
.card-strategia.touch-once-active .chess-bg {
    /* Allineato a 3s esatti */
    animation: chessFadeInOut 3s ease-in-out 1;
}
.card-strategia.touch-once-active .knight-icon {
    /* Allineato a 3s esatti per non terminare in anticipo rispetto al bordo */
    animation: knightJumpReturn 3s ease-in-out 1;
}


/* Keyframes condivisi */
@keyframes radarPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(8); opacity: 0; }
}

@keyframes shootBeam {
    0% { left: -60%; opacity: 0; }
    50% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

@keyframes chessFadeInOut {
    0%, 100% { opacity: 0; }
    40%, 60% { opacity: 0.4; }
}

@keyframes knightJumpReturn {
    0%, 100% { transform: translate(0) scale(1) translateZ(0); }
    40%, 60% { transform: translate(25px, -15px) scale(1.1) translateZ(30px); }
}


/* ======================
   BOTTOM CALL TO ACTION
   ====================== */
.bottom-cta {
    width: 100%;
    text-align: center;
    position: relative;
}

.bottom-cta-content {
    max-width: 800px;
    margin: 0 auto;
}

.bottom-cta h2 {
    color: #fff;
    font-size: 2.2em;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.bottom-cta p {
    color: #aaa;
    margin-bottom: 40px;
    font-size: 1.15em;
    line-height: 1.6;
}

/* Bottone CTA in pillola */
.bottom-cta .auth-btn {
    display: inline-block;
    width: auto;
    padding: 16px 50px;
    font-size: 1.2em;
    border-radius: 30px;
    letter-spacing: 2px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.bottom-cta .auth-btn:hover {
    box-shadow: 0 0 25px var(--theme-glow), inset 0 0 10px rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Sfondo Battito Cardiaco (Pulse Bg) */
.pulse-bg {
    position: absolute;
    top: 50%; left: 50%;
    width: 100vw; height: 100vw;
    margin-top: -50vw; margin-left: -50vw;
    background: radial-gradient(circle, rgba(255, 26, 26, 0.15) 0%, transparent 60%);
    opacity: 0.5;
    animation: heartBeat 2s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}
@keyframes heartBeat {
    0% { transform: scale(1); opacity: 0.3; }
    15% { transform: scale(1.1); opacity: 0.6; }
    30% { transform: scale(1); opacity: 0.3; }
    45% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.3; }
}

/* ====================================== */
/* MODALE AUTENTICAZIONE E ALTRE CLASSI   */
/* ====================================== */

/* Wrapper auth condiviso nella hero section (ORA NEL MODALE) */
.auth-wrapper {
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: center;
    margin: auto; /* Aiuta a centrare dentro il modale */
}

/* Container Auth (Login/Register) e Animazione Riflesso (Shine) */
.container {
    position: relative;
    overflow: hidden; /* Fondamentale per non far sbordare l'animazione dal box */
}

.container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
    transform: skewX(-25deg);
    animation: shine 6s infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes shine {
    0% { left: -150%; }
    20%, 100% { left: 200%; }
}

/* BOX AUTENTICAZIONE */
.auth-box {
    background-color: #0a0a0a;
    border: 1px solid #333;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), 0 0 15px var(--theme-glow-light);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-box h2 {
    color: #fff;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.auth-box p {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 25px;
}

.auth-btn {
    display: block;
    text-decoration: none;
    text-align: center;
}

.auth-separator {
    margin: 25px 0;
    position: relative;
    text-align: center;
}

.auth-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #333;
    z-index: 1;
}

.auth-separator span {
    background-color: #0a0a0a;
    padding: 0 10px;
    color: #666;
    font-size: 0.85em;
    position: relative;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-btn-secondary {
    display: block;
    width: 100%;
    padding: 14px;
    background-color: transparent;
    border: 1px solid #555;
    border-radius: 5px;
    color: #fff;
    font-size: 1em;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.3s ease;
}

.auth-btn-secondary:hover {
    border-color: #fff;
    background-color: #111;
}

/* ====================================
   USER BADGE E LOGO (Gestione Header)
   ==================================== */
.main-header .logo {
    white-space: nowrap; /* Impedisce al nome del sito di andare a capo */
}

.user-badge {
    visibility: hidden;
    pointer-events: none;
}

/* =============================
   MODALE AUTENTICAZIONE POP-UP
   ============================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; 
	height: 100vh;
    height: -webkit-fill-available; /* Fix WebView per i modali */
    height: 100svh; /* Usa svh per non tagliare fuori bottoni inferiori se la UI del browser copre lo schermo */
    background: rgba(0, 0, 0, 0.2);                                     /*Livello opacità del nero*/
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);     /*Livello blur*/
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-close-btn {
    position: absolute;
    top: 25px; right: 35px;
    background: transparent; border: none;
    color: #fff; font-size: 2.2em;
    cursor: pointer; z-index: 100;
    transition: color 0.3s ease, transform 0.3s ease;
}

.modal-close-btn:hover {
    color: var(--theme-color);
    transform: scale(1.1);
}

/* =========================
   ANIMAZIONI E RESPONSIVE
   ========================= */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

@media screen and (max-width: 992px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    /* Attivazione interruzione di riga su mobile per il titolo */
    .mobile-break {
        display: block;
    }
    
    .features-section h2 {
        font-size: 1.15em;
        letter-spacing: 1px;
    }
    
    /* Regolazione H1 su smartphone per mantenere nowrap */
    .hero-content h1 {
        font-size: 1.5em;
    }

    /* Modale Smartphone: Schermata totalmente Nera (No Blur) */
    .modal-overlay {
        background: #000000 !important; 
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 10px;
    }
    
    .modal-close-btn {
        top: 15px;
        right: 20px;
    }

    /* Bottone Login più piccolo su smartphone e piccoli schermi */
    .header-auth-btn {
        padding: 8px 14px !important;
        font-size: 0.85em !important;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .fake-timer {
        font-size: 2.2em;
        letter-spacing: 2px;
    }
    .bottom-cta h2 {
        font-size: 1.6em;
    }
    
    /* Riduzione visiva sfondo per prestazioni mobile */
    .digital-grid {
        background-size: 25px 25px;
        animation-duration: 35s; /* Rallentata l'animazione per evitare lag e distrazioni */
    }
    
    /* Disattiva 3D tilt su mobile per performance */
    .feature-card {
        transform: none !important;
    }
    
    /* Ticker della landing page responsivo su mobile */
    .landing-ticker-text {
        font-size: 1.05em;
    }
    
    /* Assicura che il padding consenta il nowrap senza sbordare su mobile */
    .bottom-cta .auth-btn {
        padding: 14px 20px;
    }
}

@media screen and (max-width: 576px) {
    .landing-ticker-text {
        font-size: 0.9em;
        animation-duration: 14s; /* Scorre più lentamente per facilitare la lettura su schermi stretti */
    }
}

/* =========================================================================
   OTTIMIZZAZIONE PERFORMANCE: FREEZE ANIMAZIONI FUORI SCHERMO
   Mette in pausa le animazioni CSS se l'IntersectionObserver 
   rileva che la sezione è 0% visibile (completamente fuori schermo).
   Riprendono esattamente da dove si erano fermate appena tornano visibili.
   ========================================================================= */
.is-paused .digital-grid,
.is-paused .time-particle,
.is-paused .pulse-bg,
.is-paused .fake-timer .neon-text {
    animation-play-state: paused !important;
}