/**
 * WP Mobile Lightbox CSS
 * Stili per lightbox mobile con pinch-to-zoom
 * Version: 1.0.0
 */

/* Lightbox principale */
.wlb-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 999999;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.wlb-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Container principale */
.wlb-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Wrapper immagine */
.wlb-image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Immagine principale */
.wlb-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.2s ease-out;
    transform-origin: center;
}

.wlb-image.loaded {
    opacity: 1;
}

/* Indicatore di caricamento */
.wlb-loading {
    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: #fff;
    border-radius: 50%;
    animation: wlb-spin 0.8s linear infinite;
    display: none;
    pointer-events: none;
}

.wlb-loading.active {
    display: block;
}

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

/* Pulsanti di controllo */
.wlb-close, 
.wlb-prev, 
.wlb-next {
    position: absolute;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 36px;
    width: 50px;
    height: 50px;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
    border-radius: 50%;
    line-height: 1;
    padding: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.wlb-close:active, 
.wlb-prev:active, 
.wlb-next:active {
    opacity: 1;
    background: rgba(255,255,255,0.2);
}

.wlb-close:hover,
.wlb-prev:hover,
.wlb-next:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

/* Posizionamento pulsanti */
.wlb-close {
    top: 15px;
    right: 15px;
}

.wlb-prev {
    left: 15px;
    top: 50%;
    margin-top: -25px;
}

.wlb-next {
    right: 15px;
    top: 50%;
    margin-top: -25px;
}

.wlb-prev:disabled, 
.wlb-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Contatore immagini */
.wlb-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    padding: 6px 14px;
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
    backdrop-filter: blur(10px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Indicatore zoom attivo */
.wlb-image-wrapper::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: none;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.wlb-image[style*="scale"] ~ .wlb-image-wrapper::after {
    display: block;
}


/* Media queries per tablet e desktop */
@media (min-width: 768px) {
    .wlb-close, 
    .wlb-prev, 
    .wlb-next {
        width: 60px;
        height: 60px;
        font-size: 42px;
    }
    
    .wlb-prev { 
        left: 25px; 
    }
    
    .wlb-next { 
        right: 25px; 
    }
    
    .wlb-counter { 
        font-size: 16px; 
    }
}

/* Accessibilità */
@media (prefers-reduced-motion: reduce) {
    .wlb-image,
    .wlb-loading,
    .image-gallery::before {
        animation: none;
        transition: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .image-gallery::before {
        background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(33, 150, 243, 0.08));
        border-color: rgba(33, 150, 243, 0.3);
        color: #64b5f6;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .wlb-lightbox {
        background: rgba(0,0,0,0.98);
    }
    
    .wlb-close, 
    .wlb-prev, 
    .wlb-next {
        background: rgba(255,255,255,0.2);
        border: 1px solid rgba(255,255,255,0.5);
    }
    
    .wlb-counter {
        background: rgba(0,0,0,0.8);
        border: 1px solid rgba(255,255,255,0.3);
    }
}