/**
 * Frontend Lightbox Styles
 * Styles for gallery image lightbox functionality
 */

/* Main Lightbox Container */
.frontend-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.frontend-lightbox[style*="flex"] {
    opacity: 1;
}

/* Lightbox Overlay */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

/* Lightbox Container */
.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Lightbox Content */
.lightbox-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    max-height: 100%;
}

/* Lightbox Image */
.lightbox-image {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.lightbox-image:hover {
    transform: scale(1.02);
}

/* Lightbox Info */
.lightbox-info {
    margin-top: 1rem;
    text-align: center;
    color: white;
    max-width: 90vw;
}

.lightbox-caption {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.lightbox-counter {
    font-size: 0.875rem;
    opacity: 0.8;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Lightbox Close Button */
.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 20;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Lightbox Navigation Buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.25rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 20;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

/* Hide navigation buttons when not needed */
.lightbox-nav[style*="none"] {
    display: none !important;
}

/* Loading State */
.lightbox-image.loading {
    opacity: 0.5;
}

.lightbox-image.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-radius: 50%;
    border-top-color: white;
    animation: lightbox-spin 1s ease-in-out infinite;
}

@keyframes lightbox-spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .lightbox-container {
        max-width: 95vw;
        max-height: 95vh;
        padding: 1rem;
    }
    
    .lightbox-image {
        max-width: 95vw;
        max-height: 70vh;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-caption {
        font-size: 1rem;
    }
    
    .lightbox-counter {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .lightbox-container {
        padding: 0.5rem;
    }
    
    .lightbox-image {
        max-width: 100vw;
        max-height: 60vh;
        border-radius: 4px;
    }
    
    .lightbox-close {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
        top: 5px;
        right: 5px;
    }
    
    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    .lightbox-caption {
        font-size: 0.875rem;
        margin: 0.5rem 0;
    }
    
    .lightbox-info {
        margin-top: 0.5rem;
    }
}

/* Touch Device Support */
@media (hover: none) and (pointer: coarse) {
    .lightbox-nav {
        background: rgba(0, 0, 0, 0.7);
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .lightbox-close {
        background: rgba(0, 0, 0, 0.7);
        width: 50px;
        height: 50px;
        font-size: 1.75rem;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .lightbox-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .lightbox-nav,
    .lightbox-close {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid white;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .frontend-lightbox,
    .lightbox-image,
    .lightbox-nav,
    .lightbox-close {
        transition: none;
    }
    
    .lightbox-image:hover {
        transform: none;
    }
    
    .lightbox-nav:hover,
    .lightbox-close:hover {
        transform: none;
    }
}

/* Focus Styles for Accessibility */
.lightbox-nav:focus,
.lightbox-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .frontend-lightbox {
        display: none !important;
    }
}
