/* Custom Elements that are not necessarily Waterbear specific */

wb-search,
wb-accordion {
    display: block;
}


/* HBOX, VBOX layout widgets */

wb-hbox,
wb-vbox {
    display: flex;
    flex: 1 1;
    position: relative;
    overflow: hidden;
}

wb-hbox {
    flex-direction: row;
    height: 100%;
}

wb-vbox {
    position: relative;
    flex-direction: column;
    max-height: 100%
}

wb-leftbox,
wb-rightbox {
    flex-direction: column;
}

wb-workbox,
wb-displaybox {
    display: flex;
    flex: 1 1;
    position: relative;
    overflow: hidden;
    flex-direction: row;
    height: 100%;
}

wb-displaybox {
    border-color: #000000;
    border-width: medium;
    border-style: solid;
}

wb-displaybox:not([selected='true']) {
    display: none;
}

wb-hbox > * {
    flex: 1 1 auto;
}

wb-vbox > * {
    width: 100%;
    flex: 1 1 auto;
}

wb-splitter {
    display: block;
    z-index: 100;
    flex: 0 0 8px;
}

wb-hbox > wb-splitter,
wb-workbox > wb-splitter {
    background-image: linear-gradient(90deg, transparent 4px, rgba(218, 218, 218, 0.5) 4px, transparent 5px);
    background-size: 8px 8px;
    cursor: ew-resize;
}

wb-vbox > wb-splitter {
    background-image: linear-gradient(0deg, transparent 4px, rgba(218, 218, 218, 0.5) 4px, transparent 5px);
    background-image-size: 8px 8px;
    cursor: ns-resize;
}


/* Workspace */

wb-workspace {
    display: flex;
    flex-direction: column;
    flex: 2 1;
}

wb-workspace > header {
    flex: 0 0 34px;
}

wb-workspace > output {
    flex: 0 0 34px;
}

wb-workspace > wb-locals {
    flex: 1 1;
}

wb-workspace > wb-contains {
    flex: 3 1;
    overflow: auto;
}

@keyframes slidey-stripes {
    from {
        background-position-x: 32px;
    }
    to {
        background-position-x: 0;
    }
}

.debugger-paused wb-workspace > wb-contains {
    background: repeating-linear-gradient(45deg, rgba(34, 34, 34, .1), rgba(34, 34, 34, .1) 25%, transparent 25%, transparent 50%) 0 0/32px 32px repeat fixed transparent;
    animation: slidey-stripes 1.5s linear infinite;
}


/* Playground */


/*wb-playground{
    display: flex;
    flex-direction: column;
    flex: 1 1;
}*/


/*wb-playground > header{
    flex: 0 0 34px;
}*/

wb-playground > canvas {
    width: 100%;
    height: 100%;
}


/* Search */

wb-search {
    height: 34px;
}


/* ACCORDION */

wb-accordion {
    overflow: visible;
    padding-left: 6px;
}

wb-accordion[open=true] {
    padding-bottom: 6px;
}

wb-accordion >:not(header) {
    display: none;
}

wb-accordion[open=true] >:not(header) {
    display: inline-block;
    margin-bottom: 6px;
}


/* Sidebar Filtering */

sidebar[filtered=true] wb-accordion >:not(header) {
    display: inline-block;
    /*display everything*/
}

sidebar[filtered=true] wb-step,
sidebar[filtered=true] p,
sidebar[filtered=true] wb-context,
sidebar[filtered=true] wb-expression:not([filtered=true]),
sidebar[filtered=true] wb-accordion > header {
    display: none!important;
    /* hide everything but the filtered expressions */
    margin-bottom: 6px;
}

sidebar[filtered=true] button.availableBlocks {
    display: block;
    position: relative;
    margin-left: -6px;
    padding-left: 45px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 16px;
    color: #000000;
    background-color: #FFFFFF;
    clear: left;
    border: 1px solid #CCC;
    margin-bottom: 6px;
    width: 100%;
}

sidebar[filtered=true] button.availableBlocks:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 100%;
    background-color: #000000;
    /* over-ride colours in app.css */
}

wb-accordion > header {
    display: block;
    position: relative;
    margin-left: -6px;
    padding-left: 45px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 16px;
    color: #777;
    clear: left;
    border: 1px solid #CCC;
    pointer-events: auto;
}

wb-accordion[open=true] > header {
    margin-bottom: 6px;
}

wb-accordion > header * {
    pointer-events: none;
}

.cat-icon {
    width: 30px;
    height: 30px;
    display: inline;
    position: absolute;
    left: 10px;
    top: 5px;
    fill: #666;
}

.cat-icon.big-icon {
    height: 26px;
    left: 6px;
}

wb-accordion > header:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 100%;
    background-color: #CCC;
    /* over-ride colours in app.css */
    pointer-events: none;
}