/**
 * IW Vertical Carousel Styles
 */

.iw-vertical-carousel {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Container sizing options */
.iw-vertical-carousel.fit-content {
    width: auto;
    height: auto;
    display: inline-block;
}

.iw-vertical-carousel.stretch-vertical {
    height: 100%;
    min-height: 400px;
}

.iw-vertical-carousel.stretch-horizontal {
    width: 100%;
}

/* Carousel track container */
.iw-carousel-track {
    position: relative;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transition: none;
}

/* Individual carousel items */
.iw-carousel-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.iw-carousel-item img {
    display: block;
    max-width: 100%;
    height: auto;
    transition: all 0.3s ease;
}

/* Carousel link styling */
.iw-carousel-link {
    display: inline-block;
    text-decoration: none;
    border: none;
    outline: none;
}

.iw-carousel-link:hover {
    text-decoration: none;
}

.iw-carousel-link img {
    cursor: pointer;
}

/* Hover effects for images */
.iw-carousel-item:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Smooth scrolling animation */
.iw-carousel-track.scrolling {
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-fill-mode: forwards;
}

/* Animation keyframes for upward scroll */
@keyframes scrollUp {
    from {
        transform: translateY(var(--start-offset, 0));
    }
    to {
        transform: translateY(calc(var(--start-offset, 0) - var(--scroll-distance, 100%)));
    }
}

/* Animation keyframes for downward scroll */
@keyframes scrollDown {
    from {
        transform: translateY(var(--start-offset, 0));
    }
    to {
        transform: translateY(calc(var(--start-offset, 0) + var(--scroll-distance, 100%)));
    }
}

/* Pause animation on hover */
.iw-vertical-carousel:hover .iw-carousel-track {
    animation-play-state: paused;
}

/* Fade masks for smooth infinite scroll */
.iw-vertical-carousel::before,
.iw-vertical-carousel::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 20px;
    z-index: 2;
    pointer-events: none;
    opacity: 0.8;
}

.iw-vertical-carousel::before {
    top: 0;
    background: linear-gradient(to bottom, currentColor, transparent);
}

.iw-vertical-carousel::after {
    bottom: 0;
    background: linear-gradient(to top, currentColor, transparent);
}

/* Hide fade masks when container background is transparent */
.iw-vertical-carousel:not([style*="background-color"])::before,
.iw-vertical-carousel:not([style*="background-color"])::after {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .iw-carousel-item img {
        max-width: 100%;
    }
    
    .iw-vertical-carousel::before,
    .iw-vertical-carousel::after {
        height: 15px;
    }
}

@media (max-width: 480px) {
    .iw-vertical-carousel::before,
    .iw-vertical-carousel::after {
        height: 10px;
    }
    
    .iw-carousel-item:hover img {
        transform: scale(1.02);
    }
}

/* Loading state */
.iw-vertical-carousel.loading .iw-carousel-track {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.iw-vertical-carousel.loaded .iw-carousel-track {
    opacity: 1;
}

/* Elementor editor compatibility */
.elementor-editor-active .iw-vertical-carousel .iw-carousel-track,
.iw-vertical-carousel.editor-mode .iw-carousel-track {
    animation: none !important;
    transform: none !important;
}

.elementor-editor-active .iw-vertical-carousel::before,
.elementor-editor-active .iw-vertical-carousel::after,
.iw-vertical-carousel.editor-mode::before,
.iw-vertical-carousel.editor-mode::after {
    display: none;
}

/* Editor mode specific styles */
.iw-vertical-carousel.editor-mode {
    min-height: 200px;
}

.iw-vertical-carousel.editor-mode .iw-carousel-item {
    opacity: 1 !important;
    transform: none !important;
}

.iw-vertical-carousel.editor-mode .iw-carousel-track {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    gap: var(--editor-gap, 10px);
}

.iw-vertical-carousel.editor-mode .iw-carousel-item {
    margin-bottom: 0 !important;
}

/* Disable hover effects in editor */
.elementor-editor-active .iw-carousel-item:hover img,
.iw-vertical-carousel.editor-mode .iw-carousel-item:hover img {
    transform: none;
    filter: none;
}

/* Caption Styles */
.iw-carousel-caption {
    text-align: center;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

/* Caption below image */
.iw-carousel-caption.caption-below {
    margin-top: 8px;
    width: 100%;
}

/* Caption overlay on image */
.iw-carousel-image-wrapper {
    position: relative;
    display: inline-block;
}

.iw-carousel-caption.caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 10px;
    border-radius: 4px;
    font-size: 12px;
}