/*
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *  
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 *  
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *  
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 *
 */

@search-bar-width: 50rem;
@drop-down-width: 46rem;
@dialog-radius: .6rem;

.search-bar__dialog {
    background: no-repeat left @bg-panel;
    background-size: @text-xxlarge;
    background-position: 1.7rem 1.5rem;
    top: 25%;
    left: 50%;
    transform: translate(-50%, 0); /*this is important so it won't bounce when typing in the search field */
    
    width: @search-bar-width;
    min-height: 5rem;
    max-height: 60rem; /*this is important for use with dialog.showModa()*/
    line-height: normal;
    box-shadow: none;
    border-radius: @dialog-radius;
    font-size: 1.6rem;
    overflow: visible;
}

.search-bar__dialog .drop-down {
    margin-top: 1rem;
    border: none;
    float: right;
    width: @drop-down-width;
    background: @bg-panel;
}

.search-bar__dialog svg {
    margin-left: 1.1rem;
    margin-top: 1.5rem;
    width: 1.8rem;
    height: 1.8rem;
    fill: @icon-active;
}

.search-bar__dialog .drop-down svg {
    width: 1.8rem;
    height: 1.8rem;
    margin-left: 0rem;
    margin-top: 0rem;
    margin-right: 1rem;
    fill: @icon-active;
}

.search-bar__dialog .drop-down:hover {
    background: @bg-panel;
}

.search-bar__dialog .drop-down input {
    border: none;
    font-size: @text-xxlarge;
    margin-left: 1.1rem;
    width: 42rem;
    color: @item-hover;
    height: auto;
    line-height: 2.8rem;
    background: rgba(0, 0, 0, 0);
}

.search-bar__dialog .drop-down.hasIcon input {
    margin-left: 3.2rem;
    width: 40rem;
}

.search-bar__dialog ::-webkit-input-placeholder {
    color: @item-disabled;
}

.search-bar__dialog .drop-down input:focus {
    background: rgba(0,0,0,0);
    color: @item-hover;
    border: none;
}

.search-bar__dialog .drop-down input:hover, .search-bar__dialog .drop-down input:focus:hover {
    background: rgba(0,0,0,0);
    border: none;
    font-size: @text-xxlarge;
}

.search-bar__dialog .drop-down .hidden-input {
    font-size: @text-xxlarge;
    display: inline-block;
    position: absolute;
    margin-left: 1.1rem;
    visibility: hidden;
    white-space: pre;
}
.search-bar__dialog .drop-down.hasIcon .hidden-input {
    margin-left: 3.2rem;
}

.search-bar__dialog::backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.01);
}

.search-bar__dialog .dialog__target.dialog-search-bar {
    margin-left: -1.75rem;
    width: 47.5rem;
}

.search-bar__dialog .select__option {
    padding: 0.5rem 0.8rem 0.7rem 0.7rem;
    margin: 0;
    border-left: .3rem solid transparent;
    display: flex;
    overflow: hidden;
    text-overflow:ellipsis;

    span {
        flex-grow: 0;
        flex-shrink: 0;
        max-width: 42rem;
        overflow: hidden;
        text-overflow:ellipsis;

    }
    svg {
        flex-grow: 0;
        flex-shrink: 0;
    }
    .select__option__info {
        flex-shrink: 1;
        text-overflow: ellipsis;
    }
}

.search-bar__dialog .select__option__selected {
    color: @text-focus;
    border-left: .3rem solid @focus-highlight;
    background-color: @bg-dialog;
    
    svg {
        fill: @focus-highlight;
    }
    .select__option__info {
        color: @item-hover;
    }
}

.search-bar__dialog .select__header {
    color: @item-disabled;
    border-top: @hairline solid @underlines;
    margin-top: 1rem;
    margin-bottom: .25rem;
}

.search-bar__dialog .select__header:first-child {
    border: none;
    margin-top: .25rem;
}

.search-bar__dialog .select__option__info {
    color: @item-disabled;
    line-height:2.1rem;
}

.search-bar__dialog .datalist__svg {
    position: absolute;
    top: 1.6rem;
    left: 3.6rem;
    width: 1.8rem;
    height: 1.8rem;
    fill: @item-active;
}

.search-bar__dialog .autocomplete {
    display: inline-block;
    position: absolute;
    color: @item-disabled;
    line-height: 3rem;
    height: 3rem;
    white-space: pre;
    font-size: @text-xxlarge;
    overflow: hidden;
    text-overflow: ellipsis;
}

.button-simple.button-clear-search {
    position: absolute;
    top: 0.3rem;
    right: 1.4rem;
    color: @item-active;
    font-size:1.6rem;
    font-weight: bold;

    &:hover {
        color: @item-hover;
    }
}
