.custom-carousel-widget {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 10px 0;
}

.carousel-container {
    overflow: hidden;
    width: 100%;
}

.carousel-track {
    display: flex;
    gap: var(--gap-width, 20px);
    width: max-content;
    animation: scrollLeft var(--speed, 40s) linear infinite;
}

.custom-carousel-widget[data-direction="right"] .carousel-track {
    animation-name: scrollRight;
}

.carousel-track:hover {
    animation-play-state: paused;
}

.slide {
    flex: 0 0 var(--slide-width, 500px);
    height: var(--slide-height, 250px);
    border-radius: var(--border-radius, 20px);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.slide:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.slide-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.slide:hover .slide-image {
    transform: scale(1.05);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.overlay-content {
    max-width: 100%;
    word-wrap: break-word;
}

.slide:hover .overlay {
    opacity: 1;
}

@keyframes scrollLeft {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-1 * var(--total-width, 0px)));
    }
}

@keyframes scrollRight {
    0% {
        transform: translateX(calc(-1 * var(--total-width, 0px)));
    }
    100% {
        transform: translateX(0);
    }
}

.carousel-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.carousel-popup.active {
    opacity: 1;
    visibility: visible;
    display: block !important;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 15px;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    overflow: auto;
    box-shadow: 0 25px 75px rgba(0, 0, 0, 0.5);
    z-index: 1000001;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    padding: 0;
}

/* .popup-close:hover {
    background: #f0f0f0;
    transform: rotate(90deg);
} */

.close-icon {
    font-size: 24px;
    line-height: 1;
    font-weight: 300;
}

.popup-content {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.popup-image-wrapper {
    position: relative;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    min-height: 300px;
}

.popup-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-image.loaded {
    opacity: 1;
}

.popup-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.popup-loader.active {
    display: block;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.popup-info {
    padding: 25px;
    border-top: 1px solid #eee;
}

.popup-description {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    text-align: center;
    max-height: 150px;
    overflow-y: auto;
}

body.popup-open {
    overflow: hidden !important;
}

@media (max-width: 768px) {
    .carousel-track {
        animation-duration: calc(var(--speed, 40s) * 0.7);
    }
    
    .popup-container {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .popup-info {
        padding: 15px;
    }
    
    .popup-description {
        font-size: 14px;
        max-height: 100px;
    }
}