.timetable {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-family: sans-serif;
}

    .timetable * {
        box-sizing: inherit
    }

    .timetable li,
    .timetable ul {
        list-style-type: none;
        margin: 0
    }

    .timetable li,
    .timetable ul {
        padding: 0
    }

    .timetable > aside {
        flex: none;
        max-width: 30%;
        padding: 0 !important;
        margin-top: 46px;
        border-right: 5px solid transparent;
        position: relative
    }

        .timetable > aside li {
            padding: 0 15px;
            background-color: #eeeeee;
            line-height: 46px;
            font-weight: 700;
            color: #000;
        }

            .timetable > aside li:not(:last-of-type) {
                border-bottom: 1px solid #fff
            }

        .timetable > aside .row-heading {
            display: inline-block;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            word-wrap: normal
        }

        .timetable > aside:before {
            content: "";
            display: block;
            background-color: #fff;
            height: 46px;
            position: relative;
            margin-top: -46px;
            top: 0
        }

    .timetable aside li,
    .timetable time li {
        height: 46px
    }

    .timetable > section {
        flex: 3 0 auto;
        width: 0;
        padding: 0 !important;
        overflow: auto;
    }

        .timetable > section time {
            display: block;
            width: 100%;
            overflow-x: unset;
            -webkit-overflow-scrolling: touch
        }

        .timetable > section > header {
            position: relative;
            position: sticky; /* does not work if any parent has overflow-property */
            top: 0;
            z-index: 3;
            width: 100%;
            overflow: hidden;
            background-color: #fff;
            transform-style: preserve-3d
        }

            .timetable > section > header ul {
                display: flex;
                height: 46px;
                align-items: center
            }

            .timetable > section > header li {
                flex: none;
                display: block;
                position: relative;
                width: 96px
            }

                .timetable > section > header li .time-label {
                    display: block;
                    position: absolute;
                    left: 0
                }

                .timetable > section > header li:not(:first-of-type) .time-label {
                    transform: translateX(-50%)
                }

                .timetable > section > header li:last-of-type {
                    /*width: 0*/
                }

                    .timetable > section > header li:last-of-type .time-label {
                        /*transform: translateX(-100%)*/
                    }

    .timetable ul.room-timeline {
        border-left: none;
        display: flex;
        flex-direction: column;
        align-items: stretch
    }

        .timetable ul.room-timeline li {
            position: relative;
            background-color: #f5f5f5;
            height: 46px
        }

            .timetable ul.room-timeline li:nth-of-type(odd) {
                background-color: #fdfdfd
            }

            .timetable ul.room-timeline li:first-of-type {
                border-top: 1px solid #e5e5e5
            }

            .timetable ul.room-timeline li:last-of-type {
                border-bottom: 1px solid #e5e5e5
            }

            .timetable ul.room-timeline li:not(:last-of-type) {
                border-bottom: none
            }

            .timetable ul.room-timeline li:first-child .time-entry {
                height: 44px
            }

            .timetable ul.room-timeline li:after,
            .timetable ul.room-timeline li:before {
                content: "";
                position: absolute;
                z-index: 1;
                left: 0;
                top: 0;
                right: 0;
                bottom: 0
            }

            .timetable ul.room-timeline li:before {
                background-image: linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 0);
                background-size: 24px auto
            }

            .timetable ul.room-timeline li:after {
                background-image: linear-gradient(90deg, #e5e5e5, #e5e5e5 1px, #f4f4f4 0, #f4f4f4 2px, #e5e5e5 0, #e5e5e5 3px, transparent 0, transparent);
                background-size: 96px auto;
                background-position: -2px 0
            }

    .timetable .time-entry {
        background-color: #ec6a5e;
        transition: all .2s;
        height: 45px;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: center;
        position: absolute;
        z-index: 2;
        padding: 0 10px;
        white-space: normal;
        overflow: hidden;
        color: #fff;
        border: 1px solid #e32c1b;
        transform-style: preserve-3d;
        border-radius: 4px;
        box-shadow: 0 5px 30px rgba(0,0,0,0.15);
    }

        .timetable .time-entry small {
            position: relative;
            display: block;
            width: 100%;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            line-height: normal;
        }

        .timetable .time-entry:hover {
            background-color: #e74030
        }

#tt-buttons {
}

    #tt-buttons button.active {
        background: green;
        border: 1px solid;
    }

.timetable.favorites-active .time-entry:not(.favorite) {
    opacity: 0.5;
}

/* Popup */
#tt-popup-wrap {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    overflow: auto;
    visibility: visible;
    opacity: 1;
    transition: .2s ease all;
}

    #tt-popup-wrap.hidden {
        opacity: 0;
        z-index: -1;
        visibility: hidden;
    }

        #tt-popup-wrap.hidden .timetable-popup {
            transform: translateY(-3rem);
        }

.timetable-popup {
    width: 100%;
    max-width: 480px;
    background: #fafafa;
    max-height: 90%;
    overflow: auto;
    margin: 0 3rem;
    transform: translateY(0);
    transition: .3s ease all;
}

    .timetable-popup .image {
        width: 100%;
        margin: 0;
        padding: 0;
        height: 0;
        padding-bottom: 50%;
        background: #eeeeee;
        overflow: hidden;
        position: relative;
    }

        .timetable-popup .image img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            position: absolute;
            /*object-position: top;*/
        }

            .timetable-popup .image img[src=''],
            .timetable-popup .image img[src='undefined'] {
                opacity: 0;
            }

    .timetable-popup .popup-content {
        padding: 1.5rem;
    }

    .timetable-popup .btn {
        background: #000;
        color: #fff;
        padding: 1rem;
    }

        .timetable-popup .btn.active {
            background: green;
        }

        .timetable-popup .btn[href=""] {
            display: none;
        }

.timetable .time-entry.favorite {
    background-color: green;
}

/* Mobile changes */
@media (max-width: 600px) {

    .timetable {
        position: relative;
    }

    .timetable > aside {
        position: absolute;
        max-width: 50%;
        top: 0;
        z-index: 2;
        pointer-events: none;
    }

        .timetable > aside:before {
            opacity: 0;
            visibility: hidden;
        }

        .timetable aside li {
            height: 80px;
            line-height: 15px;
            padding: 0;
            background-color: transparent;
            border-bottom: none !important;
        }

        .timetable > aside .row-heading {
            background: #ffcdd2;
            color: #ff5252;
            margin: 2px;
            padding: 3px 8px;
            font-size: 13px;
            border-radius: 50px;
            font-weight: 700;
        }

        .timetable .time-entry {
            top: 25px;
        }

    .timetable ul.room-timeline li {
        height: 80px;
    }
}