/* Base Container Styles */
.custom-carousel-wrapper {
    position: relative !important;
    width: 100%;
    overflow: hidden !important;
    z-index: 9;
    margin-bottom: 30px;
}

.custom-carousel-wrapper .swiper {
    position: relative;
    width: 100%;
    overflow: visible;
}

/* Wrapper and Slide Structure - IMPORTANTE: usar seletor específico para não afetar outros carrosséis */
.custom-carousel-wrapper .swiper-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    box-sizing: content-box;
}

.custom-carousel-wrapper .swiper-slide {
    display: flex;
    justify-content: flex-start;
    align-items: stretch; /* Mudado para stretch */
    width: auto;
    height: auto; /* Mudado para auto */
    position: relative;
    transition-property: transform;
}

/* Carousel Item Styles - específico para este widget */
.custom-carousel-wrapper .carousel-item {
    position: relative !important;
    width: 100%;
    min-height: 100px; /* Altura mínima para evitar colapso */
    border-radius: 10px;
    overflow: hidden;
    z-index: 9;
    display: flex; /* Adicionado */
}

/* Link and Image Container */
.custom-carousel-wrapper .carousel-item a {
    position: relative; /* Mudado para relative */
    width: 100%;
    display: flex; /* Adicionado */
    flex-direction: column; /* Adicionado */
}

/* Image Styles */
.custom-carousel-wrapper .carousel-item img {
    width: 100%;
    height: auto;
    display: block;
    min-height: 100%; /* Garante altura mínima */
    object-fit: contain; /* Mudado para contain */
    transition: transform 0.3s ease, filter 0.3s ease;
}



/* Navigation Arrows - IMPORTANTE: usar seletor específico */
.custom-carousel-wrapper .swiper-button-next,
.custom-carousel-wrapper .swiper-button-prev {
    color: #fff !important;
    background-color: rgba(0, 0, 0, 0.5);
    width: 60px !important;
    height: 60px !important;
    border-radius: 50%;
    z-index: 20;
    transition: all 0.3s ease;
}

.custom-carousel-wrapper .swiper-button-next:after,
.custom-carousel-wrapper .swiper-button-prev:after {
    font-size: 20px !important;
}

.custom-carousel-wrapper .swiper-button-next:hover,
.custom-carousel-wrapper .swiper-button-prev:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: #000 !important;
}

/* Multiple Carousels Handling */
.elementor-widget-custom_carousel {
    position: relative;
    z-index: 1;
    margin-bottom: 30px;
}

.elementor-widget-custom_carousel + .elementor-widget-custom_carousel {
    margin-top: 50px;
}

/* ========================================
   SINGLE SLIDE FIX - Mobile
   Quando há apenas 1 slide, limitar tamanho
   ======================================== */

@media (max-width: 767px) {
    .custom-carousel-wrapper.single-slide .swiper-slide {
        max-width: 80% !important;
        margin: 0 auto !important;
    }

    .custom-carousel-wrapper.single-slide .swiper-wrapper {
        justify-content: center !important;
    }
}

/* Utility Classes */
.hide-comments {
    display: none !important;
}

.carousel-item-message {
    text-align: center !important;
}

/* Efeitos - específico para este widget */
.custom-carousel-wrapper .carousel-item:hover img {
    filter: brightness(0.8);
    transform: scale(1.05);
}

.custom-carousel-wrapper .carousel-item img.grayscale {
    filter: grayscale(100%);
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .custom-carousel-wrapper .swiper-slide {
        justify-content: center;
    }

    .custom-carousel-wrapper .carousel-item {
        min-height: 80px; /* Altura mínima menor para mobile */
    }

    .custom-carousel-wrapper .swiper-button-next,
    .custom-carousel-wrapper .swiper-button-prev {
        width: 35px !important;
        height: 35px !important;
    }

    .custom-carousel-wrapper .swiper-button-next:after,
    .custom-carousel-wrapper .swiper-button-prev:after {
        font-size: 16px !important;
    }
}

/* Hide Scrollbar - específico para este widget */
.custom-carousel-wrapper .swiper::-webkit-scrollbar {
    display: none;
}

/* Estado inicial do carrossel - oculto até ser inicializado */
.custom-carousel-wrapper {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Classe aplicada pelo Swiper quando inicializado */
.custom-carousel-wrapper .swiper-initialized .swiper-wrapper,
.custom-carousel-wrapper .swiper-initialized ~ .swiper-button-prev,
.custom-carousel-wrapper .swiper-initialized ~ .swiper-button-next {
    opacity: 1;
}

/* Pré-definir tamanhos para slides antes da inicialização - IMPORTANTE: seletor específico! */
.custom-carousel-wrapper .swiper:not(.swiper-initialized) .swiper-slide {
    width: calc(20% - 20px) !important; /* 5 slides padrão com 20px de espaço */
    margin-right: 20px;
    flex-shrink: 0;
}

/* Quando o Swiper está inicializado, mostra o carrossel */
.custom-carousel-wrapper .swiper-initialized {
    opacity: 1;
}