//NOTE: This file have some LESS limitations due to post processing (see: ../../assets.js):
//-Use only pure mixins
//-@import directive can't be used, because imported files are not affected by post processing
//due to strange less parser design.

.layout-default() {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
}


#root.root > {
    position: absolute;
    display: block;
    left: 0px;
    top: 0px;
    margin: 0 !important;
    overflow: visible;
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
    transform: none !important;

    .layout-default();

    /*Mixins*/
    .sprite-icon() {
        background-image: url("/testcafe-ui-sprite.png") !important;
        background-repeat: no-repeat;
        background-color: transparent;
        display: block;
    }

    .rounded-corners(@radius) {
        border-radius: @radius !important;
        -webkit-border-radius: @radius !important;
        -moz-border-radius: @radius !important;
        -o-border-radius: @radius !important;
    }

    .unselectable() {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    //use this mixin for all the elements that we are going to set position:fixed (described in T171764)
    .position-fixed() {
        position: fixed;
        -webkit-transform: translate3d(0px, 0px, 0px) !important;
    }

    .box-shadow(@shadow) {
        -webkit-box-shadow: @shadow !important;
        -moz-box-shadow: @shadow !important;
        box-shadow: @shadow !important;
    }

    /*Const*/
    @rootZIndex: 2147483647;
    @rootContentPadding: 5px 2px 5px 11px;

    /*Make z-index context*/
    z-index: @rootZIndex;

    /*Reset*/
    fieldset, img {
        border: 0;
    }

    ol, ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    h1, h2, h3, h4, h5, h6 {
        font-size: 100%;
        font-weight: normal;
    }

    table {
        border-collapse: collapse;
        border-spacing: 0;
        font-size: 100%;
        font: inherit;
    }

    * {
        width: auto;
        height: auto;

        .layout-default();

        vertical-align: baseline;
        background: transparent;
        text-align: left !important;
        line-height: normal;
        border-radius: 0px;
        font-variant: normal !important;
        font-weight: normal;
        font-size: inherit;
        cursor: default;
        font-family: Segoe UI, Helvetica, sans-serif !important;
        letter-spacing: normal;
        clear: none;
        box-sizing: content-box;
        -moz-box-sizing: content-box;
        transition: none !important;
        -webkit-transition: none !important;
        -moz-transition: none !important;
        -o-transition: none !important;
        zoom: 1 !important;
        text-indent: 0 !important;
        text-shadow: none;
        overflow: visible;
        float: none !important;
    }

    textarea, input, select,
    input:focus, input[type="text"], input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,
    input[type="button"], input[type="button"]:hover, input[type="button"]:focus, input[type="button"]:active {
        .layout-default();

        font-family: Segoe UI, Helvetica, sans-serif;
        cursor: text;
        font-weight: normal;
        vertical-align: baseline;
        background-color: white;
        background-image: none;
        background-position: 0 0;
        background-repeat: no-repeat;
        text-align: left !important;
        line-height: normal;
        border-radius: 0px;
        min-height: 0;
        min-width: 0;

        box-shadow: none;
        box-sizing: content-box;
        -webkit-box-sizing: content-box;
        -moz-box-sizing: content-box;
        -moz-user-select: auto;
        -webkit-user-select: auto;
        transition: none !important;
        -webkit-transition: none !important;
        -moz-transition: none !important;
        -o-transition: none !important;
        letter-spacing: normal;
        text-shadow: none;
        text-transform: none;
    }

    ::-ms-clear {
        display: none;
    }

    label {
        display: inline;
        color: #ffffff !important;
    }

    button::-moz-focus-inner {
        margin-top: -1px;
    }

    /* Clear */
    .clear {
        display: block;
        clear: both;
        height: 0;
        width: 0;
        font-size: 0;
        line-height: 0;
        overflow: hidden;
        visibility: hidden;
    }

    &.hidden {
        visibility: hidden;
    }

    /* Cursor */
    &.blind .cursor {
        opacity: 0.4;
    }

    .cursor {
        .sprite-icon;

        .position-fixed();
        left: 0;
        top: 0;
        width: 35px;
        height: 57px;
        pointer-events: none;
        background-position: 0 0;
        z-index: @rootZIndex - 3;

        &.l-mouse-down {
            background-position: -64px 0;
        }

        &.r-mouse-down {
            background-position: -130px 0;
        }

        &.touch {
            width: 50px;
            height: 50px;
            background-position: -190px 0;

            &.l-mouse-down,
            &.r-mouse-down {
                background-position: -264px 0;
            }
        }

    }

    /* Modal background and loading text */
    .modal-background {
        display: none;
        .position-fixed();
        top: 0;
        left: 0;
        z-index: @rootZIndex - 2;
        background-color: #000000;
    }

    .loading-text {
        font-family: Segoe UI, Helvetica, sans-serif;
        font-size: 40px;
        color: #ffffff;
        text-shadow: 0 0 10px #000000;

        display: none;
        .position-fixed();
        top: 0;
        left: 0;
        z-index: @rootZIndex - 1;
    }

    .loading-icon {
        .sprite-icon();
        width: 218px;
        height: 218px;
        background-position: -465px 0;
        .position-fixed();
        z-index: @rootZIndex;
    }

    /*Progress panel*/
    .progress-panel {
        .box-shadow(0px 4px 20px rgba(0, 0, 0, 0.5));
        .rounded-corners(7px);
        background-color: rgba(0, 0, 0, 0.8);
        padding: 92px 120px 110px;
        width: 500px;
        position: fixed;
        display: none;

        .title {
            font-weight: lighter;
            font-family: 'Segoe UI Light', 'Segoe UI', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Verdana, sans-serif;
            font-size: 33px;
            text-align: center !important;
            margin: 0 25px 31px;
            color: white;
        }

        .content {
            max-width: 498px;
            height: 17px;
        }
    }

    .progress-bar {
        width: 100%;
        height: 15px;
        background-color: transparent;
        border: 1px solid #df5679;
        padding: 0;
        overflow: hidden;

        .value {
            background-color: #df5679;
            height: 15px;
        }

        &.success {
            border-color: #6ab779;

            .value {
                background-color: #6ab779;
            }
        }
    }

    /* Actions Emulating */
    .tcOptionList {
        overflow-y: auto;
        background-color: white;
        border: 1px solid #7F9DB9;
        z-index: @rootZIndex - 4;

        .tcOptionGroup {
            font-weight: bolder;

            .tcOption {
                margin: 1px 20px;
            }
        }

        .tcOption {
            margin: 1px 5px;
        }
    }

    .panels-container {
        .position-fixed();

        bottom: 0;
        width: 100%;

        pointer-events: none;

        &.status-bar-debugging {
            pointer-events: auto;
        }

        .status-bar {
            background-color: rgba(24, 40, 57, 0.85);
            z-index: @rootZIndex - 3;
            left: 0;
            width:100%;
            display: flex;
            color: rgba(255, 255, 255, 0.8);
            flex-wrap: nowrap;
            font-family: '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Helvetica', 'Arial', 'sans-serif', 'Apple Color Emoji', 'Segoe UI Emoji';

            .icon {
                background-image: url("/testcafe-ui-sprite.svg#logo-icon");
                background-color: rgba(42, 61, 82, 0.95);

                display: inline-block;
                flex-shrink: 0;
                width: 72px;
                height: 52px;
                background-origin: content-box;
                background-repeat: no-repeat;
                background-position: 16px 11px;
                background-attachment: local;
            }

            .info-container {
                font-style: normal;
                font-size: 12px;
                flex-direction: column;
                width: 100%;
                min-width: 0;
                height: 52px;

                display: flex;
                justify-content: space-between;
                align-items: center;

                .info-text-container {
                    margin: 7px 0 4px 16px;
                    width: 100%;
                    align-items: center;
                    display: flex;
                    justify-content: space-between;
                    white-space: nowrap;
                    flex: 1;

                    .status-container {
                        align-items: center;
                        min-width: 0;
                        overflow: hidden;

                        .info {
                            text-overflow: ellipsis;
                            overflow: hidden;
                        }

                        .status {
                            font-weight: bold;
                            font-size: 14px;
                            overflow: hidden;
                            text-overflow: ellipsis;
                        }
                    }

                    .user-agent {
                        color: rgba(255, 255, 255, 0.5);
                        font-size: 12px;
                        margin-right: 20px;
                        max-width: 250px;
                        text-overflow: ellipsis;
                        overflow: hidden;
                    }
                }

                .progress-bar {
                    width: 100%;
                    height: 3px;
                    background-color: #345B69;
                    padding: 0;
                    border: 0;
                    overflow: hidden;
                    visibility: hidden;

                    &.determinate .value {
                        background-color: #36B6E5;
                        height: 3px;
                        width: 0;
                    }

                    &.indeterminate {
                        .value-container {
                            background-color: #36B6E5;
                            position: relative;

                            .value {
                                position: absolute;
                                background-color: inherit;
                                top: 0;
                                left: 0;
                                bottom: 0;
                            }
                        }
                    }
                }
            }

            .buttons, .button {
                display: flex;
            }

            .actions-container {
                text-align: right;
                font-size: 12px;
                align-items: center;
                right: 0;

                .buttons {
                    background-color: rgba(42, 61, 82, 0.85);
                    flex-wrap: nowrap;

                    .button {
                        height: 52px;
                        min-width: 52px;
                        align-items: center;
                        justify-content: center;

                        &:hover {
                            background-color: #36B6E5;
                        }

                        &:active {
                            background-color: #1797CA;
                        }

                        & > span {
                            margin-right: 20px;
                            margin-left: -10px;
                            white-space: nowrap;
                        }

                        .button-icon {
                            width: 30px;
                            height: 30px;
                            margin-left: 10px;
                            margin-right: 10px;
                        }

                        &.locked .button-icon {
                            background-image: url("/testcafe-ui-sprite.svg#locked");
                        }

                        &.unlocked {
                            background-color: #60A96E;

                            .button-icon {
                                background-image: url("/testcafe-ui-sprite.svg#unlocked");
                            }
                        }

                        &.resume .button-icon {
                            background-image: url("/testcafe-ui-sprite.svg#resume");
                        }

                        &.finish .button-icon {
                            background-image: url("/testcafe-ui-sprite.svg#finish");
                        }

                        &.step .button-icon {
                            background-image: url("/testcafe-ui-sprite.svg#step");
                        }
                    }
                }
            }

            &.waiting-element-success {
                background-color: transparent;

                .info-container {
                    background-color: rgba(116, 183, 129, 0.9);
                }

                .progress-bar.determinate .value {
                    background-color: #3F884D;
                }
            }

            &.waiting-element-failed {
                .info-container {
                    background-color: rgba(223, 86, 121, 0.9);
                }

                .progress-bar.determinate .value {
                    background-color: #BA4A67;
                }
            }

            /* Views */
            @media (max-width: 992px) {
                .info-container .user-agent {
                    display: none;
                }
            }

            @media (max-width: 768px) {
                @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
                    .actions-container {
                        min-width: 156px;
                    }
                }

                .icon, .button > span {
                    display: none;
                }
            }

            @media (max-width: 576px) {
                flex-wrap: wrap;

                .actions-container, .buttons {
                    width: 100%;
                    justify-content: space-around;
                }

                .actions-container .buttons .button {
                    height: 30px;
                    flex-grow: 1;
                }
            }
            /* --- */
        }

        .selector-inspector-panel {
            box-sizing: border-box;
            width: 100%;
            left: 0;
            padding: 2px;
            align-items: center;
            z-index: @rootZIndex - 3;
            background-color: #283545;
            color: #283545;
            flex-wrap: nowrap;
            flex-direction: row;
            position: relative;

            .selector-panel-toggle-button-container {
                position: relative;

                .selector-panel-toggle-button {
                    cursor: pointer;
                    background: white;
                    padding: 1px 8px 3px 8px;
                    top: 0;
                    border-radius: 4px;
                    overflow: hidden;
                    position: absolute;
                    width: 100%;
                    box-sizing: border-box;

                    &:hover {
                        background-color: #cfcfcf;
                    }
                }

                span {
                    cursor: pointer;
                    padding: 1px 8px 3px 8px;
                    pointer-events: none;
                    z-index: 1;
                    color:rgb(0, 0, 0);
                    line-height: 16px;
                }

                span::after {
                    content: "Hide Picker";

                    @media screen and (max-width: 500px) {
                        content: "Hide";
                    }
                }
            }

            .selector-inspector-panel-container {
                display: flex;
                flex-wrap: nowrap;
                flex-direction: row;
                flex-grow: 1;
                margin-right: 5px;

                .selector-input-container {
                    margin: 0 5px;
                }
            }

            * {
                display: flex;
                box-sizing: border-box;
                font-size: 12px;
            }

            >* {
                margin: 2px !important;
                flex-grow: 0;
            }

            input, input:hover, input:active, input:focus {
                line-height: 16px;

                &[type='button'] {
                    padding: 1px 8px 3px 8px;
                    border-radius: 4px;
                    cursor: pointer;

                    &:hover {
                        background-color: #cfcfcf;
                    }
                }

                &[type='text'] {
                    padding: 2px 8px 2px 8px;
                }
            }

            .selector-input-container {
                flex-grow: 1;
                background-color: white;

                >* {
                    flex-grow: 0;
                }

                .selector-input {
                    flex-grow: 1;
                    font-family: monospace !important;
                }

                .match-indicator {
                    margin: 2px;
                    padding: 2px 6px;
                    height: 16px;
                    font-size: 10px;
                    line-height: 12px;
                    border-radius: 4px;
                    background-color: #777777;
                    color: white;

                    &.ok {
                        background-color: #0B71E3;
                    }

                    &.invalid {
                        background-color: #993131;
                    }

                    &.not-found {
                        background-color: #777777;
                    }

                    @media(max-width: 470px) {
                        display: block;
                        max-width: 70px;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }
                }

                .expand-selector-list {
                    width: 20px;
                    height: 20px;
                    background-image: url("/testcafe-ui-sprite.svg#disabled-expand-button");

                    &.enabled {
                        background-image: url("/testcafe-ui-sprite.svg#expand-button");

                        &:hover {
                            background-color: #cfcfcf;
                        }
                    }
                }
            }

            &--hidden {
                padding: 0;

                .selector-panel-toggle-button-container {
                    position: absolute;
                    top: -26px;
                    right: 2px;
                    z-index: @rootZIndex - 2;

                    .selector-panel-toggle-button {
                        background-color: #283545;

                        &:hover {
                            background-color: #36B6E5!important;
                        }
                    }

                    span {
                        color: white;
                    }

                    span::after {
                        content: "Show Picker";
                    }
                }

                .selector-inspector-panel-container {
                    display: none;
                }
            }
        }


    }

    .selectors-list {
        .position-fixed();

        display: flex;
        box-sizing: border-box;
        z-index: @rootZIndex - 2;
        flex-direction: column;
        background-color: white;
        box-shadow: 0px 0px 2px #8d8d8d;
        color: black;

        .selector-value {
            height: 18px;
            padding: 4px 8px 0px;
            border-bottom: 1px solid #e2e2e2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-family: monospace !important;
            font-size: 12px;

            &:hover {
                background-color: #cfcfcf;
            }
        }
    }

    .element-frame {
        box-sizing: border-box;
        position: absolute;
        background-color: #1797CA;
        border: 1px solid #033a50;
        opacity: 0.3;
        box-shadow: 0 0 6px 1px #033a50;
    }

    .tooltip {
        position: absolute;
        white-space: nowrap;
        background-color: #667599;
        padding: 2px 6px 3px 6px;
        color: #ffffff;
        font-family: monospace !important;
    }

    .arrow {
        position: absolute;
        background-image: url("/testcafe-ui-sprite.svg#arrow-down");
        width: 16px;
        height: 8px;
    }

    .screenshot-mark {
        bottom: 0;
        right: 0;
        position: fixed;
    }

    .auxiliary-input {
        position: fixed;
        bottom: 100%;
    }
}
