.box-image {
    .wrapper {
        position: relative;
        display: flex;
        align-items: center;
        padding-top: 10px;
        gap: 5px;

        .item-img {
            position: relative;
            width: 40px;
            height: 30px;
            border-radius: 5px;
            overflow: hidden;
            cursor: pointer;
            user-select: none;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
            }

            &.last-item {
                .overlay-item {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    background-color: rgba(0, 0, 0, 0.5);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    border-radius: 5px;

                    span {
                        color: #fff;
                        font-size: 10px;
                        font-weight: bold;
                    }
                }
            }
        }
    }
}

.modal-gallery {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;

    .modal-content {
        position: relative;
        width: 100%;
        max-width: 550px;
        height: auto;
        background-color: #fff;
        border-radius: 5px;
        overflow: hidden;
        display: flex;
        flex-direction: column;

        .card-close {
            position: absolute;
            top: 10px;
            right: 10px;
            z-index: 10;
            background-color: #f9f9f9;
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

            .btn-close-gallery {
                background-color: transparent;
                border: none;
                cursor: pointer;
                outline: none;
                height: 30px;
                width: 30px;

                svg {
                    width: 15px;
                    height: 15px;
                    color: #333;
                }
            }
        }

        .card-gallery {
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            overflow: hidden;
            position: relative;
            border-radius: 5px;

            .wrapper {
                display: flex;
                flex-direction: column;
                align-items: center;
                position: relative;
                width: 500px;
                height: 500px;
                padding: 10px;
                box-sizing: border-box;

                .card-preview-image {
                    position: relative;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    overflow: hidden;
                    width: 100%;
                    height: 350px;
                    margin-bottom: 20px;
                    cursor: pointer;
                    user-select: none;

                    img {
                        max-width: 100%;
                        max-height: 100%;
                        width: auto;
                        height: auto;
                        object-fit: contain;
                        border-radius: 5px;
                    }
                }

                .card-stock-image {
                    position: relative;
                    display: flex;
                    overflow-x: auto;
                    overflow-y: hidden;
                    scrollbar-width: none;
                    -ms-overflow-style: none;
                    width: 100%;
                    height: 100px;
                    padding: 5px 0;

                    .card-stock-image-item {
                        position: relative;
                        z-index: 1;
                        flex: 0 0 auto;
                        width: 150px;
                        height: 100px;
                        border-radius: 5px;
                        overflow: hidden;
                        margin: 0 10px;
                        cursor: pointer;
                        transition: transform 0.3s ease, opacity 0.3s ease, border-color 0.3s ease;
                        border: 2px solid transparent;
                        user-select: none;

                        &:hover {
                            transform: scale(1.05);
                            opacity: 0.8;
                        }

                        &.active {
                            transform: scale(1.05);
                            opacity: 1;

                            &:hover {
                                transform: scale(1.1);
                                opacity: 1;
                            }
                        }

                        img {
                            width: 100%;
                            height: 100%;
                            object-fit: cover;
                            display: block;
                            cursor: pointer;
                        }
                    }
                }

                .card-nav {
                    position: absolute;
                    display: flex;
                    justify-content: space-between;
                    bottom: 50px;
                    width: 100%;
                    padding: 0;

                    .card-nav-item {
                        position: relative;
                        z-index: 2;
                        cursor: pointer;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        width: 40px;
                        height: 40px;
                        background-color: rgba(255, 255, 255, 0.8);
                        border-radius: 50%;
                        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
                        transition: background-color 0.3s ease;
                        outline: none;
                        border: none;
                        -webkit-tap-highlight-color: transparent;

                        &:hover {
                            background-color: rgba(255, 255, 255, 1);
                        }

                        &:focus {
                            outline: none;
                        }

                        &:active {
                            outline: none;
                        }

                        .card-nav-icon {
                            width: 24px;
                            height: 24px;
                            color: #333;
                        }
                    }

                    .item-prev {
                        margin-left: 0;
                    }

                    .item-next {
                        margin-right: 0;
                    }
                }

                .card-dot {
                    display: none;
                }
            }
        }
    }
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    .modal-gallery {
        padding: 50px;

        .modal-content {
            width: 100%;
            height: auto;
            max-width: 500px;
            max-height: none;

            .card-close {
                padding: 5px;
                top: 20px;
                right: 20px;

                .btn-close-gallery {
                    height: 25px !important;
                    width: 25px !important;

                    svg {
                        width: 15px;
                        height: 15px;
                        color: #333;
                    }
                }
            }

            .card-gallery {
                padding: 0px;

                .wrapper {
                    padding: 30px;
                    height: auto;
                    width: unset;

                    .card-preview-image {
                        height: 300px;
                    }

                    .card-stock-image {
                        display: none;
                    }

                    .card-nav {
                        top: 50%;

                        .item-prev {
                            margin-left: 10px;
                        }

                        .item-next {
                            margin-right: 10px;
                        }
                    }

                    .card-dot {
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        position: absolute;
                        bottom: 20px;
                        width: 100%;
                        padding: 10px;

                        .card-dot-item {
                            width: 10px;
                            height: 10px;
                            margin: 0 5px;
                            background-color: #ccc;
                            border-radius: 50%;
                            cursor: pointer;

                            &.active {
                                background-color: #333;
                            }
                        }
                    }
                }
            }
        }
    }

}

@media (max-width: 480px) {
    .modal-gallery {
        padding: 20px;

        .modal-content {
            .card-close {
                top: 15px;
                right: 15px;
            }

            .card-gallery {
                padding: 15px 0px 0px 0px;

                .wrapper {
                    padding: 10px 15px;

                    .card-preview-image {
                        height: auto;

                        .card-stock-image {
                            display: none;
                        }
                    }

                    .card-nav {
                        padding: 0px;
                        top: 45%;

                        .item-prev {
                            margin-left: 0;
                        }

                        .item-next {
                            margin-right: 0;
                        }
                    }

                    .card-dot {
                        bottom: 10px;
                        padding: 5px;

                        .card-dot-item {
                            width: 8px;
                            height: 8px;
                            margin: 0 3px;
                        }
                    }
                }
            }
        }
    }
}

@media (max-width: 350px) {
    .box-image {
        .wrapper {
            .item-img {
                width: 35px;
                height: 25px;
            }
        }
    }
}