/*
 * Copyright (c) 2012 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.
 * 
 */

/*
 * This file first imports all of the shared LESS/CSS, and then defines 
 * version-specific layout (e.g. layout for the App shell, or layout for
 * the In-Browser version on Firefox).
 *
 * Going forward, we may have different versions of this file for different
 * Versions (e.g. App, In-Browser, etc.)
 *
 * Anything that is general/reusable should be pushed up into a LESS file
 * in the "styles" directory. See "brackets_shared.less" for the organization
 * 
 * Date: @DATE
 */

/* IMPORTANT: importing brackets_shared should be the first step in this file
 * This is so that imported CSS files (NOT LESS files) end up in the
 * right place
 */
@import "brackets_shared.less";

/* Overall layout */

html, body {
    height: 100%;
    overflow: hidden;
    
    /* Turn off selection for UI elements */
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    user-select: none;
    
    /* And make sure we get a pointer cursor even over text */
    cursor: default;
}

body {
    height: 100%;
}

.resizing-container {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: @z-index-brackets-panel-resizer;
    
    &.horz-resizing {
        cursor: col-resize;
    }
    
    &.vert-resizing {
        cursor: row-resize;
    }
}

a, img {
    -webkit-user-drag: none;
}

.main-view {
    height: 100%;

    .sidebar {
        height: 100%;
        .vbox;
        width: @sidebar-width;
        float: left;
    }

    .content {
        height: 100%;
        position: relative;
    }
}

.toolbar {
    /* make sure the shadow goes above other items */
    z-index: @z-index-brackets-toolbar;
}

.busyCursor {
    cursor: wait !important;
}

#status-bar {
    position: relative;
    background-color: @background-color-3;
    border-top: 1px solid darken(@background-color-3, @bc-color-step-size / 2);
    box-sizing: border-box;
    color: @bc-grey;
    font-family: @fontstack-sans-serif;
    font-size: 0.9em;
    line-height: 1;
    
    height: 20px;
    overflow: hidden;
    padding: 3px 20px 3px 10px;
}
    
#status-info {
    position: absolute;
    left: 8px;
    background-color: @background-color-3;
    white-space: nowrap;
    
    div {
        display: inline;
        margin-right: 20px;
    }
}
    
#status-indicators {
    position: absolute;
    right: 4px;
    background-color: @background-color-3;
    white-space: nowrap;
    
    &>div {
        display: inline;
        margin-left: 20px;
        
        &#busy-indicator {
            display: inline-block;
            vertical-align: middle;
            margin-top: -2px;
            width: 12px;
            height: 12px;
            background: url("images/small_spinner.svg") no-repeat;
            visibility: hidden;
        
            &.spin {
                -webkit-animation: rotating 1.5s linear infinite;
                visibility: visible;
            }
        }        
    }
}

@-webkit-keyframes rotating {
    0% {
        -webkit-transform: rotate(0deg);
    }
    
    100% {
        -webkit-transform: rotate(360deg);
    }
}

#status-indent > * {
    display: inline-block;
}

#status-indent > *.hidden {
    display: none;
}

#indent-type, #indent-width-label {
    margin-right: 2px;
}

#indent-type, #indent-width-label {
    cursor: pointer;
}

#indent-width-label {
    width: 14px;
}

#indent-type:hover, #indent-width-label:hover {
    text-decoration: underline;
}

#indent-width-input {
    font-size: 1em;
    height: 12px;
    line-height: 1;
    vertical-align: -2px;
    border: 1px solid darken(@background-color-3, @bc-color-step-size / 2);
    color: @bc-black;
    margin: 0;
    padding: 0;
    width: 14px;
    position: relative;
    left: -1px;
    top: -2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
}

#indent-width-input:focus {
    border: 1px solid rgba(9,64,253,0.84);
    outline: none;
}

#indent-width-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#editor-holder {
    position: relative;
    
    /* Placeholder shown when there is no editor open */
    #not-editor {
        height: 100%;
        .vbox;
        .box-pack(center);
        .box-align(center);
        background: @background-color-2 url('images/no_content_bg.svg') no-repeat center 45%;
    }
}

.vert-resizer {
    position: absolute;
    height: 6px;
    width: 100%;
    z-index: @z-index-brackets-panel-resizer;
    opacity: 0;
    cursor: row-resize;
}

.horz-resizer {
    position: absolute;
    height: 100%;
    width: 6px;
    z-index: @z-index-brackets-panel-resizer;
    opacity: 0;
    cursor: col-resize;
}

.bottom-panel {
    display: none;
    height: 200px;
    border-top-style: solid;
    border-width: 1px;
    border-color: lighten(@bc-grey, @bc-color-step-size*4);
    
    .toolbar {
        height: auto;
        padding-top: @base-padding / 2;
        padding-bottom: @base-padding / 2;
        z-index: @z-index-brackets-results-panel;
        .box-shadow(0 -1px 3px 0 fadeout(@bc-black, 70%));
        .title {
            font-size: @label-font-size;
            font-weight: bold;
        }
        .close {
            position: absolute;
            right: 10px;
        }
    }
    
    .table-container {
        height: 170px;
        overflow: auto;

        td {
            padding-left: @base-padding;
            padding-right: @base-padding;
        }
        
        .highlight {
            background: #d2dcf8;
        }
        
        tr.selected td {
            background-color: @bc-light-blue;
        }
    }
}

#update-notification {
    padding-right: 5px;
    margin-bottom: -1px;
    .sprite-icon(0,0, 14px,14px, "images/updateSprites.svg");
    &:hover {
        .sprite-swap(0,14px);
    }
    display:none;
}

.jslint-disabled {
    font-size: 1em;
    color: @bc-grey;
}

.jslint-errors {
    font-size: 1em;
    color: @bc-red;
}

.jslint-valid {
    font-size: 1em;
    color: lighten(@bc-yellow, @bc-color-step-size*2);
}

#toolbar-go-live {
    padding-right: 8px;
    
    // Default icon is for the 'disconnected' state
    // The 'connecting failed' (.warning) state also maps here
    .sprite-icon(0,0, 22px,11px, "images/live_development_sprites.svg");
    &:hover {
        .sprite-swap(0,11px);
    }
    // 'Connected' state
    &.success {
        .sprite-swap(0,22px);
    }
    &.success:hover {
        .sprite-swap(0,33px);
    }
    // 'Connection in progress' state
    &.info {
        .sprite-swap(0,44px);
    }
    // 'Out-of-sync' state
    &.out-of-sync {
        .sprite-swap(0,55px);
    }
    &.out-of-sync:hover {
        .sprite-swap(0,66px);
    }
}


/* Project panel */

#project-header {
    /* Fixed height blank space for now. The mockups have the window "stoplights" or a logo here. */
    height: 29px;
}

#sidebar-resizer {
    position: absolute;
    width: 6px;
    height: 100%;
    z-index: @z-index-brackets-sidebar-resizer;
    opacity: 0;
    cursor: col-resize;
} 

#file-section {
    .vbox;
    .box-flex(1);
    margin: 5px 0px 0px 0px;
    position: relative;
    
    .project-file-header-area {
        padding: 6px 6px 2px 10px;
        font-size: 13px;
        color: #929292;
    }

    .file-list-divider {
        border-bottom: 1px solid #9a9a9a;  
        box-shadow: 0px 1px #eeeeee;
    }
}

#open-files-container {
    .box-flex(0);
    margin: 0 0 22px 0;
    padding: 0px;
    max-height: 200px; // TODO (Issue #276): it would be nicer to have this be 50%, but that doesn't seem to work

    
    ul {
        list-style-type: none;
        margin: 0;
    }
        
    li {
        white-space: nowrap;
        position: relative; // so that children can be positioned absolute
        line-height: 18px;
        padding: 0 0 0 8px;
        min-height: 18px;
        vertical-align: baseline;
    }
            
    a {
        color: #BBB;
        
        font-size: 13px;
        text-decoration: none;
        
        display: block;
        height: 16px;
        line-height: 16px;
        margin-left: 18px;
        padding: 3px (@triangle-size * 2) 3px 0;
        
        cursor: default;
    }
    
    .selected a {
        color: #fff;
    }
}

.sidebar-selection {
    background: url("images/active_back.png") no-repeat top right;
    height: 22px;
    position: absolute;
}

.sidebar-selection-triangle {
    background: url("images/active_back.png");
    width: 10px;
    height: 22px;
    position: fixed;

    z-index: @z-index-brackets-selection-triangle; /* scroller-shadow appears above this triangle */
}

.sidebar-selection-triangle.triangle-visible:before {
    content: "";
    
    border-top: @triangle-size solid transparent;
    border-bottom: @triangle-size solid transparent; 
    border-right: @triangle-size solid @background-color-3;
    
    display: block;
    position: absolute;
    top: 2px;
    right: 0;
    width: 0;
    height: 0;
    
    .scale-x(0.9, right, top);
}

//Initially start with the open files hidden, they will get show as files are added
#open-files-container {
    display:none;
}

#project-files-container {
    .box-flex(1);
    
    .jstree-brackets li > a {
        padding-right: @triangle-size * 2;
    }
    
    ul {
        padding-left: 8px;
    }
}

#editor-holder .scroller-shadow {
    width: 100%;
}

.scroller-shadow {
    background-size: 100%;
    background-repeat: no-repeat;
    height: 5px;
    position: fixed;
    z-index: @z-index-brackets-scroller-shadow;
    
    &.top {
        #gradient.vertical(rgba(0,0,0,0.1), rgba(0,0,0,0));
        background-position: 0 -5px;
    }
    
    &.bottom {
        #gradient.vertical(rgba(0,0,0,0), rgba(0,0,0,0.1));
        background-position: 0 5px;
        background-color: transparent; /* override background-color: @endColor from #gradient.vertical */
    }
}


@sprite-size-18: 4px;

/** Classes for icons from jsTreeSprites.svg 
*/
.jstree-sprite {
    background-image: url("images/jsTreeSprites.svg");
    background-repeat: no-repeat;
    background-color: transparent;
    vertical-align: middle;
    width: @sprite-size-18;
    height: @sprite-size-18;
}

.disclosure-arrow-opened {
    .jstree-sprite;
    display: inline-block;
    background-position: -@sprite-size-18 0px;
}

.disclosure-arrow-closed {
    .jstree-sprite;
    display: inline-block;
    background-position: 0px 0px;
}
ins.jstree-icon {
    left: -12px !important;
}
/** Classes for icons from bracketSprites.png 
*/

.bracket-sprite {
    background-image: url("images/close_btn.svg");
    background-repeat: no-repeat;
    background-color: transparent;
    vertical-align: middle;
    width: 15px;
    height: 16px;
}


.file-status-icon {
    margin: 3px 0 0 8px;
    .bracket-sprite;
    display: inline-block;
    position: absolute;
    left: 0px;
    top: 1px;
    
    &.dirty {
        background-position: -30px 0;
    }
    
    &.can-close {
        background-position: 0 0;
    }
  
    &.can-close:hover {
        background-position: -15px 0;
    }
    
    &.can-close:active {
        background-position: -15px 1px;
    }
}

/* Styles for inline editors */
.inline-widget {
    background-color:   @inline-background-color-1;
    
    .inline-editor-header {
        padding: 10px 10px 0px 10px;
        
        .filename {
            font-family: @fontstack-sans-serif;
            font-size: 1.1em;
            color: @inline-color-1;
            
            // Filename header is clickable (it's an <a> tag, so we get underscore on hover by
            // default; but the hand cursor is shut off by Bootstrap's reset stylesheet)
            cursor: pointer;
            
            .dirty-indicator {
                .bracket-sprite;
                display: inline-block;
                background-position: -32px 0;
                padding-top: 3px;
            }
            
            .line-number {
                color: @inline-color-2;
            }
        }
    }
    
    .shadow {
        display: block;
        height: 4px;
        width: 100%;
        position: absolute;
        content: " ";
        left: 0;
        z-index: @z-index-brackets-inline-editor-shadow;
    }
    
    .shadow.top {
        top: 0px;
        background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
    }
    
    .shadow.bottom {
        bottom: 0px;
        background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));
    }
    
    .CodeMirror-scroll {
        /* Don't show horizontal scrollbars within an inline editor--we want to scroll the outer editor */
        overflow-x: hidden;
        background-color: transparent;
    }
}

/* CSSInlineEditor rule list */
.related-container {
    @top-margin: 12px;
    
    /*width: 0;*/
    font-family: @fontstack-sans-serif;
    position: fixed;
    width: 250px;
    overflow: hidden;
    /*-webkit-transition: width 0.15s ease-out;*/
    background: @inline-background-color-2;
    
    .selection {
        width: 100%;
        background: #d0d5d5;
        position: absolute;
        -webkit-transition: height 0.1s ease-out;
        -webkit-transition: top 0.1s ease-out;
        border-top: 1px solid darken(@inline-background-color-3, @bc-color-step-size);
        border-bottom: 1px solid lighten(@inline-background-color-3, @bc-color-step-size);
        top: @top-margin;
    }
    
    /*
     * CSS triangle hack with anti-alias workarounds:
     * (a) Use selection-background-color instead of transparent.
     * (b) Use transform scaleX and origin to adjust width.
     */
    .selection:before {
        content: " ";
        position: absolute;
        width: 0;
        height: 0;
        border-top: @triangle-size solid @inline-background-color-3;
        border-bottom: @triangle-size solid @inline-background-color-3;
        border-left: @triangle-size solid @inline-background-color-1;
        margin-top: -@triangle-size;
        top: 50%;
        .scale-x(0.9, left, top);
    }
    
    .related {
        font-size: 12px;
        position: absolute;
        top: 0;
        left: 1px;
        width: 100%;
        
        ul {
            margin: 0;
            padding: @top-margin 0px;
            list-style: none;
        }
            
        li {
            color: @inline-color-2;
            margin: 0;
            overflow: hidden;
            padding: 2px 0px 2px 15px;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .selected {
            color: @inline-color-3;
            -webkit-transition: color 0.1s ease-out .15s;
        }
    }
}

/* This text is used to force the code editor's font to be loaded early on if it's a
   web font. This is necessary in order for the editor's horizontal measurement of text
   to work properly.

   In the future, when we allow the user to switch fonts, we'll need to make sure to
   update the font for this text item whenever the user switches. We'll also need to
   wait to initiate a re-measure in CodeMirror until the new font is loaded (if they
   choose a web font). This library allows for checking if a web font is loaded:

     http://code.google.com/apis/webfonts/docs/webfont_loader.html
*/
.dummy-text {
    position: fixed;
    top: -10000px;
    .code-font();
}


/* Find & Replace search bars - temporary UI, to be replaced with a richer search feature later */

.CodeMirror-dialog {
    position: relative;
    z-index: @z-index-cm-dialog-override;
}

.CodeMirror-dialog > div {
    font-family: @fontstack-sans-serif;
    position: absolute;
    top: 0; left: 0; right: 0;
    background: @background-color-2;
    color: @content-color;
    border-bottom: 1px solid @bc-gray;
    .box-shadow(0 1px 3px 0 fadeout(@bc-black, 70%));
    z-index: 1;
    padding: .5em .8em;
    overflow: hidden;
}

.CodeMirror-dialog input {
    font-family: @fontstack-sans-serif;
    border: 1px solid @content-color-weaker;
    outline: none;
    background: @background-color-3;
    width: 20em;
    margin: .3em .3em;
    color: inherit;
    &.no-results {
        background-color: mix(@background-color-3, #FF0000, 70%);
    }
}

.CodeMirror-searching {
    background-color: inherit;
}


/* Quick Open search bar & dropdown */

.smart_autocomplete_container {
    
    border: 1px solid #999;
    background-color: #FFFFFF;

    /* smart auto complete doesn't correctly position the container
     * so these specific padding and margin values are necessary*/
    padding: 0px 8px 0px 0px;
    margin: 9px 0px 0px 0px;

    .quick-open-path {
        font-size: 11px;
        color: gray;
    }


    li {
        color: black;
        border-bottom: 1px solid;
        list-style: none;
        cursor: pointer;
        padding: 0px 2px 0px 4px;
    }
}

li.smart_autocomplete_highlight {
    background-color: #e0f0fa;
}

.quicksearch-pathmatch {
    font-weight: bold;
    color: #555;
}

.quicksearch-namematch {
    font-weight: bold;
}
