/* Smartphone portrait - VERSIONE OTTIMIZZATA */
@media (max-width: 767.98px) and (orientation: portrait) {
    .video-bg {
        position: absolute;
        top: 10vh;                          /* CAMBIATO: da 10vh a 0 */
        left: 0;
        width: 100vw;
        height: 110vh;                   /* Altezza piena schermo */
        overflow: hidden !important;
        z-index: 0;
        background-color: black;
        transform: translate(0%, 0%); /* Ricentra il video */
    }

    .video-bg iframe {
        position: absolute;
        top: 50%;
        left: 50%;
        /* Dimensioni ottimizzate per eliminare bande */
        width: 100vw;                    /* Larghezza schermo */
        height: 56.25vw;                 /* Altezza 16:9 (100vw * 9/16) */
        min-height: 110vh;               /* Garantisce copertura verticale completa */
        min-width: 177.78vh;             /* Garantisce copertura orizzontale (100vh * 16/9) */
        transform: translate(-50%, -50%) !important;
        pointer-events: none;
        border: 0;
    }

    .video-content {
        position: absolute;
        z-index: 2;
        top: 50%;
        left: 50%;
        transform: translate(-50%, 0%) !important; /* SPOSTA I TESTI ALL INTERNO DEL FRAME. VALORE A DESTRA ASSE Y, VALORE A SINISTRA ASSE X */
        height: auto;
        width: 90%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 20px;
    }

    .video-content h1 {
        font-family: 'NokiaExpanded-Bold', sans-serif;
        font-size: 8vw;
        line-height: 1.2;
        margin-bottom: 15px;
        color: white;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    }

    .video-content h2 {
        font-family: 'Aptos-Regular', sans-serif;
        font-size: 5.5vw;
        line-height: 1.3;
        margin-bottom: 20px;
        color: white;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    }

    .btn {
        font-size: 3.5vw;
        padding: 15px 30px;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    }
}

/* Smartphone landscape - MESSAGGIO MIGLIORATO */
@media (max-width: 767.98px) and (orientation: landscape) {
    .video-bg,
    .video-content {
        display: none !important;
    }

    body::before {
        content: "📱 Per una migliore esperienza, ruota il dispositivo in modalità verticale.";
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        font-size: 4vw;                  /* Ridotto da 5vw */
        color: #ffffff;
        background: linear-gradient(135deg, #1e3c72, #2a5298);  /* Gradiente invece di nero */
        height: 100vh;
        width: 100vw;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9999;
        padding: 20px;
        font-family: 'Aptos-Regular', sans-serif;
    }
}

/* ALTERNATIVE: Se preferisci mantenere le dimensioni originali ma con migliore centratura */
@media (max-width: 767.98px) and (orientation: portrait) {
    /* Alternativa A: Video più grande ma meglio centrato */
    .video-bg-alt {
        position: absolute;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden !important;
        z-index: 0;
        background-color: black;
    }

    .video-bg-alt iframe {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 300vw;                    /* Mantenuto grande per eliminare bande */
        height: 300vh;
        transform: translate(-50%, -50%) scale(0.8) !important;  /* Scale ottimizzato */
        pointer-events: none;
        border: 0;
    }
}

/* Tablet portrait - PICCOLI MIGLIORAMENTI */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: portrait) {
    .video-bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden !important;
        z-index: 0;
        background-color: black;         /* Aggiunto fallback */
    }

    .video-bg iframe {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 280vw;
        height: 280vh;
        transform: translate(-50%, -50%) scale(1.1) !important;  /* Migliorato da -52% */
        pointer-events: none;
        border: 0;
    }

    .video-content {
        position: absolute;
        z-index: 2;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) !important;  /* Centrato meglio */
        width: 85%;
        height: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 20px;
    }

    .video-content h1 {
        font-family: 'NokiaExpanded-Bold', sans-serif;
        font-size: 4.5vw;                /* Ridotto da 5vw */
        line-height: 1.2;
        margin-bottom: 15px;
        color: white;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    }

    .video-content h2 {
        font-family: 'Aptos-Regular', sans-serif;
        font-size: 2.8vw;                /* Ridotto da 3vw */
        line-height: 1.3;
        margin-bottom: 20px;
        color: white;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    }

    .btn {
        font-size: 2.2vw;                /* Ridotto da 2.5vw */
        padding: 12px 24px;              /* Aumentato padding */
        border-radius: 6px;
        box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    }
}