/* ==========================================
   VIDEO GALLERY STYLES
   ========================================== */

/* Container principale video gallery */
.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Singolo video container */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Video element styling */
.video-gallery video {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    object-fit: cover;
    aspect-ratio: 16/9;
}

/* Play button overlay */
.video-container::before {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1;
    display: none;
}

.video-container:hover::before {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
}

/* Hide play button when video is playing */
.video-container.playing::before {
    opacity: 0;
}

/* Video caption */
.video-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 20px 15px 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.video-container:hover .video-caption {
    transform: translateY(0);
}

/* Video controls custom styling */
video::-webkit-media-controls {
    background: transparent;
}

video::-webkit-media-controls-panel {
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.5));
}

/* Loading state */
.video-loading {
    position: relative;
}

.video-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-gallery {
        grid-template-columns: 1fr;
        padding: 20px 10px;
    }
    
    .video-container::before {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .video-gallery {
        gap: 15px;
    }
    
    .video-caption {
        font-size: 0.8rem;
        padding: 15px 10px 10px;
    }
}

/* Fullscreen video modal */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.video-modal.active {
    display: flex;
}

.video-modal video {
    max-width: 90%;
    max-height: 90vh;
}

.video-modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.video-modal-close:hover {
    color: #ff6b6b;
}


        /* Stili per il video container */

        .video-container {
            width: 100vw;
            margin-left: calc(-50vw + 50%);
            position: relative;
            background: #333;
            margin-bottom: 0px;
            margin-top: 45px;
            display: flex;
            align-items: center;
            justify-content: center;
            height: calc(100vh - 45px); /* Altezza iniziale 100vh */
            transition: height 0.3s ease; /* Transizione smooth per il cambio altezza */
        }

        .video-wrapper {
            position: relative;
            width: 100%;
        }

        #responsive-video {
            width: 100%;
            height: auto;
            display: block;
            max-height: 100%;
            object-fit: contain;
        }

        /* Controlli video personalizzati */
        .video-controls {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 30px;
            z-index: 1000;
        }

        .control-btn {
            width: 50px;
            height: 50px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            font-size: 24px;
            font-weight: normal;
            transition: all 0.3s ease;
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .control-btn:hover {
            background: rgba(0, 0, 0, 0.9);
            transform: scale(1.1);
        }

        .control-btn.active {
            background: rgba(255, 255, 255, 0.3);
            color: white;
        }

        .control-btn i {
            pointer-events: none;
            transition: transform 0.2s ease;
            font-size: 16px;
        }

        .control-btn:hover i {
            /*  transform: scale(1.1); */
        }

        @media (max-width: 768px) {
            .video-controls {
                bottom: 10px;
                gap: 10px;
            }
            
            .control-btn {
                width: 50px;
                height: 50px;
                font-size: 18px;
            }
        }

        /* Loading indicator */
        .loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 18px;
            z-index: 999;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .loading::after {
            display: none;  /* Disabilita l'icona */
            content: '';
            width: 40px;
            height: 40px;
            right: -55px;
            bottom: -6px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top: 2px solid #ffffff;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            position: absolute;
        }

        .loading::before {
            content: '';
            position: absolute;
            right: -50px;
            width: 30px;
            height: 30px;
            border: 2px solid rgba(255, 255, 255, 0.2);
            border-top: 2px solid rgba(255, 255, 255, 0.8);
            border-radius: 50%;
            animation: spin 0.8s linear infinite reverse;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }


        
        /* Responsive */
        @media (max-width: 768px) {
            .presentation-card {
                flex-direction: column;
                text-align: center;
            }
            
            .date-badge {
                align-self: center;
            }
            
            .presentations-grid {
                grid-template-columns: 1fr;
            }
        }

        /* Responsive adjustments */
        @media (max-width: 768px) {
            .container {
                padding: 10px;
            }
            
            .content {
                padding: 20px;
            }
            
            .video-controls {
                bottom: 10px;
                gap: 10px;
            }
            
            .control-btn {
                padding: 10px 15px;
                font-size: 12px;
            }
        }

        /* Orientamento specifico */
        @media screen and (orientation: portrait) {
            .video-controls {
                bottom: 40px;
                gap: 30px;
            }

            .video-container {
                max-height: calc(100vh - 100px);
            }

            .video-container.video-loaded {
                height: auto; /* Altezza automatica quando il video è caricato */
                max-height: calc(100vh - 100px);
            }
        }

        @media screen and (orientation: landscape) {
            .video-container {
                max-height: calc(100vh - 45px);
            }

            .video-container.video-loaded {
                height: auto; /* Altezza automatica quando il video è caricato */
                max-height: calc(100vh - 45px);
            }
        }