//@import (css) "debug-theme.css";

@import "fabric-icons-inline";

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.hidden {
    display: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif
}

h2 {
    .no-selection();
    font-size: 10pt;
    font-weight: 500;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    .sub {
        color: #9e9e9e;
    }
}

input {
    border-radius: 0;

    &:focus {
        border-color: var(--vscode-input-border);
    }
}

input[type=checkbox] {
    background-color: var(--vscode-checkbox-background);
    color:var(--vscode-checkbox-foreground);
    border-color: var(--vscode-checkbox-border);
}

input[type=text] {
    background-color: var(--vscode-input-background);
    color: var(--vscode-input-foreground);
}

select {
    background-color: var(--vscode-input-background);
    color: var(--vscode-input-foreground);
}

option {
    background-color: var(--vscode-menu-background);
    color: var(--vscode-menu-foreground);
    font-size: 11pt;
}

textarea {
    resize: none;
    flex-grow: 1;
    background-color: var(--vscode-input-background);
    border: 1px solid var(--vscode-input-border);
    color: var(--vscode-input-foreground);
    padding: 4px;
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    border-radius: 0;
}

button {
    .no-selection();
    border: 1px solid var(--vscode-input-border);
    background-color: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
    padding: 6px 8px;
    font-size: 9pt;
    cursor: pointer;
    border-radius: 0;
    transition: background-color 0.15s;

    &.default {
        font-weight: bold;
    }

    &:hover {
        background-color: var(--vscode-button-secondaryHoverBackground);
    }
}

label {
    .no-selection();
    font-size: 9pt;
    position: relative;
    top: -2px;
    cursor: pointer;
}

#loading {
    height: 0;
    width: 0;
    padding: 15px;
    border: 6px solid #ccc;
    border-right-color: #888;
    border-radius: 22px;
    -webkit-animation: rotate 1s infinite linear;
    animation: rotate 1s infinite linear;
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 101;
}

#liveMonitoring {
    position: absolute;
    top: 10px;
    right: 10px;

    &.enabled {
		right: 170px;
	}

    label {
        margin-right: 10px;
    }
}

#refreshTimer {
    position: absolute;
    top: 7px;
    right: 10px;
    display: none;

	select {
		height: 19px;
		font-size: 9pt;
		margin-left: 4px;
	}
}

#loadingOverlay {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color: transparent;
    z-index: 100;
}

@-webkit-keyframes rotate {
    100% {
        -webkit-transform: rotate(360deg);
    }
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

.table {
    .no-selection();
    overflow-x: hidden;
    overflow-y: auto;
    position: absolute;
    top: 22px;
    bottom: 0px;
    font-size: 9pt;
    white-space: nowrap;
    border: 1px solid var(--vscode-panel-border);
    left: 0;
    right: 0;
    margin: 8px;

    i {
        font-size: 1.4em;
        position: relative;
        top: 4px;
        margin-right: 3px;
        margin-top: -4px;
    }
    
    .table-header {
        position: sticky;
        top: 0px;
        display: table;
        table-layout: fixed;
        width: 100%;
        z-index: 1;

        > div {
            text-overflow: ellipsis;
            padding: 4px 12px;
            background-color: var(--vscode-sideBar-background);
            color: var(--vscode-sideBar-foreground);
            border-bottom: 2px solid var(--vscode-titleBar-activeBackground);
            border-right: 1px solid var(--vscode-titleBar-activeBackground);
        }

        .col, .col1, .col2, .col3 {
            overflow: hidden;
            display: table-cell;
        }

        .sortable {
            cursor: pointer;
            position: relative;
        }

        i {
            position: absolute;
            right: 2px;
            top: 7px;
        }
    }

    .table-data {
        display: table;
        table-layout: fixed;
        width: 100%;
        transition: color 0.15s, background-color 0.15s;
        
        > div {
            text-overflow: ellipsis;
            padding: 4px 12px 6px;
            cursor: pointer;
            border-bottom: 1px solid var(--vscode-titleBar-inactiveBackground);
        }
        
        .col, .col1, .col2, .col3 {
            overflow: hidden;
            display: table-cell;
        }

        &:hover {
            background-color: var(--vscode-list-hoverBackground);
            color: var(--vscode-list-hoverForeground);
        }     
        
        &.hidden {
            display: none;
        }
    }

    .selected, .selected:hover {
        background-color: var(--vscode-list-inactiveSelectionBackground);
        color: var(--vscode-list-inactiveSelectionForeground);
    }    
}

.focused {        
    .selected, .selected:hover {
        background-color: var(--vscode-list-activeSelectionBackground);
        color: var(--vscode-list-activeSelectionForeground);
    }
}

.count {
    display: inline-block;
    min-width: 50px;
}

#app {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color: var(--vscode-editor-background);
    color: var(--vscode-foreground);
}

#header {
    padding: 4px 8px;
    font-size: 9pt;
    background-color: var(--vscode-titleBar-activeBackground);
    position: relative;

    h1 {
        font-size: 14pt;
        display: inline-block;
        margin-right: 280px;
    }

    #objectNamePart {
        display: none;
        white-space: nowrap;
    }
}

#workspace {
    display: grid;
    grid-template-rows: 40% 60%;
    height: 100%;
}

#navigation {    
    display: grid;
    grid-template-columns: 37% 28% 35%;

    select {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
    }

    > div {
        padding: 8px;
    }

    .table {
        margin: 8px 8px 6px 8px;
    }
}

#dataSizer {
    background: transparent;
    height: 4px;
    margin: 0 8px;
    z-index: 1;
    background-color: var(--vscode-button-secondaryHoverBackground);

    &:hover {
        background-color: var(--vscode-titleBar-activeBackground);
        cursor: row-resize;
    }
}

#data {
    display: flex;
    flex-direction: column;
}

#objects {
    position: relative;

    .col1 {
        width: 50%;
    }
    
    .col2 {
        width: 30%;
    }

    .col3 {
        width: 20%;
    }

    h2 {
        label {
            font-weight: 10pt;
            top: 0px
        }

        input[type=checkbox] {
            position: relative;
            top: 2px;
        }
    }
}

#columns {
    position: relative;

    .col1 {
        width: 55%;
    }
    
    .col2 {
        width: 45%;
    }

    .primary-key {
        font-weight: bold;
    }
}

#values {
    position: relative;

    .col1 {
        width: 80%;
    }
    
    .col2 {
        width: 20%;
    }

    .count {
        display: inline-block;
        min-width: auto;
        margin-right: 10px;
    }

    h2 {
        button {
            cursor: pointer;
            padding: 2px 4px;
            float: right;
            border: none;
            transition: color 0.15s, background-color 0.15s;

            span {
                margin-left: 6px;
                font-size: 9pt;
                position: relative;
                top: -1px;
            }

            i {
                position: relative;
                top: 1px;
            }
    
            &:hover {
                color: var(--vscode-button-secondaryForeground);
                background-color: var(--vscode-button-secondaryHoverBackground);
            }
        }
    }
}

#btnCopyValues {
}

#filters {
    display: flex;
    flex-direction: row;
    min-height: 128px;

    &.filter-closed {
        display: none;
    }
}

#filtersHeader {
    cursor: pointer;
    margin: 6px 8px 0 8px;
    transition: color 0.15s, background-color 0.15s;

    .btn-hide-filters {
        display: inline-block;
    }

    .btn-show-filters {
        display: none;
    }

    i {
        margin-right: 4px;
        padding: 3px;
        width: 20px;
    }

    &:hover {
        color: var(--vscode-button-secondaryForeground);
        background-color: var(--vscode-button-secondaryHoverBackground);
    }

    &.filter-closed {
        background-color: var(--vscode-titleBar-activeBackground);

        .btn-hide-filters {
            display: none;
        }

        .btn-show-filters {
            display: inline-block;
        }
    }
}

#filtersArea {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 0 8px 8px 8px;

    > div {
        height: 100%;
        display: flex;

        > textarea {
            margin-top: 4px;
        }
    }
}

#filterActions {
    width: 120px;
    position: relative;

    .controls {
        position: absolute;
        top: 3px;
        left: 8px;
        right: 8px
    }

    button {
        width: 100%;
        margin-top: 6px;
    }
}

#dataRows {
    flex-grow: 1;
    position: relative;

    h2 {
        padding: 8px;
    }

    .table {
        overflow-x: auto;

        .col {
            width: 200px;
        }

        .row-index {
            width: 60px;
            text-align: center;
        }

        .selected, .selected:hover {
            background-color: var(--vscode-list-inactiveSelectionBackground);
            color: var(--vscode-list-inactiveSelectionForeground);
        }
    }

    &.focused {
        .cell-selected, .cell-selected:hover {
            background-color: var(--vscode-list-activeSelectionBackground);
            color: var(--vscode-list-activeSelectionForeground);
        }
    }
}

#statusBar {
    .no-selection();
    height: 32px;
    position: relative;
    font-size: 9pt;
    padding: 8px;

    .copyright {
        float: right;
    }

    .info {
        float: left;
        
        span {
            font-weight: bold;
        }
    }
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color: var(--vscode-editor-background);
    opacity: 0.8;
    z-index: 2;
}

#dialogs {
    width: 0;
    height: 0;
}

#dialogViewRecord {
    position: absolute;
    top: 15%;
    left: 20%;
    width: 60%;
    height: 70%;
    margin: 0 auto;

    .table {
        top: 60px;
        
        .col1 {
            width: 30%;
        }

        .selected, .selected:hover {
            background-color: var(--vscode-list-inactiveSelectionBackground);
            color: var(--vscode-list-inactiveSelectionForeground);

            .col2 {
                background-color: var(--vscode-list-activeSelectionBackground);
                color: var(--vscode-list-activeSelectionForeground);
            }
        }
    }

    .header {
        font-size: 10pt;

        span {
            font-weight: bold;
        }
    }
}

.dialog {
    background-color: var(--vscode-editor-background);
    border: 1px solid var(--vscode-window-activeBorder);
    filter: drop-shadow(0 0 0.75rem var(--vscode-widget-shadow));
    z-index: 3;

    .title {
        background-color: var(--vscode-titleBar-activeBackground);
        padding: 4px 8px;
        height: 30px;

        h1 {
            font-size: 12pt;
        }

        button.close {
            position: absolute;
            top: 0;
            right: 0;
            height: 30px;
            background-color: #c9053f;
            border-color: var(--vscode-titleBar-activeBackground);
            color: white;
            padding: 4px 8px;
            transition: background-color 0.15s;

            &:hover {
                background-color: #e81123;
            }

            i {
                position: relative;
                top: 2px;
            }
        }
    }

    .body {
        padding: 8px;
    }
}

#objectTypes {
    position: absolute;
    left: 40px;
}

#objectFilters {
    position: absolute;
    top: 8px;
    right: 8px;
    white-space: nowrap;
    background-color: var(--vscode-editor-background);

    i {
        position: relative;
        top: 1px;
    }

    span {
        font-size: 9pt;
    }

    select {
        position: unset;
        width: auto;
        min-width: 100px;
        height: 18px;
        font-size: 9pt;
    }

    .ms-Icon--FilterSolid {
        display: none;
    }

    &.schema .ms-Icon--Filter {
        display: none;
    }

    &.schema .ms-Icon--FilterSolid {
        display: inline-block;
    }
}

#objectSearch {
    position: absolute;
    top: 9px;
    left: 8px;
    height: 18px;
    background-color: var(--vscode-editor-background);
    padding-top: 1px;
    transition: width 0.15s;
    width: 0%;
    min-width: 20px;

    &.opened {
        width: 50%;
    }

    button {
        border: none;
        cursor: pointer;
        padding: 3px;
        margin: 0;
        transition: color 0.15s, background-color 0.15s;
        position: relative;
        top: -1px;

        &:hover {
            color: var(--vscode-button-secondaryForeground);
            background-color: var(--vscode-button-secondaryHoverBackground);
        }
    }

    > div {
        position: absolute;
        top: 0px;
        left: 20px;
        right: 0px;
        height: 18px;
        overflow: hidden;
    }

    input {
        border: 1px solid var(--vscode-panel-border);
        font-size: 12px;
        height: 18px;
        padding: 3px;
        width: 100%;
        outline: none;
    }

    #clearObjectSearch {
        position: absolute;
        right: 1px;
        top: 3px;
        bottom: 0px;
        cursor: pointer;
        color: var(--vscode-input-foreground);
        background-color: var(--vscode-input-background);
        transition: color 0.15s, background-color 0.15s;
        width: 16px;
        height: 16px;
        overflow: hidden;
        box-sizing: border-box;
        padding: 2px;

        i {
            font-size: 12px;
            position: relative;
            top: -3px;
        }

        &:hover {
            background-color: var(--vscode-input-foreground);
            color: var(--vscode-input-background);
        }
    }
}

#rowsBtnSqlQuery {
    border: none;
    padding: 2px 6px;
    position: relative;
    margin-left: 6px;
    font-weight: bold;

    i {
        margin-right: 4px;
        position: relative;
        top: 2px;
    }
}

#rowsPageSize {
    display: inline-block;
    position: absolute;
    right: 8px;
}

#rowsPager {
    display: none;
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translate(-50%, 0);
    overflow: hidden;
    height: 21px;

    li {
        display: inline-block;
        min-width: 50px;
        height: 21px;
        text-align: center;
        cursor: pointer;
        transition: color 0.15s, background-color 0.15s;

        &:hover, &.clicked {
            background-color: var(--vscode-list-hoverBackground);
            color: var(--vscode-list-hoverForeground);
        }

        &.hidden {
            display: none;
        }

        &.selected {
            background-color: var(--vscode-list-activeSelectionBackground);
            color: var(--vscode-list-activeSelectionForeground);
        }

        &.page {
            font-size: 9pt;

            span {
                position: relative;
                top: 1px;
            }
        }

        i {
            position: relative;
            top: 3px;
        }

        &.left-button, &.right-button {
            visibility: hidden;

            &.visible {
                visibility: visible;
            }
        }        
    }

    &.show-left-buttons {
        .left-button {
            visibility: visible;
        }
    }

    &.show-right-buttons {
        .right-button {
            visibility: visible;
        }
    }
}