/**
 * LightPage Lightbox Styles
 * Lightweight, viewport-aware gallery styles
 */

.lightpage-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    /*max-height: 100vh;*/
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Prevent any scrolling */
}

.lightpage-overlay.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.lightpage-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0;
}

.lightpage-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Hide images during slide */
}

.lightpage-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Ensure all images align to same baseline */
.lightpage-image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 1px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.lightpage-image {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.9s ease-out;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.lightpage-image.centered {
    transform: translate(-50%, -50%);
}

.lightpage-image.slide-out-left {
    transform: translate(-50%, -50%) translateX(-100vw);
}

.lightpage-image.slide-out-right {
    transform: translate(-50%, -50%) translateX(100vw);
}

.lightpage-image.slide-in-left {
    transform: translate(-50%, -50%) translateX(-100vw) !important;
}

.lightpage-image.slide-in-right {
    transform: translate(-50%, -50%) translateX(100vw) !important;
}

.lightpage-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    max-width: 80%;
    text-align: center;
    word-wrap: break-word;
    transition: opacity 0.2s ease;
}

.lightpage-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.lightpage-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgb(0, 0, 0);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 10;
}

.lightpage-close:hover {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #eee;
}

.lightpage-prev,
.lightpage-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 4rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 10;
}

.lightpage-prev {
    left: 20px;
}

.lightpage-next {
    right: 20px;
}

.lightpage-prev:hover,
.lightpage-next:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .lightpage-container {
        width: 100%;
        height: 100%;
        padding: 0;
    }

    .lightpage-image {
        max-width: 95vw;
        max-height: 85vh;
    }

    .lightpage-counter {
        top: 10px;
        left: 10px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .lightpage-close {
        top: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .lightpage-prev,
    .lightpage-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightpage-prev {
        left: 10px;
    }

    .lightpage-next {
        right: 10px;
    }

    .lightpage-caption {
        padding: 8px 12px;
        font-size: 13px;
        margin-top: 8px;
    }
}

/* Hide navigation buttons when only one image */
.lightpage-overlay[data-single="true"] .lightpage-prev,
.lightpage-overlay[data-single="true"] .lightpage-next {
    display: none !important;
}

/* Loading state */
.lightpage-image[src=""] {
    background: rgba(255, 255, 255, 0.1);
    min-width: 200px;
    min-height: 200px;
}

/* Smooth animations - only for direct load, not sliding */
.lightpage-image:not(.slide-in-left):not(.slide-in-right):not(.slide-out-left):not(.slide-out-right):not(.centered) {
    animation: lightpage-fadeIn 0.3s ease;
}

@keyframes lightpage-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
