/**
 * Copyright Â© 2021 O2TI. All rights reserved.
 * @author  Bruno Elisei <brunoelisei@o2ti.com>
 * See LICENSE.txt for license details.
 */

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .full-checkout {
        .authentication-dropdown {
            box-sizing: border-box;

            .modal-inner-wrap {
                padding: @theme-full-checkout-block-auth__dropdown__padding;
            }
        }

        .authentication-wrapper {
            float: right;
            margin-top: -1.5*@indent__xl;
            max-width: 50%;
            position: relative;
            z-index: 1;

            ._has-auth-shown & {
                z-index: @modal__z-index;
            }
        }

        .action-auth-toggle {
            &:extend(.abs-action-button-as-link all);
        }

        .theme-full-checkout-block-authentication {
            .block-title {
                .lib-font-size(@h3__font-size);

                border-bottom: 0;
                margin-bottom: @indent__m;

                strong {
                    font-weight: @font-weight__light;
                }
            }

            .field {
                .label {
                    font-weight: @font-weight__regular;
                }
            }

            .actions-toolbar {
                margin-bottom: @indent__xs;

                > .secondary {
                    padding-top: @indent__m;
                    text-align: left;
                }
            }

            .action.action-register,
            .action.action-login {
                &:extend(.abs-button-l all);
            }

            .block[class] {
                margin: 0;

                ul {
                    list-style: none;
                    padding-left: @indent__s;
                }

                .field {
                    .control,
                    .label {
                        float: none;
                        width: auto;
                    }
                }

                & + .block {
                    border-top: 1px solid @color-gray-light5;
                    margin-top: @indent__xl;
                    padding-top: @indent__xl;
                    position: relative;

                    &::before {
                        .lib-css(height, @theme-full-checkout-block-auth__or-label__size);
                        .lib-css(line-height, @theme-full-checkout-block-auth__or-label__size - 2px);
                        .lib-css(margin, -(@theme-full-checkout-block-auth__or-label__size/2 + 1px) 0 0 -(@theme-full-checkout-block-auth__or-label__size / 2));
                        .lib-css(min-width, @theme-full-checkout-block-auth__or-label__size);

                        background: @color-white;
                        border: 1px solid @color-gray-light5;
                        border-radius: 50%;
                        box-sizing: border-box;
                        color: @color-gray-light5;
                        content: attr(data-label);
                        display: inline-block;
                        left: 50%;
                        letter-spacing: normal;
                        padding: 0 .2rem;
                        position: absolute;
                        text-align: center;
                        text-transform: uppercase;
                        top: 0;
                    }
                }
            }
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .full-checkout {
        .authentication-dropdown {
            .lib-css(background-color, @theme-full-checkout-block-auth__dropdown__background-color);
            .lib-css(border, @theme-full-checkout-block-auth__border);

            position: absolute;
            text-align: left;
            top: 100%;
            transform: scale(1, 0);
            transform-origin: 0 0;
            transition: transform linear .1s, visibility 0s linear .1s;
            visibility: hidden;
            width: 100%;

            &._show {
                .lib-css(z-index, @dropdown-list__z-index);

                transform: scale(1, 1);
                transition: -webkit-transform linear .1s, visibility 0s linear 0s;
                transform: scale(1, 1);
                transition: transform linear .1s, visibility 0s linear 0s;
                visibility: visible;
            }
        }

        .authentication-wrapper {
            .lib-column-width(@theme-full-checkout-sidebar__columns);

            text-align: right;
        }

        .theme-full-checkout-block-authentication {
            .block-title {
                .lib-font-size(@h2__font-size);

                border-bottom: 0;
                margin-bottom: @indent__m;
            }

            .actions-toolbar {
                > .primary {
                    display: inline;
                    float: right;
                    margin-right: 0;

                    .action {
                        margin-right: 0;
                    }
                }

                > .secondary {
                    float: left;
                    margin-right: 2rem;
                    padding-top: 1rem;
                }
            }
        }

        .popup-authentication {
            .modal-inner-wrap {
                min-width: @screen__m;
                width: 60%;
            }

            .theme-full-checkout-block-authentication {
                .lib-vendor-prefix-display(flex);
                .lib-vendor-prefix-flex-direction(row);

                border-top: 1px solid @color-gray-light5;
            }

            .block[class],
            .form-login,
            .fieldset,
            .block-content {
                .lib-vendor-prefix-display(flex);
                .lib-vendor-prefix-flex-direction(column);
                .lib-vendor-prefix-flex-grow(1);
            }

            .block[class] {
                box-sizing: border-box;
                float: left;
                padding: @indent__s @indent__l 0 0;
                width: 50%;

                & + .block {
                    border-left: 1px solid @color-gray-light5;
                    border-top: 0;
                    margin: 0;
                    padding: @indent__s 0 0 @indent__xl;

                    &::before {
                        left: 0;
                        top: 50%;
                    }
                }
            }

            .actions-toolbar {
                margin-bottom: 0;
                margin-top: auto;
            }
        }
    }
}
