* {
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
}
html {
    height: 100%;
}
body {
    height: 100%;
    margin: 0;
}
.output-container {
    padding-top: 50px;
}
form {
    position: fixed;
    display: flex;
    flex-direction: row;
    padding: 10px;
    background: white;
    left: 0;
    right: 0;
    top: 0;
    z-index: 2;
}
#input,
textarea {
    flex: 1;
    font-size: 1.1em;
    border: 1px solid #999;
    border-width: 1px 0 1px 0;
    padding: 5px;
}
textarea {
    min-height: 40px;
    height: 180px;
}
button  {
    font-size: 1em;
    background-image: linear-gradient(to bottom, #FFF, #CCC);
    border: 1px solid #999;
    border-radius: 5px;
}
.input-right {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-middle {
    border-radius: 0;
}
.input-left {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
#params {
    margin: 8px;
}
.link {
    background: none;
    border: none;
    color: darkblue;
    text-decoration: underline;
    font-size: 1em;
    font-style: italic;
}
#query-suggest {
    position: absolute;
    top: 20px;
    background: white;
    padding: 20px 10px 20px 40px;
    border: 1px solid #999;
    box-shadow: 2px 2px 9px 0px;
}
#query-suggest:empty {
    display: none;
}
#query-suggest li {
    cursor: pointer;
    padding: 2px 20px 2px 10px;
}
#query-suggest li:hover {
    background: rgb(254, 255, 213);
}
#output {
    /* flex: 1; */
    /* border: 1px solid #999; */
    border-radius: 5px;
    margin: 10px;
    white-space: pre;
    /* overflow-y: auto; */
}
table {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    border-collapse: collapse;
    margin: -1px;
}
th {
    background-image: linear-gradient(to bottom, #FFF, #CCC)
}
td,
th {
    border: 1px solid #CCC;
    padding: 3px;
    white-space: pre-wrap;
}
tfoot td {
    font-weight: bold;
}
img {
    position: relative;
    display: inline-block; /* Force new block rendering context */
}
img::after {
    content: "404";
    position: relative;
    width: 64px;
    height: 64px;
    background-color: beige;
    left: 0;
    color: rgba(0,0,0,0.25);
    text-align: left;
    top: 0;
    line-height: 64px;
    font-weight: bold;
    display: block;
    /* background-image: linear-gradient(to bottom right, red, white 10%, red 10%, red 20%, white 20%, white 30%, red 30%, red 40%, white 40%, white 50%, red 50%, red 60%, white 60%, white 70%, red 70%, red 80%, white 80%, white 90%, red 90%); */
}
.null::before {
    content: "null";
    color: #CCC;
    font-style: italic;
}
canvas {
    margin: 16px;
}
@media (max-width: 480px) {
    form,
    #output {
        margin: 3px;
    }
}

#explorer {
    overflow-y: auto;
    background: white;
    width: 320px;
    margin-top: 60px;
    padding: 5px;
    flex: none;
}

#explorer.float {
    /* flex-shrink: 0; */
    position: fixed;
    border-right: 1px solid #999;
    box-shadow: 0 0 4px 2px rgba(0,0,0,0.5);
    top: 60px;
    bottom: 0px;
    left: 5px;
    margin-top: 0;
}

#explorer h2 {
    margin: 0.2em;
    font-size: 1em;
}

#explorer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#explorer .treeview {
    padding-left: 22px;
}

#explorer .treeview::before {
    content: "⏶";
}

#explorer .treeview.collapsed::before {
    content: "⏷";
}

#explorer .treeview.collapsed ul {
    display: none;
}

#explorer li ul {
    text-decoration: none;
}

#explorer li.treeview span,
#explorer li[data-insert],
#explorer li[data-insert-before],
#explorer li[data-insert-after] {
    cursor: pointer;
}

#explorer li.treeview span:hover,
#explorer li[data-insert]:hover,
#explorer li[data-insert-before]:hover,
#explorer li[data-insert-after]:hover {
    text-decoration: underline;
}

#explorer li {
    padding-left: 28px;
    background-repeat: no-repeat;
    background-size: 16px;
    background-position: 4px 4px;
}

#explorer li.schema {
    background-image: url(img/schema.svg);
}

#explorer li.table {
    background-image: url(img/table.svg);
}

#explorer li.view {
    background-image: url(img/view.svg);
}

#explorer li.function {
    background-image: url(img/function.svg);
}

#explorer li.table-function {
    background-image: url(img/table-function.svg);
}

#explorer li.aggregate-function {
    background-image: url(img/aggregate-function.svg);
}

[class^=node-type-] {
    display: flex;
}

[class^=node-type-] ul {
    list-style: none;
    padding-left: 1em;
}

[class^=node-type-] li {
    position: relative;
    display: flex;
    padding: 4px;
}

.node-type-statement {
    border: 1px solid #666;
    background: white;
    padding: 8px;
    white-space: normal;
}

.node-type-statement > ul {
    list-style: none;
    padding: 0;
}

.node-type-clause {
    border: 1px solid #C66;
    background: #FCC;
    padding: 8px;
}

/* These clauses only take a single node rather than a list */
.node-type-clause.node-id-where > ul,
.node-type-clause.node-id-having > ul,
.node-type-clause.node-id-limit > ul,
.node-type-clause.node-id-offset > ul {
    list-style: none;
    padding: 0;
}

.node-type-clause > .node-id {
    font-weight: bold;
}

.node-type-operator {
    border: 1px solid #6C6;
    background: #CFC;
    padding: 8px;
    align-items: center;
}

.node-type-function-call {
    border: 1px solid #66C;
    background: #CCF;
    padding: 8px;
    border-radius: 13px;
    align-items: center;
}

.node-type-symbol {
    background: white;
    border: #999 1px solid;
    padding: 2px 8px 4px;
    border-radius: 13px;
}

.node-type-constant {
    border: 1px solid hsl(36, 82%, 26%);
    background: hsl(36, 82%, 95%);
    color: hsl(36, 82%, 26%);
    padding: 4px 8px;
}

.node-id {
    margin-right: 32px;
}

.node-alias {
    color: #666;
    border:  1px solid #999;
    padding:  0px 8px;
    background-color: #f0f0f0;
    position: relative;
    display: inline-block;
    height: 30px;
    line-height: 28px;
}

.node-type-symbol + .node-alias ,
.node-type-param + .node-alias {
    left: -12px;
}

.node-alias::before {
    content: "";
    border: 15px solid transparent;
    border-right-color: #aaa;
    position: absolute;
    left: -30px;
    top: -1px;
    height: 0;
}

.node-alias::after {
    content: "";
    border: 14px solid transparent;
    border-right-color: #f0f0f0;
    position: absolute;
    left: -28px;
    top: 0;
    height: 0;
}

.node-type-symbol,
.node-type-string,
.node-type-number
{
    display: inline-block;
}

.node-type-number .node-id {
    color: blue;
}

.node-type-string .node-id {
    color: orangered;
}

.node-type-string .node-id::before,
.node-type-string .node-id::after {
    content: "'";
}

.node-type-list {
    border-left: 5px double rgba(0,0,0,0.2);
    background: #ffe7a5;
    padding: 8px;
}

.node-type-list > .node-id {
    display: none;
}

.node-type-list > ul {
    padding: 0;
}


.node-type-param {
    border: 1px dashed #4c3100;
    background: #ece9c5;
    padding: 0 0 2px 8px;
    border-radius: 13px;
}