.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /*justify-content: center;*/
}

.gallery-item {
    flex: 0 0 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
}

.gallery-item img, .gallery-item .video-container {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.video-container {
    position: relative;
}

.video-container::after {
    content: "\25B6";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 50%;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
}

.lightbox-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lightbox-header {
    display: flex;
    flex-direction: column;
    padding: 10px 20px;
    background-color: #000000;
    color: white;
}

.lightbox-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.lightbox-info {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 10px;
}

.lightbox-caption, .lightbox-title {
    margin: 0;
    font-size: 14px;
}

.lightbox-separator {
    margin: 0 10px;
}

.lightbox-body {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.lightbox-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-content.video {
    width: 100%;
    height: 100%;
}

.lightbox-end-message {
    display: none;
    position: fixed; /* Changed from absolute to fixed */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    color: white;
    font-size: 24px;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* Ensure it's above other lightbox elements */
}

.close, .prev, .next {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 5px 10px;
    transition: 0.3s;
}

.close:hover, .prev:hover, .next:hover {
    color: #bbb;
}

.prev, .next {
    white-space: nowrap;
}

.prev.hidden, .next.hidden {
    visibility: hidden;
}

@media (max-width: 768px) {
    .lightbox-top-bar {
        flex-wrap: wrap;
    }

    .lightbox-info {
        flex-direction: column;
    }

    .lightbox-separator {
        display: none;
    }

    .lightbox-caption, .lightbox-title {
        text-align: center;
        width: 100%;
        margin-bottom: 5px;
    }
}
