/**
 * Modern Image Lightbox Gallery Styles
 */

.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10500; /* above the modal overlay (10000) so it can open from inside a modal */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-lightbox.active {
    opacity: 1;
}

/* Dark overlay */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

/* Content container */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 80px;
}

/* Image container */
.lightbox-image-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.15s ease;
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

/* Navigation buttons */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev:active,
.lightbox-next:active {
    transform: translateY(-50%) scale(0.95);
}

/* Counter */
.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-counter span {
    color: #fbbf24;
}

/* Caption */
.lightbox-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    max-width: 80%;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.caption-view-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.caption-description {
    font-size: 1rem;
    color: white;
    line-height: 1.5;
}

/* Zoom Controls */
.lightbox-zoom-controls {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.zoom-btn:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
    .lightbox-content {
        padding: 40px 10px 60px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 48px;
        height: 48px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-counter {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.85em;
        padding: 8px 16px;
    }

    .lightbox-caption {
        bottom: 20px;
        max-width: 90%;
        padding: 0.75rem 1rem;
        font-size: 0.9em;
    }

    .caption-view-type {
        font-size: 0.65rem;
    }

    .caption-description {
        font-size: 0.9rem;
    }

    .lightbox-zoom-controls {
        bottom: 20px;
        right: 10px;
        flex-direction: column;
    }

    .zoom-btn {
        width: 36px;
        height: 36px;
    }

    .lightbox-image-container {
        max-width: 95vw;
    }
}

/* Zoom state - smooth transitions */
.lightbox-image-container img {
    cursor: grab;
    transform-origin: center;
}

.lightbox-image-container img:active {
    cursor: grabbing;
}

/* Keyboard hint (optional) */
@media (min-width: 769px) {
    .lightbox-zoom-controls::before {
        content: '+ - 0';
        position: absolute;
        bottom: -20px;
        right: 0;
        font-size: 0.75rem;
        color: rgba(255, 255, 255, 0.5);
        white-space: nowrap;
    }
}

/* Loading state */
.lightbox-image-container img[src=""] {
    opacity: 0;
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}
