@import '../../../styles/mixins';

$bundle-bgcolor: $white;
$bundle-card-padding-x: $grid-gutter-width;
$bundle-border-width: 2px;
$bundle-arrow-inner-size: 10px;
$bundle-arrow-size: $bundle-arrow-inner-size + ($bundle-border-width * 1.5);

$bundle-tab-zindex: 2;
$bundle-panel-bg-zindex: 1;

$slick-arrow-size: 44px;

.productBundles {
    &_title {
        @include title-1;
        margin-bottom: 20px;
    }
    &_card {
        @include grid-item($bundle-card-padding-x);
        position: relative;
        height: 100%;
        padding-bottom: $bundle-arrow-size;

        &Button {
            @extend %reset-button;
            position: absolute;
            top: 0;
            bottom: $bundle-arrow-size;
            left: $bundle-card-padding-x;
            width: calc(100% - #{$bundle-card-padding-x} * 2);
            display: block;
            cursor: pointer;
            z-index: 1;

            &Text {
                @extend %sr-only;
            }
        }
    }
    &_bundle {
        position: relative;
        border: $bundle-border-width solid $mid-gray;
        border-radius: 8px;
        background-color: $bundle-bgcolor;
        transition: border-color 0.3s ease;

        &:after, &:before {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            height: 0;
            width: 0;
            pointer-events: none;
            transform: translateX(-50%);
            border: solid transparent;

            opacity: 0;
            transition: opacity 0.15s ease;
        }

        &:after {
            border-color: transparent;
            border-top-color: $bundle-bgcolor;
            border-width: $bundle-arrow-inner-size;
            transition-delay: 0.05s;
        }
        &:before {
            border-color: transparent;
            border-top-color: var(--tile-highlight-color, $primary-color);
            border-width: $bundle-arrow-size;
            transition-delay: 0s;
        }
    }

    &_cardButton:hover + &_bundle, 
    &_cardButton:focus + &_bundle, 
    &_bundle--selected {
        border-color: $primary-color;

        &:after, &:before {
            opacity: 1;
            transition-delay: 0s;
        }
        &:before {
            transition: opacity 0.15s ease;
        }
        &:after {
            transition: opacity 0.05s ease;
        }
    }
    
    &_panel {
        position: relative;
        padding: 50px 0;

        &:before {
            @include full-window-width;
            content: "";
            background-color: var(--bundle-features-bg-color, $light-gray);
            z-index: $bundle-panel-bg-zindex;
        }
    }
    &_summary,
    &_features {
        position: relative;
        z-index: $bundle-panel-bg-zindex + 1;
    }
    &_features {
        margin-top: 40px;
    }

    // Bundle carousel's styles
    &_container {
        .slick {
            &-slider {
                @include media-md-down {
                    $slider-padding: 25px;
                    padding-left: $slider-padding;
                    padding-right: $slider-padding;
                }
            }
            &-list {
                @include grid-row;
                @include media-md-down {
                    overflow: visible;
                }
            }
            &-prev {
                @include media-md-down {
                    left: 0;
                }
            }
            &-next {
                @include media-md-down {
                    right: 0;
                }
            }
            &-track {
                display: flex;
                margin-left: 0;
            }
            &-slide {
                height: inherit;
    
                & > div {
                    height: 100%;
                }
            }
        }
    }
    &_sliderMask {
        @include media-md-down {
            overflow: hidden;
            width: 100vw;
            position: relative;
            left: 50%;
            right: 50%;
            margin-left: -50vw;
            margin-right: -50vw;
            padding-left: $grid-gutter-width * 2;
            padding-right: $grid-gutter-width * 2;
        }
    }
    // Show bottom arrow on bundle cards with slick track overflow hidden
    &_tab {
        position: relative;
        z-index: $bundle-tab-zindex;
        margin-bottom: $bundle-arrow-size * -1;
        @include media-md-up {
            margin-left: $grid-gutter-width * -1;
            margin-right: $grid-gutter-width * -1;
        }
    }
    &_panel {
        z-index: $bundle-tab-zindex - 1;
    }
}
