/* Theatre Gallery Lightbox Component - Updated: 2025-01-27 - Version 1.0 */

/* Gallery Grid Layout */
.theatre-gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.theatre-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.gallery-thumbnail {
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery-thumbnail:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumbnail:hover img {
    transform: scale(1.05);
}

/* Lightbox Modal */
.theatre-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theatre-lightbox.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.theatre-lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-image-container {
    position: relative;
    overflow: hidden;
    background: #000;
}

.lightbox-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    transform-origin: center center;
    transition: transform 0.3s ease;
    cursor: grab;
}

.lightbox-image.zoomed {
    cursor: grabbing;
}

/* Image Caption */
.lightbox-caption {
    padding: 1.5rem;
    background: #fff;
    border-top: 1px solid #eee;
}

.lightbox-caption h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.lightbox-caption p {
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* Navigation Controls */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-prev {
    left: 1rem;
}

.lightbox-nav-next {
    right: 1rem;
}

.lightbox-nav svg {
    width: 24px;
    height: 24px;
    color: #333;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: #fff;
    transform: scale(1.1);
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
    color: #333;
}

/* Zoom Controls */
.lightbox-zoom-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: #fff;
    transform: scale(1.05);
}

.zoom-btn svg {
    width: 18px;
    height: 18px;
    color: #333;
}

/* Progress Indicator */
.lightbox-progress {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    z-index: 10;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .theatre-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 0.75rem;
    }
    
    .theatre-lightbox.active {
        padding: 1rem;
    }
    
    .lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-image {
        max-height: 60vh;
    }
    
    .lightbox-caption {
        padding: 1rem;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
    }
    
    .lightbox-nav-prev {
        left: 0.5rem;
    }
    
    .lightbox-nav-next {
        right: 0.5rem;
    }
    
    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .lightbox-zoom-controls {
        bottom: 0.5rem;
    }
}

/* Loading Animation */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.125rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Accessibility */
.theatre-lightbox:focus-within {
    outline: none;
}

.gallery-thumbnail:focus {
    outline: 2px solid #8B5CF6;
    outline-offset: 2px;
}

.lightbox-nav:focus,
.lightbox-close:focus,
.zoom-btn:focus {
    outline: 2px solid #8B5CF6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lightbox-nav,
    .lightbox-close,
    .zoom-btn {
        background: #fff;
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-thumbnail,
    .gallery-thumbnail img,
    .theatre-lightbox,
    .lightbox-content,
    .lightbox-image,
    .lightbox-nav,
    .lightbox-close,
    .zoom-btn {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}
