body {
    background-color: #f8f8f8;
}

/* Within form id souvenirs */
form#souvenirs {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    justify-content: space-between;
    align-items: start;

    .product-list {
        flex: 1 1 70%;
        flex-wrap: wrap;

        .product-holder {
            display: flex;
            flex-direction: row;
            gap: 1rem;
            align-items: stretch;

            @media screen and (max-width: 767px) {
                flex-direction: column;
            }
        }

        .product {
            cursor: pointer;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            flex: 0 1 calc(25% - 1rem);
            border: 1px solid rgba(0, 0, 0, 0.09);
            background-color: white;
            flex-basis: calc(50% - 1rem);

            .product-thumbnail {
                position: relative;
                height: 0;
                width: 100%;
                padding-bottom: 100%;
                overflow: hidden;
                background-color: #e6e6e6;
                flex-grow: 1;

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

            .product-details {
                padding: 10px;
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                gap: 1rem;
            }

            .price {
                &::before {
                    content: "MYR ";
                    font-size: small;
                }
            }

            .price.slashed {
                color: #808080;
                font-size: smaller;
                position: relative;

                &::after {
                    content: "";
                    height: 1px;
                    width: calc(100% + 4px);
                    position: absolute;
                    background-color: #aaa;
                    top: 50%;
                    left: -2px;
                }
            }

            &:hover {
                border: 1px solid #ee4d2d;
                box-shadow: 0 1px 5px rgba(129, 129, 129, 0.5);
            }
        }
    }

    .summary {
        box-shadow: 0 1px 5px rgba(129, 129, 129, 0.5);
        flex: 1 1 30%;

        .body {
            table {
                th {
                    font-size: smaller;
                }

                td, th {
                    padding: 8px 13px;

                    &:first-child {
                        padding-left: 0;
                    }

                    &:last-child {
                        padding-right: 0;
                    }
                }

                td {
                    font-weight: 500;

                    small {
                        font-size: 11px;
                    }
                }
            }
        }

        .footer {
            #total-amount-to-pay {
                &::before {
                    content: "MYR ";
                }
            }
        }
    }
}

/* Dialog */
dialog.product {
    overflow-y: hidden;

    form {
        width: 100%;
        height: 100%;
        /* display: flex;
        flex-direction: column; */

        .body {
            display: flex;
            flex-direction: row;
            gap: 1rem;
            /* flex-grow: 1; */
            align-items: start;
            width: 100%;
            height: calc(100% - 65px);

            .product-images {
                display: flex;
                flex-direction: column;
                flex: 0 0 50%;
                max-width: 450px;
                max-height: 100%;

                .display-image {
                    position: relative;
                    width: 100%;
                    overflow: hidden;
                    background-color: #e6e6e6;
                    max-height: calc(100% - 95px);

                    &::after {
                        content: "";
                        display: block;
                        padding-bottom: 100%;
                    }

                    img {
                        width: 100%;
                        height: 100%;
                        object-fit: contain;
                        position: absolute;
                    }
                }

                .product-images-thumbnails-scroller {
                    position: relative;

                    .prev {
                        left: 0;
                    }

                    .next {
                        right: 0;
                    }

                    .prev,
                    .next {
                        top: 50%;
                        transform: translateY(-50%);
                        position: absolute;
                        color: white;
                        background-color: rgba(0, 0, 0, 0.3);
                        padding: 5px;

                        i {
                            cursor: pointer;

                            &::before {
                                font-style: normal;
                                font-family: "FontAwesome";
                            }
                        }
                    }

                    .product-images-thumbnails {
                        height: 95px;
                        width: 100%;
                        display: flex;
                        gap: 0.5rem;
                        overflow-y: hidden;
                        overflow-x: auto;
                        scroll-snap-type: x mandatory;
                        outline: none;
                        align-items: center;
                        padding: 2px 2px;

                        .product-image-thumbnail {
                            scroll-snap-align: start;
                            position: relative;
                            overflow: hidden;
                            flex: 0 0 82px;
                            border: 1px solid rgba(0, 0, 0, 0.09);
                            cursor: pointer;
                            transition: none;
                            background-color: #e6e6e6;
                            /* height: 82px; */

                            &::after {
                                content: "";
                                display: block;
                                padding-bottom: 100%;
                            }

                            &:hover,
                            &.active {
                                outline: #ee4d2d solid 2px;
                            }

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

            .product-details {
                display: flex;
                flex-direction: column;
                gap: 1rem;
                flex: 1 0 calc(50% - 1rem);
                overflow-y: auto;
                height: 100%;

                .edit-price {
                    display: flex;
                    flex-wrap: wrap;
                    gap: 0.5rem;
                    background-color: #fafafa;
                    align-items: center;
                    padding: 0.5rem;

                    .price::before {
                        content: "MYR ";
                        font-size: small;
                    }

                    .edit-discount-price,
                    .edit-discount-price.hidden + .edit-original-price {
                        color: red;
                        font-weight: 900;
                        font-size: larger;
                    }

                    .edit-discount-price:not(.hidden) + .edit-original-price {
                        color: gray;
                        font-weight: 500;
                        font-size: smaller;
                        position: relative;

                        &::after {
                            position: absolute;
                            content: "";
                            height: 1px;
                            width: calc(100% + 2px);
                            left: -1px;
                            top: 50%;
                            background-color: gray;
                        }
                    }
                }

                .edit-variations {
                    display: flex;
                    flex-direction: column;
                    gap: 1rem;

                    .variation {
                        font-size: smaller;

                        h4 {
                            font-weight: 600;
                            margin-bottom: 0.5rem;
                        }

                        .options {
                            display: flex;
                            flex-wrap: wrap;
                            gap: 0.5rem;
                            /* max-height: 100px; */
                            /* overflow: auto; */

                            /* &::-webkit-scrollbar {
                                width: 7px;
                                height: 7px;
                            } */

                            label {
                                padding: 0.5rem 1rem;
                                border: 1px solid #e8e8e8;
                                cursor: pointer;
                                user-select: none;

                                &.disabled {
                                    background-color: #fafafa;
                                    color: rgba(0, 0, 0, .26);
                                    cursor: not-allowed;
                                    pointer-events: none;
                                }

                                &:has(> input[type="radio"]) {
                                    padding: 0.5rem 1rem 0.5rem 15px
                                }

                                input[type="radio"] {
                                    width: 1px;
                                    height: 1px;
                                    transform: scale(0);
                                }

                                &:has(input:checked) {
                                    position: relative;
                                    font-weight: 700;
                                    border-color: #ee4d2d;

                                    &::after {
                                        position: absolute;
                                        content: "";
                                        height: 0;
                                        width: 0;
                                        right: 0;
                                        bottom: 0;
                                        border-bottom: 10px solid #ee4d2d;
                                        border-left: 10px solid transparent;
                                    }
                                }

                                &:hover {
                                    border-color: #ee4d2d;
                                }
                            }
                        }
                    }
                }

                .qty {
                    h4 {
                        margin-bottom: 0.5rem;
                        font-weight: 600;
                        font-size: smaller;
                    }

                    .qty-input {
                        display: flex;
                        flex-wrap: nowrap;

                        button:first-child {
                            border-radius: 1px 0 0 1px;
                            border-right: 0;
                        }

                        button:last-child {
                            border-radius: 0 1px 1px 0;
                            border-left: 0;
                        }

                        input {
                            outline: none;
                            border: 1px solid #d8d7da;
                            border-radius: 0;
                        }
                    }
                }
            }
        }
    }
}

@media screen and (max-width: 991px) {
    form#souvenirs {
        flex-direction: row;
        /* align-items: stretch; */

        .product-list {
            flex-basis: 35%;

            .product {
                flex: 0 1 calc(50% - 1rem);
            }
        }
    }

    dialog.product {
        height: 95%;
        overflow: auto;

        form {
            height: unset;

            .body {
                flex-direction: column;

                .product-images {
                    width: 100%;
                    max-width: 100%;
                }

                .product-details {
                    flex: unset;

                    .edit-variations {
                        .variation {
                            .options {
                                max-height: 100%;
                            }
                        }
                    }
                }
            }
        }
    }
}

@media screen and (max-width: 991px) {
    form#souvenirs {
        flex-direction: column;
        align-items: stretch;
    }
}
