/* WordPress Lightbox Styles */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    touch-action: pan-y pinch-zoom; /* Allow touch gestures */
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    margin: 20px;
    touch-action: pan-y pinch-zoom; /* Allow touch gestures */
}

.lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: block;
    margin: 0 auto;
    transition: opacity 0.3s ease;
    touch-action: pan-y pinch-zoom; /* Allow touch gestures */
    -webkit-user-drag: none;
    user-select: none;
}

.lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 0 0 8px 8px;
    pointer-events: none; /* Don't interfere with touches */
}

.lightbox-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1.2em;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.lightbox-description {
    font-size: 0.95em;
    opacity: 0.9;
    line-height: 1.4;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 50px;
    height: 65px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0.8;
    z-index: 1000; /* Above image */
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 65px;
    height: 65px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0.8;
    z-index: 1001; /* Above everything */
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    opacity: 1;
    transform: scale(1.1);
}

/* Image Grid */
.wp-lightbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.wp-lightbox-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    background: white;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.wp-lightbox-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.wp-lightbox-thumb {
    width: 100%;
    height: 192px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    pointer-events: none; /* Let parent handle clicks */
}

.wp-lightbox-item:hover .wp-lightbox-thumb {
    transform: scale(1.05);
}

.wp-lightbox-info {
    padding: 5px 15px 15px 15px;
    background: white;
    pointer-events: none; /* Let parent handle clicks */
}

.wp-lightbox-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.wp-lightbox-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Swipe Animation */
@keyframes swipeHint {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Mobile Swipe Indicator */
.swipe-indicator {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    padding: 8px 15px;
    border-radius: 20px;
    animation: swipeHint 2s infinite;
    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wp-lightbox-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }
    
    .lightbox-caption {
        padding: 15px;
    }
    
    .lightbox-title {
        font-size: 1.1em;
    }
    
    .lightbox-description {
        font-size: 0.9em;
    }
    
    .wp-lightbox-thumb {
        height: 180px;
    }
    
    /* Show swipe indicator on mobile */
    .swipe-indicator {
        display: block;
    }
}

@media all and (max-width: 580px) {
    .wp-lightbox-grid {
        /*grid-template-columns: 1fr;*/
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .lightbox-nav {
        display: none; /* Hide arrows on very small screens */
    }
    
    .lightbox-content {
        margin: 10px;
    }
}
