.gallery-container {
    padding: 20px 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-gap: 15px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    aspect-ratio: 4/3;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Lightbox styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 80vh;
    margin: 20px;
}

.lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    transition: opacity 0.4s ease, transform 0.5s ease;
}

.lightbox-image.fade-out {
    opacity: 0;
    transform: scale(0.95);
}

.lightbox-image.fade-in {
    opacity: 1;
    transform: scale(1);
}

/* Effetto di scorrimento laterale */
.slide-right {
    animation: slideRight 0.4s ease;
}

.slide-left {
    animation: slideLeft 0.4s ease;
}

@keyframes slideRight {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideLeft {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 1010;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.lightbox-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-nav {
    position: absolute;
    display: flex;
    justify-content: space-between;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1010;
    padding: 0 20px;
}

.lightbox-prev, .lightbox-next {
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.lightbox-prev:hover, .lightbox-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-caption {
    color: white;
    margin-top: 15px;
    text-align: center;
    font-size: 16px;
    max-width: 80%;
}

/* Stile per i controlli di zoom */
.lightbox-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1010;
}

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

.zoom-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Stile per i controlli di condivisione */
.lightbox-share-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 1010;
}

.share-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.share-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Stile per immagini zoomabili */
.lightbox-image.zoomable {
    cursor: grab;
}

.lightbox-image.zoomable:active {
    cursor: grabbing;
}

/* Stile per video nella galleria */
.video-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: background-color 0.3s ease;
}

.play-icon:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-video {
    max-width: 100%;
    max-height: 80vh;
}

.no-images {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
}

.no-images i {
    font-size: 50px;
    margin-bottom: 20px;
    color: #6c757d;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .lightbox-zoom-controls,
    .lightbox-share-controls {
        scale: 0.8;
    }
}