/*
 *
 * Controls
 * ================================================
 * Control elements like next and previous buttons,
 * download buttons and so on...
 *
 * Author: Thomas Jung <thomas@jung.digital>
 *
 */

/* ==============[ basic settings for document control and view buttons ]================= */
.document-functions,
.view-functions {
    > ul {
        position: absolute;
        text-align: center;
        .text-hide();
        z-index: 10;
        > li {
            position: relative;
            display: inline-block;
            > a, > span {
                position: relative;
                display: inline-block;
                width: 40px;
                height: 40px;
                .text-hide();
                border-radius: 20px;
                margin: 0 5px;
                background: white url('@{control-icons}') no-repeat 0 0;
                background-size: auto 120px;
            }
            > span {
                opacity: 0.5;
            }
            @media screen and (min-width: @tabletLandscapeViewportWidth) {
                > a, > span {
                    margin: 0 2px;
                }
                a {
                    .no-touchevents & {
                        .transition();
                        cursor: pointer;
                        &:hover {
                            .transform(scale(1.2));
                        }
                    }
                }
            }
            @media screen and (min-width: @desktopViewportWidth) {
                > a, > span {
                    margin: 0 4px;
                }
            }
        }
    }
}

/* ==============[ document functions for downloads, double page eg. ]===================== */
.document-functions {
    > ul {
        bottom: 15px;
        left: 15px;
        right: 15px;
        > li {
            > a:focus {
                outline: none;
            }
            &.submenu {
                &:before {
                    position: absolute;
                    top: -17.5px;
                    left: 50%;
                    width: 0;
                    height: 0;
                    margin-left: -10px;
                    border: solid transparent;
                    border-width: 0 10px;
                    border-top-color: fade(@secondary-color, 97%);
                    content: " ";
                    z-index: 200;
                    opacity: 0;
                    .transition();
                }
                > ul {
                    position: fixed;
                    bottom: 80px;
                    left: 40px;
                    right: 40px;
                    padding: 20px;
                    background: fade(@secondary-color, 97%);
                    font-family: Helvetica, Arial, sans-serif;
                    font-size: 14px;
                    line-height: 1.4;
                    text-align: left;
                    transform-origin: center bottom;
                    .transition();
                    .transform(scaleY(0) translateY(100px));
                    opacity: 0;
                    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
                    li {
                        a {
                            position: relative;
                            color: white;
                            display: block;
                            padding-left: 40px;
                            margin: 15px 0;
                            &:focus {
                                outline-color: white;
                            }
                            &:before {
                                position: absolute;
                                top: 50%;
                                left: 0;
                                margin-top: -20px;
                                width: 40px;
                                height: 40px;
                                content: " ";
                                background: url('@{control-icons}') no-repeat 0 0;
                                background-size: auto 120px;
                            }
                            &.download-fulltext:before {
                                background-position: -280px -40px;
                            }
                            &.local-presentation:before {
                                background-position: -440px -80px;
                            }
                            &.local-catalog:before {
                                background-position: -400px -80px;
                            }
                            &.local-contact:before {
                                background-position: -400px -40px;
                            }
                            &.download-document:before,
                            &[title$="Seite"]:before,
                            &[title$="Page"]:before {
                                background-position: -360px -40px;
                            }
                            &.download-page:before,
                            &[title$="ument"]:before {
                                background-position: -320px -40px;
                            }
                            &.persistence-document:before {
                                background-position: -360px -80px;
                            }
                            &.persistence-page:before {
                                background-position: -320px -80px;
                            }
                            &.terms-of-use:before {
                                background-position: -640px -80px;
                            }
                            &#tx-dlf-tools-fulltextdownload:before {
                                background-position: -360px -40px;
                            }
                        }
                    }
                }
                &.open,
                &:focus-within {
                    &:before {
                        top: -13.5px;
                        border-top-width: 10px;
                        opacity: 1;
                    }
                    ul {
                        .transform(scaleY(1) translateY(0));
                        opacity: 1;
                    }
                }
            }
            &.downloads {
                > a, > span {
                    background-position: -40px 0;
                }
            }
            &.fulltext {
                > a, > span {
                    background-position: -120px 0;
                }
            }
            &.doublepage {
                display: none;
                > a, > span {
                    background-position: -80px 0;
                }
                a.tx-dlf-navigation-doubleOff:before {
                    position: absolute;
                    top: 2px;
                    right: 0;
                    width: 8px;
                    height: 8px;
                    border-radius: 8px;
                    border: 2px solid white;
                    background: @primary-color;
                    display: block;
                    content: " ";
                }
                a.tx-dlf-navigation-doublePlusOne {
                    position: absolute;
                    bottom: 2px;
                    right: -1px;
                    width: 0;
                    height: 0;
                    border: solid transparent;
                    border-width: 9px 0 9px 13px;
                    border-left-color: white;
                    border-radius: 0;
                    background: transparent;
                    span {
                        position: absolute;
                        bottom: -5px;
                        right: 3px;
                        width: 0;
                        height: 0;
                        display: block;
                        overflow: hidden;
                        border: solid transparent;
                        border-width: 5px 0 5px 8px;
                        border-left-color: @primary-color;
                    }
                }
            }
            &.fulltext {
                a.select {
                    &.active:before {
                        position: absolute;
                        top: 2px;
                        right: 0;
                        width: 8px;
                        height: 8px;
                        border-radius: 8px;
                        border: 2px solid white;
                        background: @primary-color;
                        display: block;
                        content: " ";
                    }
                }
            }
            &.grid {
                > a, > span {
                    background-position: -160px 0;
                }
                a.active:before {
                    position: absolute;
                    top: 2px;
                    right: 0;
                    width: 8px;
                    height: 8px;
                    border-radius: 8px;
                    border: 2px solid white;
                    background: @primary-color;
                    display: block;
                    content: " ";
                }
            }
            &.disabled {
                opacity: .5;
                pointer-events: none;
            }
        }
    }
    @media screen and (min-width: @tabletViewportWidth) {
        > ul {
            li.submenu {
                > ul {
                    position: absolute;
                    width: auto;
                    left: 20px;
                    right: auto;
                    bottom: 53px;
                    transform-origin: center top;
                    .transform(scaleY(0) translateY(100px));
                    li a {
                        white-space: nowrap;
                    }
                }
                &.open,
                &:focus-within {
                    > ul {
                        .transform(scaleY(1) translateY(0));
                    }
                }
            }
        }
    }
    @media screen and (min-width: @tabletLandscapeViewportWidth) {
        > ul {
            top: 20px;
            left: 20px;
            right: auto;
            bottom: auto;
            li.doublepage {
                display: inline-block;
            }
            li {
                &.submenu {
                    &:before {
                        top: auto;
                        bottom: -60px;
                        border-width: 0 10px;
                        border-bottom-color: fade(@secondary-color, 97%);
                    }
                    > ul {
                        top: 50px;
                        left: -20px;
                        right: auto;
                        bottom: auto;
                        width: auto;
                        font-size: 12px;
                        padding: 15px;
                        z-index: 3000;
                        transform-origin: center top;
                        .transform(scaleY(0) translateY(-100px));
                        li {
                            a {
                                margin: 0;
                                padding-right: 5px;
                                min-height: 40px;
                                line-height: 40px;
                                .no-touchevents & {
                                    &:hover {
                                        .transform(scale(1));
                                        background: rgba(255, 255, 255, 0.2);
                                    }
                                }
                            }
                        }
                    }
                    &.open,
                    &:focus-within {
                        &:before {
                            top: auto;
                            bottom: -10px;
                            border-width: 0 10px 10px 10px;
                        }
                    }
                }
            }
        }
    }
}

/* ==============[ view functions for zoom, rotate and other view related functions ]===== */
.view-functions {
    ul {
        position: relative;
        li {
            display: none;
        }
        @media screen and (min-width: @tabletLandscapeViewportWidth) {
            position: absolute;
            top: 20px;
            right: 50px;
            display: block;
            height: 40px;
            li {
                display: inline-block;
                &.rotate {
                    display: none;
                }
                &.pages {
                    position: relative;
                    top: auto;
                    right: auto;
                    display: inline-block;
                    form {
                        position: absolute;
                        top: 0;
                        right: 0;
                        select {
                            border: 1px solid @secondary-color;
                            color: @secondary-color;
                            background: white url('data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAyMCAxMiI+PHN0eWxlPi5zdDB7ZmlsbDpub25lO3N0cm9rZTojNGU2NDY2O3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMH08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMy40IDMuMkw3IDkuNi42IDMuMiIgaWQ9IlhNTElEXzFfIi8+PC9zdmc+') no-repeat right center;
                            background-size: 16px auto;
                            font-weight: 700;
                            line-height: 1.2;
                            -webkit-appearance: none;
                            -moz-appearance: none;
                            padding: 10px 20px 10px 14px;
                            background-size: 20px 12px;
                            margin: 0 6px;
                            font-size: 16px;
                            outline: none;
                            border-radius: 20px;
                            cursor: pointer;
                            .no-touchevents & {
                                .transition();
                                &:hover {
                                    border: 1px solid @secondary-color;
                                    background-color: desaturate(lighten(@secondary-color, 65%), 25%);
                                    color: @basegrey-color;
                                }
                            }
                        }
                    }
                }
                &.tx-dlf-imagemanipulationtool {
                    > span {
                        opacity: 1;
                        overflow: hidden;
                        width: auto;
                        height: auto;
                        display: inline;
                        margin: 0;
                        > span > a {
                            position: relative;
                            display: inline-block;
                            width: 40px;
                            height: 40px;
                            .text-hide();
                            border-radius: 20px;
                            margin: 0 5px;
                            background: white url('@{control-icons}') no-repeat -200px 0;
                            background-size: auto 120px;
                            &.active:before {
                                position: absolute;
                                top: 2px;
                                right: 0;
                                width: 8px;
                                height: 8px;
                                border-radius: 8px;
                                border: 2px solid white;
                                background: @primary-color;
                                display: block;
                                content: " ";
                            }
                        }
                    }
                }
                &.rotate {
                    .rotate-left {
                        background-position: -240px 0;
                    }
                    .rotate-right {
                        background-position: -240px -40px;
                    }
                    .upend {
                        background-position: -280px 0;
                    }
                }
                &.zoom {
                    .in {
                        background-position: -360px 0;
                    }
                    .out {
                        background-position: -400px 0;
                    }
                    .fullscreen { // The fullscreen button
                        position: relative;
                        flex: 0 0 40px;
                        width: 40px;
                        height: 40px;
                        border-radius: 20px;
                        .text-hide();
                        z-index: 1000;
                        background: white;
                        &:before,
                        &:after {
                            position: absolute;
                            width: 12px;
                            height: 12px;
                            background: url('@{control-icons}') no-repeat -574px -54px;
                            background-size: auto 120px;
                            display: block;
                            content: " ";
                            .transition();
                            pointer-events: none;
                            .static & {
                                .transition(none);
                            }
                        }
                        &:before {
                            top: 9px;
                            right: 9px;
                        }
                        &:after {
                            bottom: 9px;
                            left: 9px;
                            .transform(rotate(180deg));
                        }
                        &.active {
                            &:before {
                                .transform(rotate(180deg));
                            }
                            &:after {
                                .transform(rotate(0));
                            }
                        }
                        .fullscreen & {
                            top: 5px !important;
                        }
                    }
                }
            }
        }
        @media screen and (min-width: @desktopViewportWidth) {
            li {
                &.rotate {
                    display: inline-block;
                }
                &.pages {
                    form {
                        select {
                            margin: 0 4px;
                        }
                    }
                }
            }
        }
    }
}

/* ==============[ the image manipulation tools ]========================================= */
.image-manipulation {
    position: absolute;
    top: 55px;
    right: 5px;
    .slider-container {
        background: fade(@secondary-color, 90%);
        padding: 30px 20px 10px 56px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        &.open {
            z-index: 1010;
        }
        &: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: " ";
        }
        .slider {
            position: relative;
            width: 200px;
            height: 30px;
            border: 0 none;
            border-radius: 0;
            background: transparent;
            -webkit-transition: all .2s ease-in-out;
            transition: all .2s ease-in-out;
            margin-right: 24px;
            &:before {
                position: absolute;
                top: -19px;
                left: -36px;
                width: 40px;
                height: 40px;
                content: " ";
                background: url('@{control-icons}') no-repeat 0 0;
                background-size: auto 120px;
            }
            &:after {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 2px;
                border-radius: 2px;
                background: white;
                content: "";
            }
            .tooltip {
                position: absolute;
                opacity: 1;
                top: -4px;
                left: 210px !important;
                color: white;
                font-size: 10px;
                text-align: left;
            }
        }
        .slider-contrast .tooltip, .slider-saturation .tooltip {
            left: 100%;
        }
        .slider-brightness .tooltip, .slider-hue .tooltip {
            left: 50%;
        }
        .slider-contrast:before {
            background-position: -480px 0;
        }
        .slider-saturation:before {
            background-position: -480px -40px;
        }
        .slider-brightness:before {
            background-position: -480px -80px;
        }
        .slider-hue:before {
            background-position: -520px 0;
        }
        .checkbox, button.reset-btn {
            position: relative;
            border: 0 none;
            color: white;
            font-size: 11px;
            margin-top: -15px;
            padding-left: 36px;
            line-height: 40px;
            display: inline-block;
            background: transparent;
            &:before {
                position: absolute;
                top: 0;
                left: 0;
                width: 40px;
                height: 40px;
                background: url('@{control-icons}') no-repeat 0 0;
                background-size: auto 120px;
                content: " ";
            }
        }
        button.reset-btn {
            margin-left: 10px;
            outline: none;
            &:before {
                background-position: -520px -80px;
            }
        }
        .checkbox {
            margin-left: -37px;
            &:before {
                background-position: -520px -40px;
            }
            label input {
                margin-right: 4px;
            }
        }
    }
}

.slider-imagemanipulation.ui-slider-horizontal {
    .ui-slider-handle {
        position: absolute;
        z-index: 2;
        top: -7px;
        width: 14px;
        height: 14px;
        background: white;
        border: 0 none;
        border-radius: 7px;
        box-shadow: 1px 1px 0 @primary-color;
        cursor: col-resize;
        margin-left: -6px;
        &:after {
            content: none;
        }
        .ui-slider-handle {
            &:focus, &:active {
                border: 0;
                outline: none;
            }
        }
    }
    .ui-slider-range {
        background: rgba(0, 177, 158, 0.5);
    }
}

/* ==============[ page control buttons (fwd/back) ]====================================== */
.page-control {
    position: absolute;
    bottom: 15px;
    height: 1px;
    width: 290px;
    left: 50%;
    margin-left: -145px;
    line-height: 0;
    > div {
        position: absolute;
        bottom: 0;
        z-index: 1020;
        span {
            display: none;
            a, span {
                position: relative;
                display: inline-block;
                .text-hide();
                &:before {
                    position: absolute;
                    bottom: -1px;
                    width: 40px;
                    height: 40px;
                    border-radius: 20px;
                    background: white url('@{control-icons}') no-repeat 0 0;
                    background-size: auto 120px;
                    content: " ";
                }
            }
            span {
                opacity: 0.3;
            }
            &.next {
                display: block;
                a:before, span:before {
                    right: 0;
                    background-position: -280px -80px;
                }
            }
            &.prev {
                display: block;
                a:before, span:before {
                    left: 0;
                    background-position: -240px -80px;
                }
            }
        }
    }
    .backs {
        left: 0;
    }
    .fwds {
        right: 0;
    }
    @media screen and (min-width: @tabletLandscapeViewportWidth) {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        pointer-events: none;
        > div {
            bottom: 50%;
            margin-bottom: -20px;
            height: 80px;
            min-width: 80px;
            pointer-events: all;
            span {
                display: block;
                a, span {
                    position: absolute;
                    font-size: 14px;
                    color: @primary-color;
                    white-space: nowrap;
                    display: block;
                    height: 40px;
                    line-height: 40px;
                    .transition();
                    &:before {
                        .transition();
                    }
                    .touchevents & {
                        pointer-events: none;
                    }
                }
                .no-touchevents & {
                    a:hover {
                        .transform(scale(1.1));
                    }
                }
                span {
                    cursor: not-allowed;
                }
            }
            &.enable-touchevent {
                span {
                    a, span {
                        .touchevents & {
                            pointer-events: all;
                        }
                    }
                }
            }
            &.no-transition {
                a, span, a:before, span:before {
                    -webkit-transition: none !important;
                    -moz-transition: none !important;
                    -o-transition: none !important;
                    transition: none !important;
                }
            }
            &.backs {
                left: 10px;
                // Detail view: if z-index > 9 then Back and Next buttons are displayed above Downloads or Links UL list
                z-index: 9;
                span {
                    a, span {
                        left: 0;
                        text-align: left;
                        padding-left: 80px;
                        &:before {
                            left: 20px;
                        }
                    }
                    &.prev {
                        a, span {
                            top: 0;
                            height: 80px;
                            line-height: 80px;
                            color: fade(@primary-color, 0%);
                            &:before {
                                left: 0;
                                width: 80px;
                                height: 80px;
                                border-radius: 40px;
                                background-position: 0 -40px;
                            }
                        }
                    }
                    &.rwnd {
                        a, span {
                            top: 0;
                            color: fade(@primary-color, 0%);
                            z-index: 301;
                            &:before {
                                left: 41px;
                                width: 32px;
                                height: 32px;
                                background-position: -86px -43px;
                            }
                        }
                        span {
                            opacity: 0;
                        }
                    }
                    &.first {
                        a, span {
                            bottom: 0;
                            opacity: 0;
                            z-index: 302;
                            &:before {
                                background-position: -80px -80px;
                            }
                        }
                    }
                }
                &.over {
                    span {
                        &.prev {
                            a, span {
                                color: @primary-color;
                            }
                        }
                        &.rwnd {
                            a, span {
                                top: -45px;
                                color: @primary-color;
                                &:before {
                                    bottom: -1px;
                                    left: 20px;
                                    width: 40px;
                                    height: 40px;
                                    background-position: -80px -40px;
                                }
                            }
                            span {
                                opacity: .3;
                            }
                        }
                        &.first {
                            a, span {
                                bottom: -45px;
                            }
                            a {
                                opacity: 1;
                            }
                            span {
                                opacity: 0.3;
                            }
                        }
                    }
                }
            }
            &.fwds {
                right: 10px;
                span {
                    a, span {
                        right: 0;
                        text-align: right;
                        padding-right: 80px;
                        &:before {
                            right: 20px;
                        }
                    }
                    &.next {
                        a, span {
                            top: 0;
                            height: 80px;
                            line-height: 80px;
                            color: fade(@primary-color, 0%);
                            &:before {
                                right: 0;
                                width: 80px;
                                height: 80px;
                                border-radius: 40px;
                                background-position: -160px -40px;
                            }
                        }
                    }
                    &.fwd {
                        a, span {
                            top: 0;
                            color: fade(@primary-color, 0%);
                            &:before {
                                right: 41px;
                                width: 32px;
                                height: 32px;
                                background-position: -122px -42px;
                            }
                        }
                    }
                    &.last {
                        a, span {
                            bottom: 0;
                            opacity: 0;
                            &:before {
                                background-position: -120px -80px;
                            }
                        }
                    }
                }
                &.over {
                    span {
                        &.next {
                            a, span {
                                color: @primary-color;
                            }
                        }
                        &.fwd {
                            a, span {
                                top: -45px;
                                color: @primary-color;
                                &:before {
                                    bottom: -1px;
                                    right: 20px;
                                    width: 40px;
                                    height: 40px;
                                    background-position: -120px -40px;
                                }
                            }
                        }
                        &.last {
                            a, span {
                                bottom: -45px;
                            }
                            a {
                                opacity: 1;
                            }
                            span {
                                opacity: 0.3;
                            }
                        }
                    }
                }
            }
        }
    }
    .calendar & {
        display: none;
    }
}

// EOF
