.custom-image-carousel {
    width: 100%;
    max-width: 100%;
}

.carousel-main-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f0f0f0;
    border-radius: 8px;
}

/* Media screen Mobile */
@media screen and (max-width: 478px){
    .carousel-main-container {
        height: 300px;
    }
}

.carousel-image-wrapper {
    width: 100%;
}

.carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 10;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

.thumbnails-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: start;
    padding: 10px;
}

.thumbnail-item {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
}

.thumbnail-item:hover,
.thumbnail-item.active {
    opacity: 1;
    border-color: #007cba;
}

.thumbnail-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    display: block;
}

@media (max-width: 768px) {
    .carousel-arrow {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .thumbnail-item img {
        width: 60px;
        height: 45px;
    }

    .thumbnails-container {
        gap: 8px;
    }
}

/* Container principale */
.custom-image-carousel .carousel-main-container {
    position: relative;
    overflow: hidden;
}

.custom-image-carousel .carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Slides */
.custom-image-carousel .carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-image-carousel .carousel-slide.active {
    opacity: 1;
    position: relative;
}

/* Immagini */
.custom-image-carousel .carousel-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

.custom-image-carousel.adaptive-height .carousel-image {
    max-height: none;
    width: 100%;
    height: auto;
}

/* Didascalie */
.custom-image-carousel .carousel-caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    text-align: center;
}

/* Frecce */
.custom-image-carousel .carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.3s;
}

.custom-image-carousel .carousel-prev {
    left: 20px;
}

.custom-image-carousel .carousel-next {
    right: 20px;
}

.custom-image-carousel .carousel-arrow:hover {
    opacity: 0.8;
}

/* Thumbnails */
.custom-image-carousel .thumbnails-container {
    display: flex;
    justify-content: start;
    margin-top: 20px;
    overflow-x: auto;
    padding: 10px 0;
}

.custom-image-carousel .thumbnail-item {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
    flex-shrink: 0;
}

.custom-image-carousel .thumbnail-item.active,
.custom-image-carousel .thumbnail-item:hover {
    opacity: 1;
}

.custom-image-carousel .thumbnail-image {
    display: block;
    object-fit: cover;
}

/* Lightbox Container */
.carousel-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.carousel-lightbox.active {
    display: block;
}

/* Overlay */
.carousel-lightbox .lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

/* Container principale lightbox */
.carousel-lightbox .lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Contenuto lightbox */
.carousel-lightbox .lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Slides lightbox */
.carousel-lightbox .lightbox-slides {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-lightbox .lightbox-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}

.carousel-lightbox .lightbox-slide.active {
    opacity: 1;
    visibility: visible;
    position: relative;
}

/* Immagini lightbox */
.carousel-lightbox .lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    display: block;
}

/* Descrizione */
.carousel-lightbox .lightbox-description {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    max-width: 80%;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 20px;
    max-height: 100px;
    overflow-y: auto;
}

/* Pulsante chiusura */
.carousel-lightbox .lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 10;
    padding: 10px;
    transition: opacity 0.3s;
}

.carousel-lightbox .lightbox-close:hover {
    opacity: 0.7;
}

/* Frecce navigazione lightbox */
.carousel-lightbox .lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 24px;
    padding: 15px 20px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}

.carousel-lightbox .lightbox-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-lightbox .lightbox-prev {
    left: 20px;
}

.carousel-lightbox .lightbox-next {
    right: 20px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .carousel-lightbox .lightbox-description {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .carousel-lightbox .lightbox-arrow {
        font-size: 20px;
        padding: 10px 15px;
    }
}