/**
 * Bootstrap 5.3 Lightbox - Custom Styles
 */

/* Smooth transitions for modal */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

/* Lightbox specific styling */
.modal-content.bg-transparent {
    box-shadow: none;
}

/* Image loading state */
.modal-body img {
    transition: opacity 0.2s ease-in;
}

.modal-body img[src=""] {
    opacity: 0;
}

/* Close button hover effect */
.btn-close-white {
    opacity: 0.8;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.btn-close-white:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Navigation buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 3rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    transition: all 0.3s ease;
    border-radius: 50%;
    backdrop-filter: blur(5px);
    line-height: 1;
    padding: 0;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Counter */
.lightbox-counter {
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

/* Mobile responsive navigation */
@media (max-width: 768px) {
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 2.5rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-counter {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
}

/* Backdrop darker for better image visibility */
#lightbox-backdrop {
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-caption {
    background: #000000dd;
    padding: 5px;
}

/* Cursor indication for clickable images */
[data-lightbox] {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

[data-lightbox]::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

[data-lightbox]:hover::after {
    opacity: 1;
}

[data-lightbox]:hover img {
    transform: scale(1.05);
    transition: transform 0.3s ease-in-out;
}

/* Responsive image handling */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 95%;
    }
    
    .modal-body img {
        max-height: 80vh !important;
    }
}

/* Loading spinner positioning */
.modal-body .spinner-border {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Caption styling */
.lightbox-caption {
    font-size: 1rem;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    animation: fadeInCaption 0.4s ease-in 0.2s both;
}

@keyframes fadeInCaption {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .lightbox-caption {
        font-size: 0.9rem;
    }
}

/* Hide spinner when image is loaded */
.modal-body img[src]:not([src=""]) ~ .text-center {
    display: none;
}

/* Accessibility: Focus visible */
.modal:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Smooth image appearance */
.modal-body img {
    animation: fadeInImage 0.3s ease-in;
}

@keyframes fadeInImage {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Prevent layout shift */
.modal-open {
    overflow: hidden;
}