:root {
    /* scope any CSS vars if we need later */
}

/* Root covers the whole viewport and holds backdrop + panel */
.experiment-right-drawer-root {
    position: fixed;
    inset: 0;
    z-index: 2147483640; /* very high to be above site UI */
    display: block;
    pointer-events: none; /* disabled until opened */
}

/* Backdrop covers everything behind the drawer */
.experiment-right-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    transition: opacity 300ms ease;
}

/* The sliding panel */
.experiment-right-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100vh;
    width: 620px;
    max-width: 100vw; /* safety on small screens */
    background: #fff;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 300ms ease;
    will-change: transform;
    display: flex;
    flex-direction: column;
}

/* Optional content wrapper inside the panel */
.experiment-right-drawer-content {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    padding: 24px;
    margin-bottom: 80px;
    position: relative;
    
    header {
        display: flex;
        justify-content: space-between;
        margin-bottom: 24px;
        
        span {
            font-family: "Barlow Semi Condensed", sans-serif;
            font-size: 24px;
        }

        .close-drawer {
            background: lightgray;
            border-radius: 50%;
            padding: 10px;
            width: 35px;
            height: 35px;
            text-align: center;
            line-height: 15px;
            font-size: 18px;
            font-weight: 100;
            cursor: pointer;
        }
    }
    
    .product-summary {
        display: flex;
        flex-direction: row;
        gap: 16px;
        align-items: center;
        justify-content: space-between;
        
        .image-wrapper {
            display: flex;
            flex-direction: row;
            gap: 24px;
            align-items: center;
        }
        
        .product-details {
            display: flex;
            flex-direction: column;
            max-width: 50%;
            
            span {
                font-weight: bold;
                font-size: 16px;
            }
            
            div {
                font-size: 14px
            }
        }
        
        img {
            max-width: 100px;
        }
        
        .product-price {
            font-size: 24px;
            font-weight: bold;
            white-space: nowrap;
        }
    }
    
    .recommended-product-wrapper {
        margin-top: 40px;

        > span {
            display: flex;
            font-size: 18px;
            font-weight: 500;
            font-family: "Roboto", sans-serif;
            margin-bottom: 12px;
        }
    }
    
    .recommended-products {
        display: flex;
        flex-direction: column;
        gap: 16px;
        max-height: calc(100vh - 350px);
        
        img {
            width: 100px;
        }
        
        .recommended-product {
            display: flex;
            width: 100%;
            border: 1px solid lightgray;
            border-radius: 8px;
            padding: 16px;
            gap: 16px;
            align-items: center;
            
            
            .recommended-product-content{
                display: flex;
                gap: 16px;
                align-items: center;
                justify-content: space-between;
                width: 100%;
            }
            
            .product-list-details {
                width: 300px;
                display: flex;
                flex-direction: column;
                gap: 10px;
                
                > a {
                    color: black;
                    text-decoration: none;
                }
                
                .product-name {
                    font-family: "Roboto", sans-serif;
                    font-size: 16px;
                    font-weight: 500;
                }
                
                .highlights {
                    display: flex;
                    flex-direction: column;
                    gap: 8px;
                    font-size: 14px;
                }
                
                .reviews {
                    display: flex;
                    align-items: center;
                    gap: 4px;
                    font-size: 14px;
                    font-weight: 500;

                    .recommended-product-review-count {
                        font-weight: 400;
                        font-size: 13px;
                    }
                    
                    .recommended-product-review-count-mobile {
                        display: none;
                    }
                }
                
                .prices {
                    display: flex;
                    flex-direction: row;
                    gap: 10px;
                    align-items: center;
                    
                    .current {
                        font-family: "Barlow Semi Condensed", sans-serif;
                        font-size: 20px;
                        font-weight: 700;
                    }
                    
                    .before {
                        font-family: "Barlow Semi Condensed", sans-serif;
                        font-size: 14px;
                        text-decoration: line-through;
                        font-weight: 500;
                    }

                    .discount {
                        font-family: "Barlow Semi Condensed", sans-serif;
                        font-size: 14px;
                        font-weight: 600;
                        padding: 2px 8px;
                        background: #FEDB7B;
                        border-radius: 2px;
                    }
                }
            }
            
        }
        
        .cta-button {
            display: flex;
            justify-content: center;
            width: auto;
            height: 36px;
            min-width: 64px;
            background: #000;
            color: #fff;
            border-radius: 4px;
            border: none;
            cursor: pointer;
            padding: 8px 16px;
            white-space: nowrap;
            font-size: 13px;

            span {
                color: darkgreen;
            }
        }
    }

    footer {
        display: flex;
        position: fixed;
        bottom: 0;
        padding: 16px 0;
        gap: 16px;
        width: calc(100% - 48px);
        background: white;
        
        & button {
            display: flex;
            justify-content: center;
            padding: 12px;
            width: 100%;
            font-family: 'Roboto', sans-serif;
            font-size: 15px;
            text-align: center;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            
            &:first-of-type {
                border: 1px solid lightgray;
            }
            
            &:last-of-type {
                background: #f8b912;
            }
        }
    }
}

@media screen and (max-width: 640px) {
    .product-summary {
        flex-direction: column !important;
        .product-details {
            span {
                font-size: 14px !important;
            }
            div {
                font-size: 12px !important;
            }
        }
    }
    .experiment-right-drawer-content {
        margin-bottom: 80px;
        .recommended-products {
            .recommended-product {
                .product-list-details {
                    width: auto;
                    
                    .product-name {
                        font-size: 15px;
                    }
                    
                    .highlights {
                        font-size: 13px;
                    }
                    
                    .recommended-product-review-count {
                        display: none;
                    }
                    
                    .recommended-product-review-count-mobile {
                        display: block;
                    }
                }
                
                .recommended-product-content {
                    flex-direction: column;
                    align-items: flex-start;
                    width: auto;
                }
            }
        }
    }
}

/* Open state: enable pointer events and animate in */
.experiment-right-drawer-root.open {
    pointer-events: auto;
}

.experiment-right-drawer-root.open .experiment-right-drawer-backdrop {
    opacity: 0.6; /* black backdrop over the rest of the website */
}

.experiment-right-drawer-root.open .experiment-right-drawer-panel {
    transform: translateX(0);
}
