@import "../../customize.dist/src/less/variables.less";

@tree-bg: #fff;
@tree-fg: #000;
@tree-lines-col: #888;

@drive-hover: #eee;
@drive-hover-light: lighten(@drive-hover, 20%);

@content-bg: @tree-bg;
@content-bg-ro: darken(@content-bg, 10%);
@content-fg: @tree-fg;
@info-box-bg: #ddddff;
@info-box-border: #bbb;
@table-header-fg: #555;
@table-header-bg: #e8e8e8;

@toolbar-bg: #ddd;
@toolbar-fg: #555;
@toolbar-border-col: #ccc;
@toolbar-button-bg: #888;
@toolbar-button-border: #888;
@toolbar-button-bg-hover: #777;
@toolbar-button-fg: #eee;
@toolbar-path-bg: #fff;
@toolbar-path-border: #888;

@size-mobile: 600px;

/* PAGE */

html, body {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    position: relative;
    font-size: 16px;
    overflow: auto;
}

body {
    display: flex;
    flex-flow: column;
}

.unselectable {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.app-container {
    flex: 1;
    overflow: auto;
    width: 100%;
    display: flex;
    flex-flow: row;
    @media screen and (max-width: @size-mobile) {
        display: block;
        #tree {
            resize: none;
            width: 100%;
            max-width: unset;
            border-bottom: 1px solid @toolbar-border-col;
            .category2 {
                margin-top: 0.5em;
            }
        }
    }
}

div:focus {
    outline: none;
}

.fa {
    /*min-width: 17px;*/
    margin-right: 3px;
    font-family: FontAwesome;
}

ul {
    list-style: none;
    padding-left: 0px; // Remove the default padding
}

li {
    padding: 0px 5px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.folder, .file {
    margin-right: 5px;
}

.contextMenu {
    display: none;
    position: absolute;
    z-index: 500;
    li {
        padding: 0;
        font-size: 16px;
        a {
            cursor: pointer;
        }
    }
}

.droppable {
    background-color: #FE9A2E;
    color: #222;
}

.selected {
    border: 1px dotted #bbb;
    background: #666;
    color: #eee;
    margin: -1px;
    .fa-minus-square-o, .fa-plus-square-o {
        color: @tree-fg;
    }
}

.selectedTmp {
    border: 1px dotted #bbb;
    background: #AAA;
    color: #ddd;
    margin: -1px;
    .fa-minus-square-o, .fa-plus-square-o {
        color: @tree-fg;
    }
}

span {
    &.fa-folder, &.fa-folder-open {
        color: #FEDE8B;
        text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
    }
}

/* TREE */


#tree {
    border-right: 1px solid #ccc;
    box-sizing: border-box;
    background: @tree-bg;
    overflow: auto;
    resize: horizontal;
    width: auto;
    white-space: nowrap;
    max-width: 500px;
    min-width: 200px;
    padding: 10px 0px;
    color: @tree-fg;
    li {
        padding: 0 0 0 5px;
        cursor: auto;
        &.collapsed ul {
            display: none;
        }
        input {
            width: ~"calc(100% - 30px)";
        }
        & > span.element-row {
            width: ~"calc(100% + 5px)";
            display: inline-block;
            cursor: pointer;
            margin-left: -5px;
            padding-left: 5px;
        }
        & > span.element-row:not(.selected):not(.active):hover {
            background-color: @drive-hover;
        }
    }
    span.element {
        cursor: pointer;
    }
    .active {
        &:not(.selected):not(.droppable) {
            background-color: darken(@drive-hover, 15%);
        }
    }
    .category2 {
        margin-top: 2em;
        .root {
            &> .fa {
                min-width: 30px;
                cursor: pointer;
            }
        }
    }
    #allfilesTree {
        margin-top: 0;
    }
    #searchContainer {
        text-align: center;
        padding: 5px 0;
        input {
            width: 80%;
        }
    }
    .fa.expcol {
        margin-left: -10px;
        font-size: 14px;
        position: absolute;
        left: -20px;
        top: 9px;
        width: auto;
        height: 11px;
        padding: 0;
        margin: 0;
        background: white;
        z-index: 10;
        cursor: default;
        &:before {
            position:relative;
            top: -1px;
        }
    }

    // Expand/collapse lines
    ul {
        margin: 0px 0px 0px 10px;
        list-style: none;
        padding-left: 10px;
        li {
            position: relative;
            &:before {
                position: absolute;
                left: -15px;
                top: -0.25em;
                content: '';
                display: block;
                border-left: 1px solid @tree-lines-col;
                height: 1em;
                border-bottom: 1px solid @tree-lines-col;
                width: 17.5px;
            }
            &:after {
                position: absolute;
                left: -15px;
                bottom: -7px;
                content: '';
                display: block;
                border-left: 1px solid @tree-lines-col;
                height: 100%;
            }
            &.root {
                margin: 0px 0px 0px -10px;
                &:before {
                    display: none;
                }
                &:after {
                    display: none;
                }
            }
            &:last-child:after {
                display: none;
            }
        }
    }

}

/* CONTENT */

#content {
    box-sizing: border-box;
    background: @content-bg;
    color: @content-fg;
    overflow: auto;
    flex: 1;
    display: flex;
    flex-flow: column;
    position: relative;
    .selectBox {
        display: none;
        background-color: rgba(100, 100, 100, 0.7);
        position: absolute;
        z-index: 50;
    }
    &.readonly {
        background: @content-bg-ro;
    }
    h1 {
        padding-left: 10px;
        margin-top: 10px;
    }
    .info-box {
        line-height: 40px;
        padding-left: 10px;
        margin: 10px auto;
        background: @info-box-bg;
        border: 1px solid @info-box-border;
        border-radius: 5px;
        span {
            cursor: pointer;
            margin-left: 10px;
            float: right;
        }
        &.noclose {
            padding-right: 10px;
        }
    }
    li {
        cursor: default;
        &:not(.header) {
            *:not(input) {
                /*pointer-events: none;*/
            }
            &:hover {
                &:not(.selected, .selectedTmp) {
                    background-color: @drive-hover;
                }
                .name {
                    /*text-decoration: underline;*/
                }
            }
        }
    }
    #folderContent {
        li {
            &.searchResult {
                border-bottom: 1px solid @info-box-border;
                display: block;
                &:hover {
                    background-color: initial;
                }
                table {
                    width: 100%;
                    .label2 {
                        width: 150px;
                        font-size: 15px;
                        text-align: right;
                        padding-right: 15px;
                    }
                    .openDir {
                        a {
                            cursor: pointer;
                            color: #41b7d8;
                            &:hover {
                                color: #014c8c;
                                text-decoration: underline;
                            }
                        }
                    }
                    .path {
                        font-style: italic;
                    }
                    .title {
                        font-weight: bold;
                        cursor: pointer;
                        &:hover {
                            background-color: @drive-hover;
                        }
                    }
                    .col2 {
                        width: 250px;
                    }
                    .icon {
                        width: 50px;
                        font-size: 40px;
                    }
                }
            }
        }
    }
    .element {
        .truncated { display: none; }
    }
    div.grid {
        padding: 20px;
        li {
            display: inline-block;
            margin: 10px 10px;
            width: 140px;
            height: 140px;
            text-align: center;
            vertical-align: top;
            overflow: hidden;
            text-overflow: ellipsis;
            padding-top: 5px;
            padding-bottom: 5px;

            &:not(.selected):not(.selectedTmp) {
                border: 1px solid #CCC;
            }
            .name {
                width: 100%;
                height: 48px;
                margin: 8px 0;
                display: inline-flex;
                //align-items: center;
                justify-content: center;
                overflow: hidden;
                //text-overflow: ellipsis;
            }
            &.element {
                position: relative;
            }
            .truncated {
                display: block;
                position: absolute;
                bottom: 0px;
                left: 0; right: 0;
                text-align: center;
            }
            input {
                width: 100%;
                margin-top: 5px;
            }
            .fa {
                display: block;
                margin: auto;
                font-size: 48px;
                margin: 8px 0;
                text-align: center;
                &.listonly {
                    display: none;
                }
            }
        }
        .listElement {
            display: none;
        }
    }

    .list {
        // Make it act as a table!
        padding-left: 20px;
        ul {
            display: table;
            width: 100%;
            padding: 0px 10px;
        }
        li {
            display: table-row;
            &> span {
                padding: 0 5px;
                display: table-cell;
            }
        }
        li {
            &.header {
                cursor: default;
                color: @table-header-fg;
                span {
                    &:not(.fa) {
                        text-align: left;
                    }
                    &.sortasc, &.sortdesc {
                        float: right;
                    }
                }
                &> span {
                    padding: 15px 5px;
                    &.active {
                        font-weight: bold;
                    }
                    &.clickable {
                        cursor: pointer;
                        &:hover {
                            background: @table-header-bg;
                        }
                    }
                }
            }
        }
        .element {
            span {
                overflow: hidden;
                white-space: nowrap;
                box-sizing: border-box;
                &.icon {
                    width: 30px;
                }
                &.type, &.atime, &.ctime {
                    width: 175px;
                }
                &.title {
                    width: 250px;
                    @media screen and (max-width: 1200px) {
                        display: none;
                    }
                }
                &.folders, &.files {
                    width: 150px;
                }
            }
        }
    }
}

.parentFolder {
    cursor: pointer;
    margin-left: 10px;
    &:hover {
        text-decoration: underline;
    }
}

#folderContent {
    padding-right: 10px;
    flex: 1;
}


/* Toolbar */

#driveToolbar {
    background: @toolbar-bg;
    color: @toolbar-fg;
    height: 30px;
    display: flex;
    flex-flow: row;
    border-top: 1px solid @toolbar-border-col;
    border-bottom: ;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 100;
    box-sizing: content-box;
    padding: 0 6px;

    .newPadContainer {
        display: inline-block;
        height: 100%;
    }

    button {
        height: 24px;
        font: @toolbar-button-font;
        span {
            font: @toolbar-button-font;
        }
        .fa, &.fa {
            font-family: FontAwesome;
        }
        &.element {
            border-radius: 2px;
            background: @toolbar-button-bg;
            color: @toolbar-button-fg;
            font-size: 14px;
            border: 1px solid @toolbar-button-border;
            font-weight: bold;
            &:hover {
                background: @toolbar-button-bg-hover;
            }
        }
        &.new {
            padding: 0 5px;
        }
    }
    /* The container <div> - needed to position the dropdown content */
    .dropdown-bar {
        margin: 2px 2px;
        line-height: 1em;
        position: relative;
        display: inline-block;
    }
    .right {
        float: right;
        /* Right-side buttons */
        button {
            display: inline-block;
            &.active {
                display: none;
            }
            .fa {
                margin-right: 0px;
            }
        }
    }
    .dropdown-bar-content {
        margin-right: 2px;
    }

    .leftside {
        width: 250px;
        margin: 0;
        padding: 0;
    }
    .rightside {
        margin: 0;
        padding: 0;
        flex: 1;
    }
    .path {
        display: inline-block;
        height: 100%;
        line-height: 30px;
        cursor: default;
        width: auto;
        overflow: hidden;
        white-space: nowrap;
        direction: rtl;
        .element {
            padding: 5px;
            border: 1px solid @toolbar-bg;
            border-radius: 2px;
            box-sizing: border-box;
            &.clickable {
                cursor: pointer;
                &:hover {
                    background: @toolbar-path-bg;
                    border: 1px solid @toolbar-path-border;
                }
            }
        }
    }
    #contextButtonsContainer {
        float: right;
        margin: 2px;
        button {
            vertical-align: top;
        }
    }
}