/* Gallery Lightbox Styles */

.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Navigation Buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    opacity: 0.7;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-prev {
    left: 20px;
}

.lightbox-nav-next {
    right: 20px;
}

/* Main Content */
.lightbox-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 80px 20px 20px;
}

.lightbox-media-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
}

.lightbox-media {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-video {
    width: 90vw;
    height: 50.625vw; /* 16:9 aspect ratio */
    max-width: 1200px;
    max-height: 675px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Loading State */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* Error State */
.lightbox-error {
    color: white;
    text-align: center;
    padding: 2rem;
}

/* Info Section */
.lightbox-info {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 20px;
    margin-top: auto;
}

.lightbox-caption {
    font-size: 1.1rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.lightbox-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

.lightbox-counter {
    font-weight: 500;
}

.lightbox-download {
    text-decoration: none;
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.lightbox-download:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Thumbnails */
.lightbox-thumbnails {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    backdrop-filter: blur(10px);
}

.thumbnail-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.thumbnail-container::-webkit-scrollbar {
    height: 4px;
}

.thumbnail-container::-webkit-scrollbar-track {
    background: transparent;
}

.thumbnail-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.lightbox-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    opacity: 0.6;
}

.lightbox-thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.lightbox-thumbnail.active {
    border-color: white;
    opacity: 1;
    transform: scale(1.1);
}

.thumbnail-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
}

.thumbnail-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lightbox-content {
        padding: 60px 10px 10px;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .lightbox-nav-prev {
        left: 15px;
    }

    .lightbox-nav-next {
        right: 15px;
    }

    .lightbox-video {
        width: 95vw;
        height: 53.4375vw; /* 16:9 aspect ratio */
    }

    .lightbox-info {
        padding: 15px;
    }

    .lightbox-caption {
        font-size: 1rem;
    }

    .lightbox-meta {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .lightbox-thumbnails {
        padding: 10px;
    }

    .lightbox-thumbnail {
        width: 60px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .lightbox-close {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .lightbox-thumbnails {
        display: none; /* Hide thumbnails on very small screens */
    }
}

/* Animation enhancements */
@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-image {
    animation: lightboxFadeIn 0.3s ease;
}

.lightbox-video {
    animation: lightboxFadeIn 0.3s ease;
}

/* Focus styles for accessibility */
.lightbox-close:focus,
.lightbox-nav:focus,
.lightbox-thumbnail:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lightbox-overlay {
        background: black;
    }

    .lightbox-close,
    .lightbox-nav {
        background: white;
        color: black;
    }

    .lightbox-thumbnail {
        border-color: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-lightbox,
    .lightbox-close,
    .lightbox-nav,
    .lightbox-thumbnail,
    .lightbox-image,
    .lightbox-video {
        transition: none;
        animation: none;
    }
}

/* Print styles */
@media print {
    .gallery-lightbox {
        display: none !important;
    }
}