@import "../../../../css/static/properties";
@import "../../../../css/static/mixin";

/* Using a general video format of 16:9 */

$small_height: 10em;

.container {
    @include user-select(none);

    overflow: visible;

    height: $small_height;
    flex-shrink: 0;

    margin-bottom: 5px;
    z-index: 10;

    @include transition(all .3s ease-in-out);

    &.hidden {
        height: 0;
        margin-bottom: 0;

        .panel {
            height: 0;
        }
    }

    &.expended {
        .panel {
            height: calc(100% - 1.5em); /* the footer size (version etc) */
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
        }

        .expendArrow .icon {
            @include transform(rotate(90deg)!important);
        }
    }
}

.panel {
    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    display: flex;
    flex-direction: column;
    justify-content: stretch;

    height: $small_height;
    flex-shrink: 0;

    background-color: #353535;

    border-radius: 5px;
    overflow: hidden;

    @include transition(all .3s ease-in-out);
}

.expendArrow {
    position: absolute;

    top: .5em;
    right: .5em;

    padding: .2em;

    display: flex;
    flex-direction: column;
    justify-content: center;

    cursor: pointer;
    border-radius: .25em;

    @include transition(all $button_hover_animation_time ease-in-out);

    &:hover {
        background-color: #3c3d3e;
    }

    .icon {
        align-self: center;
        font-size: 2em;

        @include transition(all .3s ease-in-out);
        @include transform(rotate(180deg));
    }
}

.videoBar {
    position: relative;

    height: $small_height;
    width: 100%;

    flex-shrink: 0;
    flex-grow: 0;

    display: flex;
    flex-direction: row;
    justify-content: flex-start;

    margin-left: .5em;
    margin-right: .5em;

    /* TODO: Min with of two video +4em for one of the arrows */
    min-width: 6em;

    .videos {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;

        overflow: hidden;

        .videoContainer {
            height: ($small_height - 1em);
            width: ($small_height * 16 / 9);

            flex-shrink: 0;
            flex-grow: 0;
        }
    }

    .arrow {
        position: absolute;

        top: 0;
        bottom: 0;

        width: 4em;
        background: linear-gradient(90deg, #35353500 0%, #353535 50%);
        opacity: 1;

        display: flex;
        flex-direction: column;
        justify-content: center;

        @include transition(all $button_hover_animation_time ease-in-out);

        &.hidden {
            pointer-events: none;
            opacity: 0;
        }

        .iconContainer {
            cursor: pointer;

            display: flex;
            flex-direction: column;
            justify-content: center;

            align-self: flex-end;
            padding: .1em;

            border-radius: .25em;

            &:hover {
                background-color: #3c3d3e;
            }
        }

        &.right {
            right: 0;
        }

        &.left {
            left: 0;
            @include transform(rotate(180deg));
        }
    }
}

.spotlight {
    display: flex;
    flex-direction: column;
    justify-content: stretch;

    min-height: 5em;
    min-width: 5em;

    margin-left: .5em;
    margin-right: .5em;

    flex-shrink: 1;
    flex-grow: 1;

    .videoContainer .actionIcons {
        opacity: .5;
    }

    .videoSecondary {
        max-width: 25% !important;
        max-height: 25%!important;
    }
}

.videoContainer {
    position: relative;

    margin-top: .5em;
    margin-bottom: .5em;

    flex-shrink: 1;
    flex-grow: 1;

    background-color: #2e2e2e;
    box-shadow: inset 0 0 5px #00000040;

    border-radius: .2em;
    overflow: hidden;

    display: flex;
    flex-direction: column;
    justify-content: center;

    &:not(:last-of-type) {
        margin-right: .5em;
    }

    .video {
        opacity: 1;
        align-self: center;
    }

    .videoPrimary {
        height: 100%;
        width: 100%;
    }

    .videoSecondary {
        position: absolute;

        top: 0;
        right: 0;
        max-width: 50%;
        max-height: 50%;

        border-bottom-left-radius: .2em;

        background: #2e2e2e;
        box-shadow: inset 0 0 5px #00000040;
    }

    .text {
        height: 100%;

        display: flex;
        flex-direction: column;
        justify-content: center;

        text-align: center;

        font-size: 1.25em;
        color: #999;

        &.error {
            /* TODO! */
        }

        .videoAvailable {
            display: flex;
            flex-direction: column;
            justify-content: center;

            .button {
                width: 5em;
                align-self: center;
                margin-top: .5em;
                font-size: .8em;
                margin-bottom: .5em;
            }

            .buttons {
                display: flex;
                flex-direction: row;
                justify-content: stretch;

                align-self: center;

                width: 8.5em;
            }

            .button2 {
                width: 8em;
                min-width: 3em;

                flex-shrink: 1;
                flex-grow: 0;

                align-self: center;

                background-color: #3d3d3d;

                border-radius: .18em;

                padding-right: .31em;
                padding-left: .31em;

                transition: background-color 0.25s ease-in-out;
                cursor: pointer;

                &:not(:first-child) {
                    margin-left: .5em;
                }

                &:hover {
                    background-color: #4a4a4a;
                }
            }
        }

        &.videoSecondary {
            font-size: .75em;

            height: 100%;
            width: 100%;
        }
    }

    .info {
        position: absolute;

        bottom: 0;
        left: 0;

        display: flex;
        flex-direction: row;

        border-top-right-radius: .2em;
        background-color: #35353580;

        padding: .1em .3em;

        max-width: 70%;

        .icon {
            flex-shrink: 0;
            align-self: center;
        }

        .name {
            align-self: center;
            color: #999;
            margin-left: .25em;
            font-weight: normal!important;

            @include text-dotdotdot();

            &.local {
                color: #147114;
            }
        }
    }

    .actionIcons {
        position: absolute;

        bottom: 0;
        right: 0;

        display: flex;
        flex-direction: row;

        border-top-left-radius: .2em;
        background-color: #353535;

        padding: .2em .3em;

        opacity: 0;
        @include transition(all $button_hover_animation_time ease-in-out);

        .iconContainer {
            align-self: center;
            display: flex;
            padding: .2em;
            margin-top: -1px;
            margin-bottom: calc(-.1em - 1px);

            cursor: pointer;
            border-radius: .1em;
            border: 1px solid transparent;

            @include transition(all $button_hover_animation_time ease-in-out);

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

            &:not(:first-of-type) {
                margin-left: .2em;
            }

            &.toggle {
                &.disabled {
                    background-color: var(--menu-bar-button-background-activated-red);
                    border-color: var(--menu-bar-button-border-activated-red);
                }
            }

            &.hidden {
                display: none;
            }
        }

        .icon {
            flex-shrink: 0;
            align-self: center;
        }
    }

    &:hover {
        .actionIcons {
            opacity: 1;
        }
    }
}

/* Opera popout button fix (we've our own?) */
html > div {
    display: none;
    pointer-events: none;
}