/* Simple Image Carousel Styles */
.simple-carousel-container {
    position: relative;
    width: 100% !important;
    max-width: 100%;
    min-width: var(--min-width-desktop, 800px);
    height: var(--desktop-height, 400px);
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: #f5f5f5;
    display: block;
    box-sizing: border-box;
}

.carousel-wrapper {
    position: relative;
    width: 100% !important;
    height: 100%;
    display: block;
    box-sizing: border-box;
}

.carousel-slides {
    position: relative;
    width: 100% !important;
    height: 100%;
    display: block;
    box-sizing: border-box;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

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

.carousel-slide img,
.carousel-slide picture img {
    width: 100%;
    height: 100%;
    object-fit: cover !important; /* Cover em todos os tamanhos - sem espaços */
    object-position: center;
    border-radius: inherit;
    transition: transform 0.3s ease;
}

.carousel-slide a {
    display: block;
    width: 100% !important;
    height: 100%;
    text-decoration: none;
    box-sizing: border-box;
}

.carousel-slide a:hover img {
    transform: scale(1.05);
}

/* Navigation Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border: none !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999 !important;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    opacity: 1 !important;
    visibility: visible !important;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.carousel-arrow:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.carousel-prev {
    left: 15px !important;
}

.carousel-next {
    right: 15px !important;
}

.carousel-arrow svg {
    width: 24px !important;
    height: 24px !important;
    fill: white !important;
    stroke: white !important;
}

/* Navigation Dots */
.carousel-dots {
    position: absolute !important;
    bottom: 15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 8px;
    z-index: 999 !important;
    opacity: 1 !important;
    visibility: visible !important;
    background: rgba(0, 0, 0, 0.3) !important;
    padding: 8px 12px !important;
    border-radius: 25px !important;
    backdrop-filter: blur(5px) !important;
}

.carousel-dot {
    width: 60px !important;
    height: 40px !important;
    border-radius: 6px !important;
    border: 3px solid rgba(255, 255, 255, 0.8) !important;
    background: #333 !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: relative !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.carousel-dot img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 3px !important;
    opacity: 1 !important;
    transition: all 0.3s ease;
    display: block !important;
    max-width: none !important;
    max-height: none !important;
    border: none !important;
    outline: none !important;
}

.carousel-dot:hover img,
.carousel-dot.active img {
    opacity: 1 !important;
}

.carousel-dot:hover,
.carousel-dot.active {
    border-color: #fff !important;
    border-width: 4px !important;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.carousel-dot:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Loading State */
.carousel-slide.loading {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide.loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade Animation */
.carousel-slide.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.carousel-slide.fade-out {
    animation: fadeOut 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Elementor and Page Builder Specific Styles */
.elementor-carousel {
    margin: 0;
}

.elementor-widget-simple-image-carousel .simple-carousel-container,
.elementor-shortcode .simple-carousel-container,
.elementor-widget-shortcode .simple-carousel-container {
    width: 100% !important;
    max-width: none !important;
    min-width: var(--min-width-desktop, 800px);
    height: var(--desktop-height, 400px) !important;
}

/* Mobile overrides for Elementor */
@media (max-width: 768px) {
    .elementor-widget-simple-image-carousel .simple-carousel-container,
    .elementor-shortcode .simple-carousel-container,
    .elementor-widget-shortcode .simple-carousel-container {
        min-width: var(--min-width-mobile, 300px);
    }
}

/* Fix for various page builders and themes */
.simple-carousel-container {
    clear: both;
    margin: 0 auto;
}

/* Override common theme styles that might interfere */
.simple-carousel-container,
.simple-carousel-container *,
.simple-carousel-container *:before,
.simple-carousel-container *:after {
    box-sizing: border-box !important;
}

/* Ensure full width in various containers */
.entry-content .simple-carousel-container,
.post-content .simple-carousel-container,
.page-content .simple-carousel-container,
.widget .simple-carousel-container,
.elementor-widget-container .simple-carousel-container {
    width: 100% !important;
    max-width: 100% !important;
}

/* Force arrow visibility in all contexts */
.simple-carousel-container .carousel-arrow {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 999 !important;
}

.elementor-widget-container .carousel-arrow,
.entry-content .carousel-arrow,
.post-content .carousel-arrow {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Force thumbnail visibility in all contexts */
.simple-carousel-container .carousel-dot img,
.elementor-widget-container .carousel-dot img,
.entry-content .carousel-dot img,
.post-content .carousel-dot img {
    display: block !important;
    opacity: 0.7 !important;
    visibility: visible !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Tablet Styles */
@media (max-width: 1024px) {
    .simple-carousel-container {
        height: var(--tablet-height, 300px);
    }
    
    .carousel-arrow {
        width: 45px;
        height: 45px;
    }
    
    .carousel-arrow svg {
        width: 20px;
        height: 20px;
    }
    
    .carousel-prev {
        left: 10px;
    }
    
    .carousel-next {
        right: 10px;
    }
    
    .carousel-dots {
        bottom: 15px;
        gap: 8px;
    }
    
    .carousel-dot {
        width: 10px;
        height: 10px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .simple-carousel-container {
        height: var(--mobile-height, 250px) !important;
        min-width: var(--min-width-mobile, 300px);
        border-radius: 6px;
        position: relative;
        overflow: hidden;
    }

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

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

    .carousel-slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    /* Imagem preenche TODO o espaço sem deixar espaços vazios */
    .carousel-slide img,
    .carousel-slide picture img,
    .carousel-slide a img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .carousel-slide a {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 999;
    }

    .carousel-prev {
        left: 8px;
    }

    .carousel-next {
        right: 8px;
    }

    .carousel-dots {
        bottom: 12px;
        gap: 6px;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .carousel-dot {
        width: 50px !important;
        height: 35px !important;
    }

    .carousel-slide a:hover img {
        transform: none;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .simple-carousel-container {
        height: var(--mobile-height, 200px);
    }
    
    .carousel-arrow {
        width: 35px;
        height: 35px;
    }
    
    .carousel-arrow svg {
        width: 16px;
        height: 16px;
    }
    
    .carousel-prev {
        left: 5px;
    }
    
    .carousel-next {
        right: 5px;
    }
    
    .carousel-dots {
        bottom: 10px;
        gap: 5px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .carousel-slide img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .carousel-slide,
    .carousel-arrow,
    .carousel-dot,
    .carousel-slide img {
        transition: none;
        animation: none;
    }
    
    .carousel-slide.fade-in,
    .carousel-slide.fade-out {
        animation: none;
    }
}

/* Focus States for Better Accessibility */
.carousel-arrow:focus-visible,
.carousel-dot:focus-visible {
    outline: 3px solid #005a87;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .simple-carousel-container {
        height: auto !important;
        overflow: visible !important;
        box-shadow: none !important;
    }
    
    .carousel-slide {
        position: static !important;
        opacity: 1 !important;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .carousel-arrow,
    .carousel-dots {
        display: none !important;
    }
}

/* RTL Support */
[dir="rtl"] .carousel-prev {
    right: 15px;
    left: auto;
}

[dir="rtl"] .carousel-next {
    left: 15px;
    right: auto;
}

[dir="rtl"] .carousel-prev svg {
    transform: scaleX(-1);
}

[dir="rtl"] .carousel-next svg {
    transform: scaleX(-1);
}
