/* Showcase Carousel Container */
.showcase-carousel-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: none;
}

.showcase-carousel-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    perspective: 1200px;
    perspective-origin: center center;
    transform-style: preserve-3d;
    display: inline-block;
    overflow: hidden;
    pointer-events: none;
}

.showcase-carousel-track {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start; /* Đổi từ center sang flex-start để active ở bên trái */
    height: 630px; /* active slide height: 600px + buffer: 20px = 620px */
    min-height: 630px;
    gap: 20px;
    padding: 20px;
    pointer-events: none;
    margin: 0 auto;
    z-index: 0;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.showcase-carousel-track.transitioning {
    pointer-events: none;
}


/* Slide Base Styles */
.showcase-carousel-slide {
    position: relative;
    cursor: pointer;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                filter 0.7s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform, opacity, width, height, filter, z-index !important;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0) scale(1);
    -webkit-transform: translateZ(0) scale(1);
}

/* Đảm bảo transition được áp dụng khi track đang transitioning */
.showcase-carousel-track.transitioning .showcase-carousel-slide {
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                filter 0.7s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.showcase-carousel-slide-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    pointer-events: auto;
    z-index: inherit;
}

.showcase-carousel-image {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    display: block;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    position: relative;
    z-index: 0;
    transform: translateZ(0) scale(1);
    -webkit-transform: translateZ(0) scale(1);
    will-change: transform, opacity;
}

.showcase-carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1;
}

/* Base styles for all visible slides - Portrait Format */
.showcase-carousel-slide {
    width: 240px;
    height: 300px;
    max-width: 100%;
    opacity: 1;
}

/* Active Slide (Center - Main Image) - Highest */
.showcase-carousel-slide.active {
    width: 455px;
    height: 600px;
    max-height: 80vh;
    z-index: 10;
    transform: translateZ(0) scale(1);
    opacity: 1;
}

/* Đảm bảo khi có cả side và active, active sẽ override */
.showcase-carousel-slide.active.side {
    width: 240px;
    height: 300px;
    transform: translateZ(0) scale(1);
    opacity: 1;
}

.showcase-carousel-slide.active .showcase-carousel-overlay {
    background: rgba(0, 0, 0, 0);
}

.showcase-carousel-slide.active .showcase-carousel-image {
    transform: scale(1);
    object-fit: cover;
}

.showcase-carousel-slide.active:hover {
    transform: translateZ(0) scale(1.02);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.showcase-carousel-slide.active:hover .showcase-carousel-image {
    transform: scale(1.02);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}


/* Side slides - Smaller and clickable */
.showcase-carousel-slide.side {
    width: 240px;
    height: 300px;
    opacity: 0.75;
    transform: translateZ(0) scale(0.92);
}

/* Side slides khi đang transition - chỉ áp dụng cho các slide không đang animation */
.showcase-carousel-track.transitioning .showcase-carousel-slide.side:not(.becoming-active):not(.becoming-side) {
    transform: translateZ(0) scale(0.88);
}

/* Animation keyframes cho hiệu ứng chuyển đổi kết hợp slide và scale */
/* Side -> Active: Trượt vào bên trái và tăng kích thước */
@keyframes slideScaleInFromLeft {
    from {
        width: 240px;
        height: 300px;
        transform: translateZ(0) translateX(-150px) scale(0.88);
        opacity: 0.7;
    }
    to {
        width: 455px;
        height: 600px;
        transform: translateZ(0) translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideScaleInFromRight {
    from {
        width: 240px;
        height: 300px;
        transform: translateZ(0) translateX(150px) scale(0.88);
        opacity: 0.7;
    }
    to {
        width: 455px;
        height: 600px;
        transform: translateZ(0) translateX(0) scale(1);
        opacity: 1;
    }
}

/* Active -> Side: Trượt ra và giảm kích thước */
/* Lưu ý: Animation kết thúc ở translateX(0) để khớp với transform của .side class */
@keyframes slideScaleOutToLeft {
    from {
        width: 455px;
        height: 600px;
        transform: translateZ(0) translateX(0) scale(1);
        opacity: 1;
    }
    to {
        width: 240px;
        height: 300px;
        transform: translateZ(0) translateX(0) scale(0.92);
        opacity: 0.75;
    }
}

@keyframes slideScaleOutToRight {
    from {
        width: 455px;
        height: 600px;
        transform: translateZ(0) translateX(0) scale(1);
        opacity: 1;
    }
    to {
        width: 240px;
        height: 300px;
        transform: translateZ(0) translateX(0) scale(0.92);
        opacity: 0.75;
    }
}

/* Áp dụng animation khi slide chuyển từ side sang active */
/* Mặc định: nếu không có class direction, dùng animation từ phải (vì active ở trái) */
.showcase-carousel-track.transitioning .showcase-carousel-slide.side.becoming-active {
    animation: slideScaleInFromRight 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    transition: none !important; /* Tắt transition khi đang animation */
    /* Không set width/height ở đây, để animation tự xử lý */
}

.showcase-carousel-track.transitioning .showcase-carousel-slide.side.becoming-active.slide-from-right {
    animation: slideScaleInFromRight 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    transition: none !important; /* Tắt transition khi đang animation */
    /* Không set width/height ở đây, để animation tự xử lý */
}

.showcase-carousel-track.transitioning .showcase-carousel-slide.side.becoming-active.slide-from-left {
    animation: slideScaleInFromLeft 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    transition: none !important; /* Tắt transition khi đang animation */
    /* Không set width/height ở đây, để animation tự xử lý */
}

/* Áp dụng animation khi slide chuyển từ active sang side */
.showcase-carousel-track.transitioning .showcase-carousel-slide.active.becoming-side {
    animation: slideScaleOutToLeft 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    transition: none !important; /* Tắt transition khi đang animation */
    /* Không set width/height ở đây, để animation tự xử lý */
}

.showcase-carousel-track.transitioning .showcase-carousel-slide.active.becoming-side.slide-to-right {
    animation: slideScaleOutToRight 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    transition: none !important; /* Tắt transition khi đang animation */
    /* Không set width/height ở đây, để animation tự xử lý */
}

.showcase-carousel-slide.active.becoming-side.slide-to-left {
    animation: slideScaleOutToLeft 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    transition: none !important; /* Tắt transition khi đang animation */
    /* Không set width/height ở đây, để animation tự xử lý */
}

.showcase-carousel-slide.side:hover {
    opacity: 0.9;
    transform: translateY(-8px) translateZ(0) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}


.showcase-carousel-slide.side .showcase-carousel-overlay {
    background: rgba(0, 0, 0, 0);
}

.showcase-carousel-slide.side .showcase-carousel-image {
    object-fit: cover;
    object-position: center center;
}

/* Hidden Slides */
.showcase-carousel-slide:not(.visible) {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Position Indicator */
.showcase-carousel-position {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 16px;
    font-weight: 400;
    color: #868A99;
    z-index: 10;
    pointer-events: none;
    text-align: right;
}

.showcase-carousel-position-current {
    font-weight: 400;
    color: #868A99;
}

.showcase-carousel-position-separator {
    margin: 0 4px;
}

/* Navigation Links - Đặt dưới position indicator */
.showcase-carousel-navigation {
    position: absolute;
    top: 50px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    z-index: 10;
    pointer-events: auto;
}

.showcase-carousel-nav-link {
    color: #868A99;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    transition: color 0.3s ease;
    cursor: pointer;
    pointer-events: auto;
    /* Ngăn scroll jump khi click */
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
}

.showcase-carousel-nav-link:hover {
    color: #2C5F5F;
}

.showcase-carousel-nav-link.active {
    color: #166987;
    font-weight: 400;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .showcase-carousel-container {
        padding: 30px 15px;
        flex-direction: column;
        align-items: flex-start;
    }

    /* Position Indicator - Đặt ở trên cùng, không đè lên ảnh */
    .showcase-carousel-position {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 15px;
        align-self: flex-end;
        order: 1;
    }

    /* Navigation Links - Đặt dưới position indicator, trên ảnh */
    .showcase-carousel-navigation {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 20px;
        align-self: flex-end;
        order: 2;
    }

    .showcase-carousel-wrapper {
        order: 3;
        width: 100%;
    }

    .showcase-carousel-track {
        height: 533px; /* active slide height: 513px + buffer: 20px = 533px */
        min-height: 533px;
        gap: 20px;
        justify-content: flex-start;
    }

    .showcase-carousel-slide.active {
        width: 370px;
        height: 513px;
        max-height: 75vh;
    }

    .showcase-carousel-slide.side {
        width: 200px;
        height: 250px;
    }

    /* Responsive keyframes cho 1024px */
    @keyframes slideScaleInFromLeft {
        from {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(-150px) scale(0.88);
            opacity: 0.7;
        }
        to {
            width: 370px;
            height: 513px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes slideScaleInFromRight {
        from {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(150px) scale(0.88);
            opacity: 0.7;
        }
        to {
            width: 370px;
            height: 513px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes slideScaleOutToLeft {
        from {
            width: 370px;
            height: 513px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
        to {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(0) scale(0.92);
            opacity: 0.75;
        }
    }

    @keyframes slideScaleOutToRight {
        from {
            width: 370px;
            height: 513px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
        to {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(0) scale(0.92);
            opacity: 0.75;
        }
    }

    .showcase-carousel-slide.side .showcase-carousel-image {
        object-fit: cover;
        object-position: center center;
    }

}

@media (max-width: 768px) {
    .showcase-carousel-container {
        padding: 20px 10px;
        flex-direction: column;
        align-items: flex-start;
    }

    /* Position Indicator - Đặt ở trên cùng, không đè lên ảnh */
    .showcase-carousel-position {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 12px;
        align-self: flex-end;
        order: 1;
        font-size: 14px;
    }

    /* Navigation Links - Đặt dưới position indicator, trên ảnh */
    .showcase-carousel-navigation {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 15px;
        align-self: flex-end;
        order: 2;
        gap: 6px;
    }

    .showcase-carousel-nav-link {
        font-size: 14px;
    }

    .showcase-carousel-wrapper {
        overflow: hidden;
        order: 3;
        width: 100%;
    }

    .showcase-carousel-track {
        height: 477px; /* active slide height: 457px + buffer: 20px = 477px */
        min-height: 477px;
        gap: 15px;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .showcase-carousel-slide.active {
        width: 330px;
        height: 457px;
        max-width: none;
        max-height: 70vh;
        flex-shrink: 0;
    }

    .showcase-carousel-slide.side {
        width: 220px;
        height: 275px;
        flex-shrink: 0;
    }

    .showcase-carousel-slide.side .showcase-carousel-image {
        object-fit: cover;
        object-position: center center;
    }

    /* Responsive keyframes cho 768px */
    @keyframes slideScaleInFromLeft {
        from {
            width: 220px;
            height: 275px;
            transform: translateZ(0) translateX(-120px) scale(0.88);
            opacity: 0.7;
        }
        to {
            width: 330px;
            height: 457px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes slideScaleInFromRight {
        from {
            width: 220px;
            height: 275px;
            transform: translateZ(0) translateX(120px) scale(0.88);
            opacity: 0.7;
        }
        to {
            width: 330px;
            height: 457px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes slideScaleOutToLeft {
        from {
            width: 330px;
            height: 457px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
        to {
            width: 220px;
            height: 275px;
            transform: translateZ(0) translateX(0) scale(0.92);
            opacity: 0.75;
        }
    }

    @keyframes slideScaleOutToRight {
        from {
            width: 330px;
            height: 457px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
        to {
            width: 220px;
            height: 275px;
            transform: translateZ(0) translateX(0) scale(0.92);
            opacity: 0.75;
        }
    }

}

@media (max-width: 480px) {
    .showcase-carousel-container {
        padding: 15px 5px;
        flex-direction: column;
        align-items: flex-start;
    }

    /* Position Indicator - Đặt ở trên cùng, không đè lên ảnh */
    .showcase-carousel-position {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 10px;
        align-self: flex-end;
        order: 1;
        font-size: 13px;
    }

    /* Navigation Links - Đặt dưới position indicator, trên ảnh */
    .showcase-carousel-navigation {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 12px;
        align-self: flex-end;
        order: 2;
        gap: 5px;
    }

    .showcase-carousel-nav-link {
        font-size: 13px;
    }

    .showcase-carousel-wrapper {
        overflow: hidden;
        order: 3;
        width: 100%;
    }

    .showcase-carousel-track {
        height: 436px; /* active slide height: 416px + buffer: 20px = 436px */
        min-height: 436px;
        gap: 10px;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .showcase-carousel-slide.active {
        width: 300px;
        height: 416px;
        max-width: none;
        max-height: 65vh;
        flex-shrink: 0;
    }

    .showcase-carousel-slide.side {
        width: 200px;
        height: 250px;
        flex-shrink: 0;
    }

    .showcase-carousel-slide.side .showcase-carousel-image {
        object-fit: cover;
        object-position: center center;
    }

    /* Responsive keyframes cho 480px */
    @keyframes slideScaleInFromLeft {
        from {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(-100px) scale(0.88);
            opacity: 0.7;
        }
        to {
            width: 300px;
            height: 416px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes slideScaleInFromRight {
        from {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(100px) scale(0.88);
            opacity: 0.7;
        }
        to {
            width: 300px;
            height: 416px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes slideScaleOutToLeft {
        from {
            width: 300px;
            height: 416px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
        to {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(0) scale(0.92);
            opacity: 0.75;
        }
    }

    @keyframes slideScaleOutToRight {
        from {
            width: 300px;
            height: 416px;
            transform: translateZ(0) translateX(0) scale(1);
            opacity: 1;
        }
        to {
            width: 200px;
            height: 250px;
            transform: translateZ(0) translateX(0) scale(0.92);
            opacity: 0.75;
        }
    }

}

/* Touch Support for Mobile */
@media (hover: none) and (pointer: coarse) {
    .showcase-carousel-slide {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Loading State */
.showcase-carousel-image:not(.loaded) {
    opacity: 0;
}

.showcase-carousel-image.loaded {
    opacity: 1;
}

/* Ẩn tất cả các element có class kết thúc bằng "-slide-item" mặc định */
*[class*="-slide-item"]:not(.show) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Hiển thị các element có class "show" */
*[class*="-slide-item"].show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}


