@import 'common/vars';
@import 'common/mixins';
@import 'common/layout';
@import 'common/animations';

@import 'webpanel/plugins/music.mpd/vars';

.music-mpd-container {
    display: flex;
    flex-direction: column;
    line-height: 3rem;
    letter-spacing: .03rem;
    height: inherit;
    overflow: hidden;

    .item {
        display: flex;
        align-items: center;
        cursor: pointer;
        border-radius: 1rem;
        padding: .5rem;

        &:nth-child(odd) { background: rgba(255, 255, 255, 0.0); }
        &:nth-child(even) { background: $default-bg-3; }
        &:hover { background: $hover-bg !important; }
        &.selected { background: $selected-bg !important; }

        .artist {
            font-size: .9em;
        }
    }

    .duration {
        color: $duration-color;
        font-size: .7em;
    }

    button {
        border: 0;

        &:disabled {
            background: none;
        }

        &.enabled {
            color: $button-enabled-color !important;
            .fa { color: $button-enabled-color !important; }
        }

        &:hover {
            .fa {
                opacity: 0.75;
            }
        }
    }

    .spacer {
        height: 5rem;
    }

    .panels {
        display: flex;
        flex-direction: row;
        flex: 0 1 auto;
        order: 0;
        @include calc(height, '100% - 10.1rem');

        .panel {
            height: 100%;
        }
    }

    .browser {
        width: 40%;
        min-width: 20rem;
        max-width: 35rem;
        background: $browser-panel-bg;
        font-size: .9em;

        .item {
            background: none;
        }

        .fa {
            color: #666;
        }
    }

    %ctrl-button {
        border: 0;
        padding: 0 1.5rem;

        &:disabled {
            background: none;
        }

        &.enabled {
            color: $button-enabled-color;
        }

        .fa-search {
            color: $button-hover-color;
        }
    }

    %move {
        background: $move-mode-track-bg !important;
        border-top: $move-mode-track-border;
        border-bottom: $move-mode-track-border;
        cursor: move;
    }

    .browser,
    .search,
    .playlist {
        .results {
            position: relative;   // For the dropdown menu
            @include calc(height, '100% - 5.1rem');
            overflow: auto;
        }

        .browser-controls,
        .results-controls,
        .playlist-controls {
            width: 100%;
            height: 4rem;
            background: $playlist-controls-bg;
            border-bottom: $playlist-controls-border;
            padding: .5rem 0;

            input[type=text] {
                width: 100%;
            }

            button {
                @extend %ctrl-button;
                padding: 0 .75rem;
            }
        }

        .empty {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            font-size: 5rem;
            color: $empty-playlist-color;
            text-shadow: $empty-playlist-shadow;
        }

        .item {
            .empty {
                font-size: 1em;
                display: block;
                height: auto;
            }

            &.active {
                height: 4rem;
                @extend .active-glow;
            }

            &.move:hover {
                @extend %move;
            }
        }
    }

    .playlist {
        width: 100%;
    }
    .playlist-add,
    .editor {
        .editor-controls,
        .playlist-add-controls {
            background: $playlist-controls-bg;
            border-bottom: $playlist-controls-border;
            border-radius: 0;
            box-shadow: $filter-bar-shadow;
            margin: -2.5rem -2rem 0 -2rem;
            padding: .5rem;
        }

        input[type=text] {
            width: 100%;
        }

        button {
            @extend %ctrl-button;
            padding: 0 .75rem;
        }

        .editor-container,
        .playlists-container {
            overflow: auto;
            margin: 0 -2rem;
            padding: 1rem;
        }

        .playlists-container {
            max-height: 70vh;
        }

        .editor-container {
            max-height: 65vh;

            .item {
                &.move:hover {
                    @extend %move;
                }
            }
        }
    }

    .controls {
        @extend .vertical-center;
        width: 100%;
        border-top: $default-border-2;
        background: $control-panel-bg;
        box-shadow: $control-panel-shadow;
        z-index: 2;
        order: 1;
        flex: 0 0 $control-panel-height;

        .track-container {
            @extend .vertical-center;
            padding-left: 1rem;
            line-height: 2.6rem;

            a {
                color: initial;
                text-decoration: none;

                &:hover {
                    color: $track-info-hover-color;
                }
            }

            .track-info {
                .artist {
                    font-weight: bold;
                }
            }
        }

        button {
            &:hover {
                .fa {
                    color: $button-hover-color;
                }
            }
        }

        .playback-controls {
            .row {
                @extend .vertical-center;
                justify-content: center;
            }

            button {
                padding: 0 1.5rem;

                .fa-play, .fa-pause  {
                    color: $button-hover-color;
                    font-size: $font-size * 2;
                    margin-top: .3rem;

                    &:hover {
                        color: $play-button-hover-color;
                    }
                }
            }
        }

        .pull-right {
            padding-right: 2.5rem;
            button {
                &:not(last-child) {
                    padding: 0 .7rem;
                }

                &:last-child {
                    padding: 0;
                }
            }

            .volume-container {
                button {
                    padding: 0 .3rem 0 0;
                    background: none;
                }
            }
        }

        .seek-slider {
            width: 75%;
        }

        .volume-slider {
            width: 75%;
            margin-right: 1rem;
        }

        .elapsed-time,
        .total-time {
            font-size: .7em;
            color: .7em;
        }

        .elapsed-time {
            margin-right: 1.5rem;
        }

        .total-time {
            margin-left: 1.5rem;
        }
    }

    .search {
        --width: 90vw;
        padding: 0;

        form {
            margin-bottom: 0;
            padding: 2.7rem;

            .row {
                padding: .5rem;
            }

            .footer {
                padding-top: 1.5rem;
                margin: 2.5rem 0;
                border-top: $search-modal-footer-border;

                .left {
                    display: flex;
                    justify-content: left;
                }
            }

            button, input[type=submit] {
                border-radius: 5rem;
            }
        }

        .results-controls {
            padding: 0;
            border-bottom: $default-border-2;
            width: var(--width);
            height: 4.5rem;
            display: flex;
            align-items: center;
            z-index: 502;
        }

        form, .results {
            position: relative;
        }

        .results {
            @include calc(height, '100% - 4.7rem');
        }
    }

    .dropdown {
        width: 20rem;
    }

    .filter-container {
        position: relative;
    }
}

#music-mpd-info {
    .modal {
        .body {
            .row {
                margin: .5rem;
                padding: .5rem;
                border-bottom: $info-modal-row-border;

                &:hover {
                    border-radius: 1rem;
                    background: $hover-bg;
                }

                .attr {
                    color: $info-modal-attr-color;
                }

                .value {
                    text-align: right;
                }
            }
        }
    }
}

#music-mpd-search-modal,
#music-mpd-playlist-edit {
    .dropdown {
        z-index: 503;
    }
}

#music-mpd-search-modal {
    .header {
        height: 3.8rem;
    }

    .body {
        display: flex;
        padding: 0;
    }
}

#music-mpd-playlist-add {
    .modal {
        min-width: 50rem;
    }
}

#music-mpd-playlist-edit {
    .modal {
        min-width: 80rem;
    }
}

@media #{map-get($widths, 's')} {
    #music-mpd-info {
        .modal {
            width: 80vw;
        }
    }
}

@media #{map-get($widths, 'm')} {
    #music-mpd-info {
        .modal {
            width: 70vw;
        }
    }
}

@media #{map-get($widths, 'l')} {
    #music-mpd-info {
        .modal {
            width: 45vw;
        }
    }
}

