// search.scss
// Styling for search page, and search functionalities
// ----------------------------------------------------------------------------------------
@import '~mixins.scss';
@import '~variables.scss';
@import '~animation.scss';

.search-page-container {
    .archive-content {
        height: 100%;
    }
}

.search-page-header {
    display: flex;
    position: relative;
    width: 100%;
    align-items: center;
    .searchbar-flex-handler {
        flex-grow: 1;
    }
}

.ui-responsive-medium {
    .searchbar-flex-handler {
        width: 52px;
        flex-grow: 0;
        background-color: $sd-background;
        .item-searchbar.focused {
            position: absolute;
            z-index: 10;
        }
    }
    .sortbar-flex-handler {
        flex-grow: 1;
        text-align: right;
    }
    .subnav__stage-group--ui-responsive {
        display: none;
    }
}

.ui-responsive-small {
    .searchbar-flex-handler {
        width: 40px;
        .button.search-icon {
            width: 40px;
        }
    }
    .flat-searchbar {
        &.extended {
            z-index: 2;

            .search-handler {
                input {
                    max-width: 110px;
                }
            }
        }
        .search-handler {
            padding: 10px 6px;
            min-width: 32px;
        }
    }
    .subnav__stage-group--ui-responsive {
        display: none;
    }
}

.filter-trigger {
    width: 48px;
    height: 48px;
    line-height: 54px;
    text-align: center;
    background: $archive-sidebar-bg;
    flex-shrink: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    @include transition(all ease 0.1s);
    overflow: hidden;
    i {
        @include opacity(60);
    }
    &:hover {
        cursor: pointer;
    }
    &--active {
        background: $sd-blue-text;
        i {
            color:white;
        }
    }
}

.filter-content {
    margin-top: 10px;
}

.panel-selector {
    margin-top: 20px;
    margin-bottom: 10px;
    width: 100%;
    button {
        width: 48%;
    }
}

.multi-action-bar {
    @include border-box();
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    line-height: 48px;
    background-color: #fff;
    padding: 0 16px;
    animation: dropOut2 .3s cubic-bezier(0.695, 0.105, 0.285, 1.275) 1;
    background-color: #d2e5ed;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2);
    .navbtn {
        border: none;
        vertical-align: bottom;
    }

    #multi-select-count {
        margin-left: 15px;
    }

    .toggle {
        width: 23px;
        height: 23px;
        border: 0;
        padding: 0;
        margin-right: 10px;
        z-index: 3;
        line-height: 0;
        @include border-radius(23px);
        box-shadow: 0 0 7px 0 rgba(0,0,0,0.3);
        @include transition(transform 0.5s);
        i { height: 15px; }
        &.active {
            @include rotate(180deg);
        }
    }
    .right-stack {
        margin-right: -16px;
    }
}

.multi-action-bar-inline {
    display: flex;

    .navbtn {
        border: none;
    }
}

.item-searchbar {
    border-left: 1px solid #dfdfdf;
    border-right: 1px solid #dfdfdf;
    position: relative;

    &.focused {
        //border-right: 1px solid #dfdfdf;
        background: $white;
    }
    .search-icon {
        @include user-select(none);
        width: 28px;
        height: 28px;
        display: inline-block;
        background: url(~images/search-icon.png) no-repeat 5px 5px;
        @include opacity(85);
        &:hover {
            cursor: pointer;
            @include opacity(100);
        }
    }

    .button {
        position: absolute;
        width: $nav-height;
        height: $nav-height;
        background-position: center;
        top: 0;
        border: 0;
        margin: 0;
        .svg-icon-right {
            width: 18px;
            margin-top: 3px;
        }
    }

    input {
        height: $nav-height;
        line-height: 100%;
        font-size: 14px;
        border: 0 !important;
        padding: 0 $nav-height;

        background: none;
        &:focus, &:active {
            @include box-shadow(none !important);
        }
        &::-webkit-input-placeholder {
            line-height: 17px;
        }
    }

    .trigger {
        right: 0;
        background: none;
    }

    .search-cancel {
        position: absolute;
        top: 12px; right: 55px;
        background: transparent;
        border: 0;
        padding: 0;
        opacity: 0.4;
        height: 24px;
        width: 24px;
        padding:4px;
        cursor: pointer;
        transition: all 300ms ease;
        &:hover {
            opacity: 0.8;
        }
    }

}


.search-tags {
    position: relative;
    z-index: 2;
    padding: 0 0 0 20px;
    box-shadow: 0 1px 1px 0 rgba(0,0,0,0.12);
    background-color: rgba(255, 255, 255, 0.5);
    .search-tags__list {
        flex-grow: 1;
        li {
            display: inline-block;
            padding: 8px 0 6px 0;
        }
    }
    .tag-label {
        line-height: 1.8rem;
        margin: 2px 1px 2px 0;
        span {
            opacity: 0.75;
            margin-right: 0.5rem
        }
    }
    .refresh-box {
        display: none;
    }
    &.refresh {
        padding-right: 50px;
        min-height: 44px;
        .refresh-box {
            display: block;
            position: absolute;
            right: 10px; top: 8px;
        }
    }
}

.item-globalsearch {
    float: left;
    .popup {
        position: fixed;
        top: 100px;
        left: 50%;
        width: 400px;
        margin-left: -200px;
        @include border-radius(6px);
        background: rgba(0,0,0,0.3);
        @include border-box();
        padding: 12px;
        @include box-shadow(0 0 20px 0 rgba(0,0,0,0.25));
        z-index: 11112000;
        > .content {
            width: 100%;
            background: #fff;
        }
    }
    .trigger-popup {
        height: $nav-height - 1;
        padding: 10px 10px 10px 15px;
        @include box-sizing(border-box);
        float: left;
    }
    .separator-handler {
        margin: 9px 0 0 0;
        border-right: 2px dotted #bcbcbc;
        height: 30px;
        float: left;
    }
    &.extended {
        .popup {
            display: block;
        }
    }
}
// Item global search dialog
.advanced-globalsearch {

    form {
        @include clearfix();
    }

    .advanced {
        &:before {
            display: none;
        }
        margin-top: 0;
        position: static;
        @include border-box();
        @include box-shadow(0 3px 5px 0 #aaa);
        @include border-radius(0px);
        border: 0;
        width: 100%;
        border-top: 1px solid #e6e6e6;
        @include box-shadow(inset 0 1px 3px 0 #eee);

        .close {
            padding: 0 5px;
            float: right;
            width: auto;
            background: none;
            margin: 5px 5px 0 0;
        }

        .content {
            padding: 25px 10px 10px;
        }
        .actions {
            @include clearfix();
            padding: 10px 0;
            button {
                width: auto;
                clear: none;
            }
        }
    }
}

#react-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
}

.sortbar {
    .label-total {
        margin: 0 $sd-base-increment / 2;
        background-color: $grayText;
    }
}

.search-parameters {
    .keywords {
        @include clearfix();
    }
}

.es-highlight {
    background-color: rgba(255, 61, 61, 0.25);
}

.subnav.legal-archive {
    .sortbar-container {
        padding: 10px 16px 10px 0;
    }
    .sortbar {
        margin: 0 0 0 15px;
        padding: 0 0 0 10px;
        height: 25px;
        .lab {
            line-height: 20px;
        }
    }
    .dropdown {
        .sortbar {
            width: 100%;
            height: auto;
            margin: 0;
            padding: 0;
            text-align: left;
            border-left: 0;
            .dropdown {
                min-width: 120px;
                float: right;
            }
            .direction {
                line-height: 18px;
                margin-left: 15px;
            }
        }
        .sd-pagination {
            padding: 0 17px;
            em.page-info, .btn-group  {
                width: 100%;
                text-align: center;
            }
        }
    }

    .dropdown__menu {
        &-divider {
            clear: both;
        }
    }
}

.sd-grid-item__footer {
    overflow: hidden;
    .sd-grid-item__footer-block--multi-r {
        overflow: hidden;
        .sd-grid-item__footer-block-item {
            flex-shrink: 1 !important;
            overflow: hidden;
        }
    }
    .sd-grid-item__footer-block-item {
        flex-grow: 0;
        margin: 0 auto;
        display: flex;
        align-items: center;
        .state-label {
            margin: 0 auto;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }
}


.workspace .main-section.search-page-container  {

    .preview-layout {
        .search-content {
            display: flex;
            flex-direction: row;
        }
        .search-content__main {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            position: relative;
            overflow-x: auto;
            .search-tags {
                flex-shrink: 0;
            }
        }
        .search-preview {
            height:100%;
            transition: all ease-in-out 0.2s;
            width: $sidepreview-width + 160;
            position: relative;
            flex-grow: 0;
            flex-shrink: 0;
            opacity: 1;
            .content-item-preview {
                top: 0 !important;
                position: relative;
                width:100% !important;
                height:100%;
                opacity: 1;
                transition: opacity ease-in-out 0.4s;
                transition-delay: 0.2s;

            }
            @media only screen and (max-width: 1430px) {
                width: $sidepreview-width - 40;
            }
        }
        &.closed {
            .search-preview {
                width: 0;
                overflow: hidden;
                .content-item-preview {
                    opacity: 0;
                }
            }

        }
    }
}


.workspace.authoring .main-section.search-page-container  {
    .preview-layout {
        .search-preview--overlay {
            position: absolute;
            top: 4.8rem;
            right: 0;
            bottom: 0;
            width:0;
            overflow: visible;
            opacity: 1;
            z-index: 3;
            .content-item-preview {
                top: 0 !important;
                position: absolute;
                width: $sidepreview-width - 80;
                right: 80 - $sidepreview-width - 4;
                opacity: 1;
                transition: all ease-in-out 0.2s;
                overflow-y: visible !important;
                box-shadow: inset 3px 0 2px -1px rgba(0, 0, 0, 0.12), 2px 0 8px 0 rgba(0, 0, 0, 0.3), 0 0 2px 0 rgba(0, 0, 0, 0.12);
                .shift-preview__toggle {
                    display: inline-block;
                }
                &.shift {
                    right: 0;
                    box-shadow: -2px 0 8px 0 rgba(0, 0, 0, 0.3), 0 0 2px 0 rgba(0, 0, 0, 0.12)
                }
            }
        }

        .search-preview {
            width: $sidepreview-width;
            @media only screen and (max-width: 1430px) {
                width: $sidepreview-width - 40;
            }
        }
        &.closed {
            .search-preview {
                width: 0;
                overflow: hidden;

                .content-item-preview {
                    opacity: 0;
                }
            }
            .search-preview--overlay {
                opacity: 0;
            }

        }
    }
}


// used to resize thumbnail of item while dragging it
#drag-image-holder {
    position: absolute;
    left: -2000px;
    max-width: 200px;
    max-height: 200px;

    img {
        max-width: 200px;
        max-height: 200px;
    }
}
