/* YouTube Popup CSS per WordPress */
/* Salva questo file come: tuo-tema-child/css/youtube-popup.css */

/* Overlay del popup */
.youtube-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px); /* Effetto sfocatura dello sfondo */
}

/* Container del video */
.youtube-popup-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s ease-out;
}

/* Iframe del video YouTube */
.youtube-popup-video {
    width: 100%;
    height: 450px;
    border: none;
    display: block;
}

/* Pulsante di chiusura */
.youtube-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.youtube-popup-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.youtube-popup-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Stato "show" - popup visibile */
.youtube-popup-overlay.show {
    display: flex !important;
    animation: fadeIn 0.3s ease-out forwards;
}

.youtube-popup-overlay.show .youtube-popup-container {
    transform: scale(1);
    animation: slideIn 0.3s ease-out forwards;
}

/* Animazioni */
@keyframes fadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive Design */

/* Tablet */
@media (max-width: 768px) {
    .youtube-popup-container {
        width: 95%;
        margin: 20px;
        max-width: none;
    }
    
    .youtube-popup-video {
        height: 280px;
    }
    
    .youtube-popup-close {
        top: -35px;
        font-size: 20px;
        width: 35px;
        height: 35px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .youtube-popup-container {
        width: 98%;
        margin: 10px;
        border-radius: 4px;
    }
    
    .youtube-popup-video {
        height: 220px;
    }
    
    .youtube-popup-close {
        top: -30px;
        right: -5px;
        font-size: 18px;
        width: 30px;
        height: 30px;
    }
}

/* Mobile molto piccoli */
@media (max-width: 320px) {
    .youtube-popup-video {
        height: 180px;
    }
}

/* Accessibilità */
@media (prefers-reduced-motion: reduce) {
    .youtube-popup-overlay,
    .youtube-popup-container,
    .youtube-popup-close {
        animation: none !important;
        transition: none !important;
    }
    
    .youtube-popup-overlay.show .youtube-popup-container {
        transform: scale(1);
    }
}

/* Focus per navigazione da tastiera */
.youtube-popup-close:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* Stile per schermi ad alto contrasto */
@media (prefers-contrast: high) {
    .youtube-popup-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .youtube-popup-close {
        background: white;
        color: black;
        border: 2px solid black;
    }
}