/*
 *
 * In Document Search
 * ================================================
 * The ajax based search inside the work view
 *
 * Author: Thomas Jung <thomas@jung.digital>
 *
 */

.tx-dlf-toolsFulltextsearch { // should be semantically: .tx-dlf-tools-search-indocument
    position: absolute;
    top: 0;
    right: 106px;
    .fulltext-search-toggle { // should be semantically: .search-indocument-toggle
        display: none;
    }
    form {
        position: absolute;
        top: 0;
        right: -106px;
        height: 40px;
        width: 100vw;
        padding: 0 15px;
        opacity: 0;
        pointer-events: none;
        .transition();
        .transform(translateY(-100%));
        label {
            display: none;
        }
        input {
            &[type="text"] {
                position: relative;
                width: 100%;
                font-family: @font-sans-normal;
                background: white;
                border-radius: 20px;
                border: 0;
                font-size: 14px;
                line-height: 1.1;
                padding: 4px 10px;
                height: 40px;
                color: @basegrey-color;
                box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
                &:focus {
                    color: @secondary-color;
                    outline: 1px solid white;
                }
            }
        }
        button,
        input {
            &[type="submit"] {
                position: absolute;
                top: 0;
                right: 15px;
                width: 40px;
                height: 40px;
                .text-hide();
                background: lighten(@secondary-color-light, 40%) url('@{control-icons}') no-repeat -560px 0;
                background-size: auto 120px;
                border-radius: 20px;
                &:focus {
                    outline: 1px solid white;
                }
            }
        }
        .search-indocument-active &,
        &:focus-within {
            pointer-events: all;
            opacity: 1;
            .transform(translateY(0));
        }
    }
    #tx-dlf-search-in-document-loading,
    #tx-dlf-search-in-document-clearing {
        display: none !important;
    }
    #tx-dlf-search-in-document-results {
        position: fixed;
        top: 230px;
        right: 15px;
        max-height: calc(100vh - 310px);
        left: 15px;
        background: white;
        text-align: center;
        border-radius: 20px;
        font-family: @font-sans-normal;
        overflow: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        pointer-events: none;
        opacity: 0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        .transition();
        .transform(translateY(-100%));
        li {
            padding: 15px 10px;
            border-bottom: 1px solid @lightgrey-color;
            line-height: 1.2;
            .structure {
                font-size: 14px;
                position: relative;
                display: block;
                font-family: @font-sans-bold;
                text-transform: uppercase;
                color: darken(@lightgrey-color, 20%);
            }
            .highlight,
            em {
                font-family: @font-sans-bold;
                color: @primary-color;
                font-style: normal;
                font-weight: bold;
                font-size: 120%;
            }
            .textsnippet {
                a {
                    color: #333;
                }
                &:before,
                &:after {
                    content: "…";
                }
            }
        }
        .button-previous,
        .button-next {
            position: relative;
            margin: 30px 10px;
            background: @secondary-color-light;
            appearance: none;
            border: 0;
            padding: 10px 20px;
            line-height: 1;
            font-family: @font-sans-bold;
            text-transform: uppercase;
            color: white;
        }
        .search-indocument-active & {
            pointer-events: all;
            opacity: 1;
            .transform(translateY(0));
            &:empty {
                pointer-events: none;
                opacity: 0;
                .transform(translateY(-100%));
            }
        }
    }
    @media screen and (min-width: @phoneLandscapeViewportWidth) {
        margin-top: -50px;
        form {
            right: 40px;
            width: 400px;
        }
        #tx-dlf-search-in-document-results {
            top: 165px;
            z-index: 1030;
            max-height: calc(100vh - 170px);
            li {
                .structure {
                    display: inline;
                }
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
    }
    @media screen and (min-width: @tabletViewportWidth) {
        #tx-dlf-search-in-document-results {
            top: 180px;
            max-height: calc(100vh - 280px);
        }
    }
    @media screen and (min-width: @tabletLandscapeViewportWidth) {
        top: 10px !important;
        right: 8px;
        margin: 0;
        z-index: 50;
        .fulltext-search-toggle {
            position: absolute;
            top: 10px;
            right: 0;
            width: 40px;
            height: 40px;
            background: white url('@{control-icons}') no-repeat -560px 0;
            background-size: auto 120px;
            border-radius: 20px;
            cursor: pointer;
            display: block;
            &:after {
                position: absolute;
                top: 0;
                right: 0;
                height: 40px;
                width: 40px;
                text-align: center;
                content: "+";
                font-size: 42px;
                line-height: 32px;
                color: @secondary-color;
                .transition();
                opacity: 0;
            }
            .search-indocument-active & {
                background-color: lighten(@secondary-color-light, 40%);
                background-position: -560px 40px;
                &:after {
                    .transform(rotate(45deg));
                    opacity: 1;
                }
            }
            &.disabled {
                opacity: .5;
                pointer-events: none;
            }
            .no-touchevents & {
                &:hover {
                    .transform(scale(1.2));
                }
            }
        }
        form {
            top: 80px;
            right: 0;
            width: 450px;
            height: 70px;
            margin: 0;
            border-radius: 0;
            background: fade(@secondary-color, 90%);
            padding: 15px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
            input[type="text"] {
                border-radius: 0;
            }
            button,
            input {
                &[type="submit"] {
                    top: 15px;
                    border-radius: 20px 0 0 20px;
                    background-color: lighten(@secondary-color-light, 30%);
                }
            }
            &:before {
                position: absolute;
                top: -10px;
                right: 10px;
                width: 0;
                height: 0;
                border: 10px solid transparent;
                border-bottom-color: fade(@secondary-color, 90%);
                border-top: 0;
                content: " ";
            }
        }
        #tx-dlf-search-in-document-results {
            position: absolute;
            top: 150px;
            right: 0;
            left: auto;
            bottom: auto;
            width: 450px;
            height: 400px;
            border-radius: 0;
            background: fade(@secondary-color, 90%);
            padding: 0 15px 15px 15px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
            li {
                text-align: left;
                padding: 10px 0;
                color: white;
                .structure {
                    color: white;
                    opacity: .6;
                }
                .textsnippet {
                    a {
                        color: white;
                    }
                    &:before,
                    &:after {
                        content: "…";
                    }
                }
                a {
                    color: white;
                    .highlight,
                    em {
                        color: white;
                    }
                }
            }
        }
    }
    @media screen and (min-width: @desktopViewportWidth) {
        form {
            width: 600px;
        }
        #tx-dlf-search-in-document-results {
            width: 600px;
            font-size: 14px;
            height: auto;
            max-height: 70vh;
        }
    }
}

body.calendar .tx-dlf-toolsFulltextsearch { // If the search appears in calendar view
    top: -20px;
    right: 15px;
    form {
        right: -15px;
    }
    @media screen and (min-width: @phoneLandscapeViewportWidth) {
        form {
            right: 40px;
        }
    }
    @media screen and (min-width: @tabletLandscapeViewportWidth) {
        top: 30px;
        right: 35px;
        .fulltext-search-toggle {
            border: 1px solid @secondary-color;
        }
        form {
            right: 0;
        }
    }
}

// EOF
