/*
 *
 * Sidebar
 * ================================================
 * Special styles for the sidebar which
 * represents the base control unit
 *
 * Author: Thomas Jung <thomas@jung.digital>
 *
 */

/* ==============[ Basic settings for the control bar ]===== */
.control-bar {
    -moz-font-feature-settings: "lnum";
    -webkit-font-feature-settings: "lnum";
    font-feature-settings: "lnum";
    .fullscreen & {
        width: 0;
        overflow: hidden;
    }
    .static & {
        .transition(none);
    }
    .header-bar { // header bar (with logo, secondary navigation and language switch)
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        min-height: 50px;
        z-index: 100;
        overflow: hidden;
        background: @primary-color;
        font-family: @font-sans-normal;
        .brand {
            position: absolute;
            top: 15px;
            left: 10px;
            height: 22px;
            text-transform: uppercase;
            white-space: nowrap;
            .logo-replacement {
                display: none;
            }
            a {
                position: relative;
                width: 100%;
                height: 100%;
                color: white;
                font-size: 14px;
                line-height: 28px;
                text-align: left;
                background: url('@{header-logo}') no-repeat left center;
                background-size: auto 100%;
                display: block;
                padding-left: 80px;
                &:before {
                    content: "> ";
                }
            }
        }
        nav {
            .nav-toggle {
                position: absolute;
                top: 13px;
                right: 15px;
                width: 25px;
                height: 30px;
                padding: 0;
                border: 0 none;
                background: transparent;
                outline: none;
                .nav-button-bar {
                    position: relative;
                    width: 100%;
                    height: 2px;
                    border-radius: 2px;
                    margin-bottom: 4px;
                    background: white;
                    display: block;
                    .transition();
                }
                &.active {
                    .nav-button-bar {
                        &:nth-of-type(2) {
                            .transform(translateY(6px) rotate(45deg));
                        }
                        &:nth-of-type(3) {
                            .transform(scale(0));
                            opacity: 0;
                        }
                        &:nth-of-type(4) {
                            .transform(translateY(-6px) rotate(-45deg));
                        }
                    }
                }
            }
            .language-nav {
                position: absolute;
                right: 45px;
                top: 15px;
                font-size: 12px;
                li {
                    position: relative;
                    display: inline-block;
                    margin-right: 4px;
                    a,
                    span {
                        position: relative;
                        padding: 6px;
                        display: block;
                        color: white;
                    }
                    &.text-muted {
                        opacity: .4;
                    }
                }
                &:before {
                    position: absolute;
                    top: 0;
                    left: 50%;
                    margin-left: -6px;
                    content: "/";
                    opacity: 0.2;
                    font-size: 24px;
                    color: white;
                    font-weight: 100;
                    text-align: center;
                    width: 10px;
                }
            }
            .secondary-nav {
                position: relative;
                top: 55px;
                width: 100%;
                text-align: left;
                padding-bottom: 0;
                max-height: 0;
                opacity: 0;
                background: @secondary-color;
                .transition(all .3s ease-out);
                border-top: 2px solid white;
                font-family: @font-sans-bold;
                li {
                    a {
                        padding: 15px;
                        display: block;
                        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
                        color: white;
                    }
                    &:first-child {
                        a {
                            border-top: 1px solid rgba(255, 255, 255, 0.2);
                        }
                    }
                }
                &.open,
                &:focus-within {
                    padding-bottom: 65px;
                    max-height: 320px;
                    min-height: 60px;
                    opacity: 1;
                }
            }
        }
        .fullscreen & {
            min-height: 0;
        }
    }
    .step-back-button {
        position: absolute;
        top: 120px;
        left: 15px;
        width: 40px;
        height: 40px;
        border-radius: 20px;
        z-index: 50;
        .text-hide();
        background: white url('@{control-icons}') no-repeat -600px -40px;
        background-size: auto 120px;
    }
    .metadata-wrapper, .toc-wrapper { // metadata and table of contents (as off canvas elements in mobile)
        position: absolute;
        top: 55px;
        bottom: 0;
        width: 90%;
        background: fade(@secondary-color, 97%);
        z-index: 102;
        text-align: left;
        padding: 15px;
        .transition();
        .offcanvas-toggle {
            position: absolute;
            bottom: 5px;
            width: 30px;
            height: 60px;
            background: fade(@secondary-color, 97%) url('@{control-icons}') no-repeat 0 0;
            background-size: auto 120px;
            border: 1px solid fade(white, 50%);
            cursor: pointer;
        }
        &.open,
        &:focus-within  {
            .transform(translateX(0));
            z-index: 1100;
            .offcanvas-toggle {
                border-color: white;
            }
        }
        h3 {
            display: none;
        }
    }
    .metadata-wrapper {
        right: 0;
        .transform(translateX(100%));
        .offcanvas-toggle {
            left: -30px;
            border-radius: 30px 0 0 30px;
            background-position: -442px 9px;
            border-right: 0 none;
        }
        .metadata-toggle {
            display: none;
            color: @color-ubma;
        }

    }
    .toc-wrapper {
        left: 0;
        .transform(translateX(-100%));
        .offcanvas-toggle {
            right: -30px;
            border-radius: 0 30px 30px 0;
            background-position: -447px -30px;
            border-left: 0 none;
        }
    }
    @media screen and (min-width: @tabletLandscapeViewportWidth) {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 33%;
        z-index: 1100;
        color: @basegrey-color;
        border-right: 2px solid white;
        .transition();
        &:before {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 70px;
            background: @primary-color;
            content: " ";
            pointer-events: none;
        }
        &:after {
            position: absolute;
            top: 90px;
            right: 0;
            bottom: 15px;
            width: 1px;
            content: " ";
            background: @lightgrey-color;
        }
        .header-bar {
            position: absolute;
            top: 10px;
            background: transparent;
            overflow: visible;
            .brand a {
                font-size: 12px;
            }
            &:after {
                display: none;
                content: none;
            }
            nav {
                .nav-toggle {
                    top: 12px;
                    right: 12px;
                }
                .language-nav {
                    right: 35px;
                    top: 14px;
                }
                .secondary-nav {
                    position: absolute;
                    top: -5px;
                    right: 0;
                    width: auto;
                    background: fade(@secondary-color, 97%);
                    max-height: none;
                    font-size: 14px;
                    .transform(scaleX(0));
                    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
                    padding: 15px;
                    border-top: 0;
                    &:before {
                        position: absolute;
                        top: 20px;
                        left: -10px;
                        width: 0;
                        height: 0;
                        border: 10px solid transparent;
                        border-left-width: 0;
                        border-right-color: fade(@secondary-color, 97%);;
                        content: " ";
                    }
                    li {
                        a {
                            padding: 0 10px;
                            border: 0 none;
                            line-height: 30px;
                            .transition();
                            color: white;
                            &:hover {
                                background: rgba(255, 255, 255, 0.2);
                            }
                            &:focus {
                                outline-color: white;
                            }
                        }
                        &:first-child {
                            a {
                                border: 0 none;
                            }
                        }
                    }
                    &.open,
                    &:focus-within  {
                        padding: 15px;
                        opacity: 1;
                        right: -220px;
                        .transform(scaleX(1));
                    }
                }
            }
        }
        .step-back-button {
            top: 80px;
            left: 20px;
            width: auto;
            background: transparent;
            font-size: 12px;
            color: @secondary-color;
            font-family: @font-sans-bold;
            line-height: 1.1;
            text-transform: uppercase;
            cursor: pointer;
            &:before {
                content: "<";
                font-size: 16px;
                margin-right: 5px;
            }
        }
        .ctrldata-container {
            position: absolute;
            top: 105px;
            right: 15px;
            bottom: 20px;
            left: 15px;
            overflow: hidden;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        .metadata-wrapper, .toc-wrapper {
            position: relative;
            .transform(translateX(0));
            text-align: left;
            background: transparent;
            padding: 20px 0;
            width: 100%;
            .offcanvas-toggle {
                display: none;
            }
        }
        .metadata-wrapper {
            top: auto;
            bottom: auto;
            padding-bottom: 40px;
            .transition();
            .tx-dlf-metadata {
                overflow: hidden;
            }
            .metadata-toggle {
                position: absolute;
                bottom: 0;
                right: 20px;
                padding: 4px 20px 4px 0;
                font-size: 12px;
                color: @primary-color;
                display: block;
                cursor: pointer;
                // Uni-Unterstreichung weil Links schlecht zu erkennen sind
                border-bottom: .1875rem solid @color-ubma-links-border;
                &:before {
                    position: absolute;
                    top: -5px;
                    right: -5px;
                    width: 30px;
                    height: 30px;
                    background: white url('@{control-icons}') no-repeat -564px -84px;
                    background-size: auto 120px;
                    content: " ";
                    .transform(scale(.6));
                }
            }
        }
        .toc-wrapper {
            top: auto;
            bottom: auto;
        }
    }
    @media screen and (min-width: @desktopViewportWidth) {
        width: 25%;
        .header-bar {
            .brand {
                top: 5px;
                left: 20px;
                height: 40px;
                a {
                    font-size: 11px;
                    line-height: 11px;
                    padding: 30px 0 0 31px;
                    background-size: auto 30px;
                    background-position: 0 0;
                }
            }
        }
        .metadata-wrapper, .toc-wrapper {
            padding: 20px 5px;
        }
        .metadata-wrapper {
            padding-bottom: 40px;
        }
    }
    @media screen and (min-width: 1600px) {
        width: 22%;
    }
    @media screen and (min-width: 2000px) {
        width: 20%;
    }
}

/* ==============[ toc (inside the respective wrap > see above) ]========================= */
.tx-dlf-toc {
    position: absolute;
    top: 15px;
    right: 15px;
    bottom: 15px;
    left: 15px;
    overflow: hidden;
    overflow-y: auto;
    ul.toc {
        position: relative;
        line-height: 1.2;
        font-size: 14px;
        border-top: 1px solid fade(@lightgrey-color,20%);
        ul li {
            position: relative;
            &.submenu {
                a {
                    padding-right: 10px;
                }
                &:before {
                    position: absolute;
                    top: 15px;
                    right: 0;
                    width: 0;
                    height: 0;
                    content: " ";
                    border: 3px solid transparent;
                    border-bottom-width: 0;
                    border-top-color: white;
                }
            }
            &.current {
                background: white;
                a {
                    color: @secondary-color;
                    .meta-type-icon {
                        background-position-y: -30px !important;
                    }
                }
            }
            &.placeholder {
                position: relative;
                padding: 15px 0 15px 30px;
                color: white;
                font-family: @font-sans-bold;
                &:before {
                    position: absolute;
                    top: 0;
                    bottom: 0;
                    left: 12px;
                    width: 1px;
                    background: white;
                    opacity: .4;
                    content: " ";
                }
                &:after {
                    position: absolute;
                    top: 16px;
                    left: 3px;
                    height: 15px;
                    font-size: 24px;
                    line-height: 0;
                    content: "...";
                    background: lighten(@secondary-color, 1%);
                }
            }
            a, span.a, > span.title {
                position: relative;
                padding: 8px 0 8px 30px;
                display: block;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                color: white;
                .pagination {
                    margin-left: 3px;
                    opacity: 0.4;
                }
                .meta-type-icon {
                    position: absolute;
                    top: 1px;
                    left: -2px;
                    width: 30px;
                    height: 30px;
                    text-indent: 100%;
                    overflow: hidden;
                    background: url('@{basepath}Resources/Public/Images/viewerTocIcons.svg') no-repeat -90px 0;
                    background-size: auto 60px;
                    display: block;
                    color: transparent;
                    .transform(scale(.6));
                    &.meta-type-Abbildung {
                        background-position: 0 0;
                    }
                    &.meta-type-Werbung {
                        background-position: -30px 0;
                    }
                    &.meta-type-Artikel {
                        background-position: -60px 0;
                    }
                }
            }
            span.a, > span.title {
                opacity: 0.5;
                font-weight: normal;
            }
        }
    }
    .tx-dlf-wincontent > ul.toc > li > a { // Based on old shitty markup, it selects the issue title
        color: white;
        font-size: 16px;
        padding: 5px 0;
        display: block;
        .meta-type-icon {
            margin-right: 5px;
            opacity: .6;
        }
    }
    @media screen and (min-width: @tabletLandscapeViewportWidth) {
        position: relative;
        top: auto;
        right: auto;
        left: auto;
        bottom: auto;
        overflow: visible;
        &:after {
            position: absolute;
            top: 0;
            right: 0;
            left: 0;
            height: 1px;
            background: @lightgrey-color;
            content: " ";
        }
        ul.toc {
            font-size: 12px;
            .transition();
            ul li {
                &:nth-child(even) {
                    background: lighten(@secondary-color-light, 40%);
                }
                &.submenu {
                    a {
                        padding-right: 15px;
                    }
                    &:before {
                        top: 12px;
                        right: 5px;
                        border-top-color: fade(@secondary-color-light, 40%);
                    }
                }
                &.current {
                    background: @secondary-color-light;
                    a {
                        color: white;
                        .meta-type-icon {
                            background-position-y: 0 !important;
                            opacity: .8;
                        }
                    }
                }
                &.placeholder {
                    padding: 20px 0 20px 30px;
                    color: lighten(@basegrey-color, 30%);
                    cursor: pointer;
                    &:before {
                        left: 10px;
                        background: @secondary-color-light;
                    }
                    &:after {
                        top: 20px;
                        left: 1px;
                        background: white;
                    }
                }
                a, span.a, > span.title {
                    padding: 6px 0 6px 20px;
                    margin: 2px 0;
                    color: @basegrey-color;
                    .meta-type-icon {
                        top: -3px;
                        left: -6px;
                        opacity: .5;
                        .transform(scale(.5));
                        background-position: -90px -30px;
                        &.meta-type-Abbildung {
                            background-position: 0 -30px;
                        }
                        &.meta-type-Werbung {
                            background-position: -30px -30px;
                        }
                        &.meta-type-Artikel {
                            background-position: -60px -30px;
                        }
                    }
                }
                .no-touchevents & a {
                    .transition();
                    &:hover {
                        background: fade(@secondary-color-light, 30%);
                    }
                }
            }
        }
        .tx-dlf-wincontent > ul.toc > li > a { // Based on old shitty markup, it selects the issue title (again)
            color: @basegrey-color;
        }
    }
}

/* ==============[ metadata (inside the respective wrap > see above) ]==================== */
.tx-dlf-metadata {
    position: relative;
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    line-height: 1.4;
    h1 {
        font-size: 20px;
        font-weight: normal;
        font-family: @font-serif-bold;;
        border-bottom: 1px solid @lightgrey-color;
        padding-bottom: 10px;
        margin-bottom: 5px;
        line-height: 1.1;
        color: white;
    }
    dl {
        color: white;
        margin: 20px 0;
        dt, dd {
            display: block;
        }
        dt {
            font-size: 12px;
            font-family: @font-serif-bold;;
            margin-top: 20px;
            &:first-child {
                margin-top: 0;
            }
        }
        dd a {
            color: white;
        }
    }
    @media screen and (min-width: @tabletLandscapeViewportWidth) {
        line-height: 1.4;
        h1 {
            color: black;
            margin-bottom: -5px;
        }
        dl {
            color: black;
            border-bottom: 1px solid @lightgrey-color;
            padding: 10px 0;
            margin: 0;
            dt, dd {
                font-size: 14px;
                display: inline;
                line-height: 20px;
            }
            dd {
                margin-right: 4px;
                & + dd {
                    display: inline-block;
                }
                &.tx-dlf-metadata-collection {
                    background: lighten(@lightgrey-color,5%);
                    border-radius: 20px;
                    padding: 2px 5px;
                    margin-right: 6px;
                }
                &.tx-dlf-metadata-author a {
                    background: lighten(@secondary-color-light,25%);
                    border-radius: 20px;
                    padding: 2px 5px;
                    margin-right: 2px;
                }
            }
            dt {
                &:before {
                    position: relative;
                    width: 100%;
                    height: 1px;
                    display: table;
                    clear: both;
                    content: " ";
                }
                &:after {
                    content: ": ";
                }
            }
            /*
             * Disable following styles in order to match new (a bit buggy) meta data markup
             *
             * dt.tx-dlf-type {
             *     display: none;
             * }
             * dd.tx-dlf-type {
             *     font-size: 12px;
             *     font-weight: 400;
             *     opacity: 0.5;
             *     display: inline;
             * }
             * dt.tx-dlf-title {
             *     display: none;
             * }
             * dd.tx-dlf-title {
             *     font-weight: 300;
             *     font-size: 22px;
             *     a {
             *         color: @slub-basegrey;
             *     }
             *  }
             *
             */
            &:nth-of-type(n+2) {
                display: none;
            }
            dd {
                a {
                    color: black;
                    &[href*="digi.bib"] {
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        display: inline-block;
                        width: 80%;
                        line-height: 16px;
                        vertical-align: text-bottom;
                    }
                }
            }
        }
    }
}

// EOF
