// discussion - elements - navigation
// ====================

.forum-nav {
    border: 1px solid #aaa;
    border-radius: $forum-border-radius;
}

// ------
// Discussion Forums Page Header
// ------
.discussion-board > .page-header {
    $searchBoxPadding: rem($baseline / 2 + 2);
    $searchBoxHeight: (rem($baseline) + ($searchBoxPadding * 2));

    div {
        display: inline-block;
        vertical-align: middle;
    }

    .page-header-main {
        line-height: $searchBoxHeight;
    }

    .page-header-secondary > .form-actions > button {
        // Overrides base size set in lms/static/sass/shared-v2/_layouts.scss
        // Done to match size of UXPL's search box. This is bad, I know.
        height: $searchBoxHeight !important;
    }
}

// -----------
// Browse menu
// -----------
.forum-nav-browse-menu-wrapper {
    border-bottom: 1px solid $forum-color-border;
    background: $gray-l5;
}

.forum-nav-browse-filter {
    position: relative;
    border-bottom: 1px solid $forum-color-border;
    padding: ($baseline/4);
}

.forum-nav-browse-filter .icon {
    font-size: $forum-small-font-size;
    position: absolute;
    margin-top: -6px;
    top: 50%;
    right: ($baseline/4 + 1px + $baseline / 4); // Wrapper padding + border + input padding
}

.forum-nav-browse-filter-input {
    width: 100%;
}

.forum-nav-browse-title {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid $forum-color-border;
    padding: ($baseline/2);
    background: transparent;
    box-shadow: none;
    background-image: none;
    color: $link-color;
    text-align: left;

    &:hover,
    &:focus {
        // switched from a to button;
        // need to override button styles
        background-image: none !important;
        box-shadow: none !important;
        background: $forum-color-background !important;
    }
}

.forum-nav-browse-title .icon {
    @include margin-right($baseline/2);
}

.forum-nav-browse-menu {
    font-size: $forum-base-font-size;
    overflow-y: scroll;
    list-style: none;
}

.forum-nav-browse-submenu {
    list-style: none;
    padding: 0;

    li {

        .forum-nav-browse-title {
            padding-left: $baseline;
        }
    }
}

// -------------------
// Sort and filter bar
// -------------------
.forum-nav-refine-bar {
    @include clearfix();
    font-size: $forum-small-font-size;
    border-bottom: 1px solid $forum-color-border;
    background-color: $gray-l5;
    padding: ($baseline/4) ($baseline/2);
    color: $black;
    text-align: right;
    @include border-radius($forum-border-radius, $forum-border-radius, 0, 0);
}

.forum-nav-filter-main {
    box-sizing: border-box;
    display: inline-block;
    width: 50%;
    @include text-align(left);
}

.forum-nav-filter-cohort, .forum-nav-sort {
    box-sizing: border-box;
    display: inline-block;
    width: 50%;
    @include text-align(right);
}

%forum-nav-select {
    border: none;
    max-width: 100%;
    background-color: transparent;
}

.forum-nav-filter-main-control {
    @extend %forum-nav-select;
}

.forum-nav-filter-cohort-control {
    @extend %forum-nav-select;
}

.forum-nav-sort-control {
    @extend %forum-nav-select;
}

// -----------
// Thread list
// -----------
.forum-nav-thread-list {
    margin: 0;
    padding-left: 0;
    overflow-y: scroll;
    list-style: none;

    .forum-nav-thread-labels {
        margin: 5px 0 0;
    }
}

.forum-nav-thread {
    border-bottom: 1px solid $forum-color-border;
    background-color: $forum-color-background;
    margin-bottom: 0;

    .forum-nav-thread-link {
        @include border-left(3px solid transparent);
        display: flex;
        padding: ($baseline/4) ($baseline/2);
        transition: none;
        align-items: center;
        justify-content: space-between;
        color: $forum-color-read-post;

        &:hover,
        &:active,
        &:focus {
            text-decoration: none;
        }

        &:hover {
            background-color: $forum-color-hover-thread;
        }

        &.is-active {
            color: $forum-color-background;
            background-color: $forum-color-reading-thread;

            .forum-nav-thread-labels > li {
                border-color: $forum-color-background;
                color: $forum-color-background;
            }

            .forum-nav-thread-votes-count {
                color: $forum-color-background;
            }

            .forum-nav-thread-comments-count {
                color: $base-font-color;

                &:after {
                    border-right-color: $forum-color-border;
                }
            }

            span.icon {
                color: $forum-color-background;
            }
        }

        .forum-nav-thread-unread-comments-count {
            display: inline-block;
            font-size: $forum-small-font-size;
            white-space: nowrap;
        }
    }

    &.never-read {
        .forum-nav-thread-link {
            @include border-left(3px solid $forum-color-never-read-post);
            color: $forum-color-never-read-post;
        }
    }
}

%forum-nav-thread-wrapper {
    display: inline-block;
    vertical-align: middle;
}

.forum-nav-thread-wrapper-0 {
    @extend %forum-nav-thread-wrapper;
    @include margin-right($baseline/5);

    .icon {
        font-size: $forum-base-font-size;
        width: 18px;
        text-align: center;

        &:before {

            @include rtl {
                @include transform(scale(-1, 1)); // RTL for font awesome question mark
            }
        }
    }
}

.forum-nav-thread-wrapper-1 {
    @extend %forum-nav-thread-wrapper;
    margin: 0 ($baseline/2);
    flex-grow: 1;  // This column should consume all the available space
}

.forum-nav-thread-wrapper-2 {
    @extend %forum-nav-thread-wrapper;
    @include text-align(right);
    white-space: nowrap;
}

.forum-nav-thread-title {
    font-size: $forum-base-font-size;
    display: block;
    margin-left: 0;
}

%forum-nav-thread-wrapper-2-content {
    @include margin-right($baseline/4);
    font-size: $forum-small-font-size;
    display: inline-block;
    text-align: center;
    color: $black;

    &:last-child {
        @include margin-right(0);
    }
}

.forum-nav-thread-votes-count {
    @extend %forum-nav-thread-wrapper-2-content;
}

.forum-nav-thread-comments-count {
    @extend %forum-nav-thread-wrapper-2-content;
    @extend %t-weight4;
    position: relative;
    @include margin-left($baseline/4);
    margin-bottom: ($baseline/4); // Because tail is position: absolute
    border-radius: $forum-border-radius;
    padding: ($baseline/10) ($baseline/5);
    min-width: 2em; // Fit most comment counts but allow expansion if necessary
    background-color: $gray-l4;

    // Speech bubble tail
    &:after {
        content: '';
        display: block;
        position: absolute;
        bottom: (-$baseline/4);
        @include right($baseline/4);
        width: 0;
        height: 0;
        border-style: solid;
        @include border-width(0, ($baseline/4), ($baseline/4), 0);
        @include border-color(transparent, $gray-l4, transparent, transparent);
    }
}

.forum-nav-load-more {
    border-bottom: 1px solid $forum-color-border;
    background-color: $gray-l5;
}

%forum-nav-load-more-content {
    display: block;
    padding: $baseline 0;
    text-align: center;
}

.forum-nav-load-more-link {
    @extend %forum-nav-load-more-content;
    color: $link-color;

    &:hover,
    &:focus {
        color: $forum-color-active-text;
        background-color: $forum-color-active-thread;
    }
}

.forum-nav-loading {
    @extend %forum-nav-load-more-content;
}
