/**
 * Enhanced Gallery Lightbox Styles
 */

/* Lightbox Overlay */
.egs-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.egs-lightbox-overlay.egs-lightbox-open {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Container */
.egs-lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.egs-lightbox-overlay.egs-lightbox-open .egs-lightbox-container {
    transform: scale(1);
}

/* Lightbox Image */
.egs-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Lightbox Title/Caption */
.egs-lightbox-title {
    color: #fff;
    font-size: 16px;
    line-height: 1.4;
    margin-top: 15px;
    text-align: center;
    max-width: 80vw;
    padding: 0 20px;
}

/* Navigation Controls */
.egs-lightbox-nav {
    /* Reset all possible theme button styles */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    color: #fff !important;
    width: auto !important;
    height: auto !important;
    min-width: unset !important;
    min-height: unset !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 48px;
    font-weight: bold !important;
    font-family: Arial, sans-serif !important;
    line-height: 1 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 1000001;
    outline: none !important;
    box-sizing: content-box !important;
}

.egs-lightbox-nav:hover {
    color: #fff !important;
    background: none !important;
    transform: translateY(-50%) scale(1.2) !important;
    text-decoration: none !important;
}

.egs-lightbox-nav:focus {
    outline: none !important;
    color: #fff !important;
    background: none !important;
    text-decoration: none !important;
}

.egs-lightbox-nav:active {
    color: #fff !important;
    background: none !important;
    transform: translateY(-50%) scale(1) !important;
    text-decoration: none !important;
}

.egs-lightbox-prev {
    left: -90px;
}

.egs-lightbox-next {
    right: -90px;
}

/* Close Button */
.egs-lightbox-close {
    /* Reset all possible theme button styles */
    position: absolute;
    top: -60px;
    right: 0;
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 30px;
    cursor: pointer;
    width: 40px !important;
    height: 40px !important;
    min-width: unset !important;
    min-height: unset !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif !important;
    font-weight: normal !important;
    line-height: 1 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: transform 0.2s ease;
    z-index: 1000001;
    outline: none !important;
    box-sizing: content-box !important;
}

.egs-lightbox-close:hover {
    color: #fff !important;
    background: none !important;
    transform: scale(1.2) !important;
    text-decoration: none !important;
}

.egs-lightbox-close:focus {
    outline: 2px solid #fff !important;
    outline-offset: 2px;
    color: #fff !important;
    background: none !important;
    text-decoration: none !important;
}

.egs-lightbox-close:active {
    color: #fff !important;
    background: none !important;
    transform: scale(1) !important;
    text-decoration: none !important;
}

/* Counter */
.egs-lightbox-counter {
    position: absolute;
    top: -60px;
    left: 0;
    color: #fff;
    font-size: 14px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* Loading Spinner */
.egs-lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: egs-spin 1s linear infinite;
}

@keyframes egs-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .egs-lightbox-container {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .egs-lightbox-image {
        max-height: 75vh;
    }
    
    .egs-lightbox-nav {
        font-size: 40px !important;
    }
    
    .egs-lightbox-prev {
        left: -50px;
    }
    
    .egs-lightbox-next {
        right: -50px;
    }
    
    .egs-lightbox-close {
        top: -50px;
        font-size: 24px !important;
    }
    
    .egs-lightbox-counter {
        top: -50px;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .egs-lightbox-title {
        font-size: 14px;
        margin-top: 10px;
        max-width: 90vw;
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .egs-lightbox-nav {
        font-size: 36px !important;
    }
    
    .egs-lightbox-prev {
        left: -40px;
    }
    
    .egs-lightbox-next {
        right: -40px;
    }
    
    .egs-lightbox-image {
        max-height: 70vh;
    }
}

/* Animation for image transitions */
.egs-lightbox-image.egs-transitioning {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.egs-lightbox-image.egs-loaded {
    opacity: 1;
}

/* Prevent body scroll when lightbox is open */
body.egs-lightbox-open {
    overflow: hidden;
}

/* Gallery enhancement - add cursor pointer to gallery images */
.gallery .gallery-item a[data-lightbox] {
    cursor: pointer;
    display: block;
    transition: opacity 0.2s ease;
}

.gallery .gallery-item a[data-lightbox]:hover {
    opacity: 0.8;
}

/* Hide WordPress default gallery caption overlay when lightbox is enabled */
.gallery .gallery-item a[data-lightbox] .gallery-caption {
    position: static;
    background: none;
    padding: 5px 0 0 0;
    opacity: 1;
}