/**
 * FULLSCREEN GALLERY - CSS Semplificato
 * Stile pulito e performante per zoom/pan nativo
 */

.fullscreen-gallery {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fullscreen-gallery.show {
    opacity: 1;
    visibility: visible;
}

.fullscreen-gallery__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s ease;
    backdrop-filter: blur(10px);
}

.fullscreen-gallery__close:hover,
.fullscreen-gallery__close:focus {
    background: rgba(255, 255, 255, 0.2);
}

.fullscreen-gallery__close svg {
    color: white;
}

.fullscreen-gallery__main {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Importante: previene scroll nativo durante touch */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.fullscreen-gallery__slides {
    width: 100%;
    height: 100%;
    position: relative;
}

.fullscreen-gallery__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.fullscreen-gallery__slide.active {
    display: flex;
}

.fullscreen-gallery__media {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-gallery__media img,
.fullscreen-gallery__media video {
    max-width: 100%;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    
    /* Accelerazione hardware per transform smooth */
    will-change: transform;
    transform-origin: center center;
    
    /* Touch ottimizzato */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    
    /* Previene selezione accidentale */
    pointer-events: auto;
}

/* Navigazione */
.fullscreen-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s ease, opacity 0.2s ease;
    backdrop-filter: blur(10px);
}

.fullscreen-gallery__nav:hover,
.fullscreen-gallery__nav:focus {
    background: rgba(255, 255, 255, 0.2);
}

.fullscreen-gallery__nav--prev {
    left: 1rem;
}

.fullscreen-gallery__nav--next {
    right: 1rem;
}

.fullscreen-gallery__nav svg {
    color: white;
}

/* Counter */
.fullscreen-gallery__counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10001;
    backdrop-filter: blur(10px);
}

/* Mobile ottimizzazioni */
@media (max-width: 768px) {
    /* Nascondi TUTTI i controlli in mobile - usa solo gesture touch */
    .fullscreen-gallery__close,
    .fullscreen-gallery__nav,
    .fullscreen-gallery__counter {
        display: none !important;
    }
}

/* Desktop - mostra controlli */
@media (min-width: 769px) {
    .fullscreen-gallery__close,
    .fullscreen-gallery__nav {
        width: 44px;
        height: 44px;
    }
    
    .fullscreen-gallery__close {
        top: 1rem;
        right: 1rem;
    }
    
    .fullscreen-gallery__nav--prev {
        left: 1rem;
    }
    
    .fullscreen-gallery__nav--next {
        right: 1rem;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .fullscreen-gallery__counter {
        bottom: 0.5rem;
    }
    
    .fullscreen-gallery__nav {
        top: 40%;
    }
}

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

.fullscreen-gallery__slide.active {
    animation: fadeIn 0.3s ease;
}

/* Accessibilità */
@media (prefers-reduced-motion: reduce) {
    .fullscreen-gallery,
    .fullscreen-gallery__media img,
    .fullscreen-gallery__media video,
    .fullscreen-gallery__slide {
        transition: none !important;
        animation: none !important;
    }
}

/* Focus visible per accessibilità keyboard */
.fullscreen-gallery__close:focus-visible,
.fullscreen-gallery__nav:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}
