/* App */
* { margin: 0; box-sizing: border-box; }
body{
    background-color: rgb(0,0,0);
    /*no scroll*/
    overflow: hidden;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

header{
    height: 40px;
}

footer{
    height: 23px;
}

.main{
    position: relative;
    flex:1;
}

/* Fill the screen */
html, body{
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    right:0;
    margin: 0;
}

input, textarea{
    
    font-size: inherit;
    color: inherit;

    box-sizing: border-box;
    height:100%;

    min-width:4ch; 
    border: none; 
    outline: none;
    background: none;
    padding: 0.5px 1px;
}

input{
    cursor:default;
    user-select: none;
    -webkit-user-select: none;
}

button{
    
    color: inherit;
    background-color: #1e1e1e;
    border: #494949 solid 1px;
    outline: inherit;
    box-sizing: border-box;
}

button:hover{
    background-color: #333333;
}

img{
    display: block;
}

input[disabled],textarea[disabled] {pointer-events:none}

footer{
    bottom: 0px;
    left: 0px;
    right: 0px;
    height: 50px;
    background-color: #000000;
    z-index: 10;
}

/* Scrollbar */
/* Works on Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgb(132, 132, 132) orange;
  }
  
  /* Works on Chrome, Edge, and Safari */
  *::-webkit-scrollbar {
    width: 12px;
  }
  
  *::-webkit-scrollbar-track {
    background: rgb(16, 16, 16);
  }
  
  *::-webkit-scrollbar-thumb {
    background-color: rgb(73, 73, 73);
    border: none;
  }

/*Node*/

.node{
    user-select: none;
    -webkit-user-select: none;
    z-index: 5;
    background-color: #000000;
}

.node-preview{
    margin: 20px auto;
    position: relative;
}

.normal-node{
    width: 140px;
    min-height: 24px;

    box-sizing: border-box;
    
}

.simple-node{
    width: 120px;
    min-height: 20px;

    box-sizing: border-box;
    block-size: fit-content;
}

.simple-node .node-label{
    max-width: 100%;
    flex-grow: 1;
}

.round-node{
    border-radius: 50%;
    width: 30px;
    height: 30px;
}


.round-node .node-content{
    
    width: 30px;
    height: 30px;
}

.round-node .node-label{
    
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

:is(.normal-node,.simple-node) .node-label{
    font-size: 12px;
    line-height: 14px;
    text-wrap: nowrap;
    padding: 4px 10px 4px 10px;
}

.node-selection{
    position: absolute;
    top: -5px;
    left: -5px;
    bottom: -5px;
    right: -5px;

    box-sizing: border-box;
    pointer-events: none;
    border-image: url(/select.png) 50% round;
    border-width: 2px;
    border-style: solid;
    border-image-width: 12px;
    image-rendering: pixelated;
    filter: opacity(0);
}

.node.hover .node-selection{
    /* blue border */
    filter: opacity(0.3);
}

.node.selected .node-selection{
    /* green border */
    filter: invert(66%) sepia(76%) saturate(5039%) hue-rotate(87deg) brightness(127%) contrast(114%);
}

.node.functional-selected .node-selection{
    /* green border */
    filter: invert(66%) sepia(76%) saturate(5039%) hue-rotate(20deg) brightness(127%) contrast(114%);
}

.node-border-container{
    /* a trick to make the border thiner than 1px */
    pointer-events: none;
    position: absolute;
    left: 0px;
    top: 0px;
    bottom: 0px;
    right: 0px;
    transform: scale(0.1);
    transform-origin: 50% 50%;
}

.node-border{
    position: absolute;
    top: -450%;
    left: -450%;
    right: -450%;
    bottom: -450%;
    /* The px here is actually 0.1px */
    border: solid 5px;
    border-radius: 20px;
}

.normal-node, .simple-node{
    border-radius: 2px;
}

.round-node .node-border{
    border-radius: 50%;
}

/* 
.node.selected{
    background-color: #54360f8f;
} */

/* Port */

.port{
    height: 15px;
    width: 0px;
    display: flex;
    align-items: center;
}


.port-knob{
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color : #4d4d4d;
}

.port-section{
    margin: 0px 0px 4px 0px;
}

.slot-input-port{
    padding-top : 3px;
    padding-bottom: 3px;
}

.slot-output-port{
    padding-top : 3px;
    padding-bottom: 3px;
}

.slot-input-port .port-knob{
    left: -5px;
}

.slot-output-port .port-knob{
    right: -5px;
}

.port-knob-hitbox{
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color : transparent;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 50%;
}

.round-node .port-knob-hitbox{
    /* reduce the hitbox size so that it is easier to select the node */
    width: 15px;
    height: 15px;
}

.port-label{
    position: absolute;
    white-space: nowrap;
    transition: 0.5s ease-out;
    pointer-events: none;
    
    
    font-size: 12px;
}

:is(.simple-node,.round-node) .slot-input-port .port-label{
    font-size: 10px;
    position: absolute;
    left: auto;
    right: 10px;
    transform: translate(0px,-6px);
}

:is(.simple-node,.round-node) .slot-output-port .port-label{
    font-size: 10px;
    position: absolute;
    left: 10px;
    transform: translate(0px,-6px);
}

.slot-input-port{
    position: relative;
    gap:2px;
}

.slot-output-port{
    position: relative;
    gap:2px;
}



:is(.simple-node,.round-node){
    .port-label{
        color: transparent;
    }
    .port-near-mouse-1 .port-label{
        color: #b5b5b593;
    }
    .port-near-mouse-2 .port-label{
        color: #4f4f4f93;
    }
}

.out-port{
    margin: 5px 1.4px;
}

.slot-output-port .port-label{
    right: 10px;
}

.slot-input-port .port-label{
    left: 10px;
}

/* Control */

.slot-control{
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    gap:2px;

    position: relative;
    margin: 2px 0px 4px 0px;
    padding: 0px 10px;
}

.slot-control:empty{
    height: 0px;
    padding: 0px;
    margin: 0px;
}

.control{
    box-sizing: border-box;
    width: 100%;
    /* border-radius: 2px; */
    overflow: hidden;
    font-size: 12px;
    min-height: 15px;
}

.control-button{
    font-size: 12px;
    border: #828282 solid 1px;
}


.control-image{
    width: 100%;
    height: fit-content;
    object-fit: contain;
}

input:enabled:hover, textarea:enabled:hover{
    background-color: #8d8d8d2b;
}

input:focus-within, textarea:focus-within{
    background-color: #6161612a;
}

input:enabled, textarea:enabled{
    background-color: #b1b1b117;
}

.label{
    font-size: 12px;
    white-space: nowrap;
}

/* Edge */

.edge{
    overflow: visible;

    stroke: rgba(190, 190, 190, 0.712);
    stroke-width: 2;
    stroke-linecap:round;
    pointer-events: none;
}

.edge.hover{
    stroke: #7a7a7a;
}

.edge.selected{
    stroke: #19ff28bb;
}

.edge.functional-selected{
    stroke: #ff7119bb;
}

.edge.data-ready{
    stroke: #009398;
}

.edge-path-hit-box{
    pointer-events: all;
    stroke: transparent;
    stroke-width: 12;
}

.edge-label{
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 10px;
    
}

/* Editor */

.viewport{
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.editor{
    width: 100%;
    height: 100%;
}

.sidebar{
    position: absolute;
    padding: 10px;
    bottom: 0px; 
    top: 0px;
    z-index: 10;
    background-color:rgba(0,0,0);
}

.sidebar-left{
    left: 0px;
    width: 300px;
}

.sidebar-right{
    right: 0px;
    width: 300px;
}

.collapsed .sidebar-container{
    display: none;
}

.sidebar-container{
    height: 100%;
}

.sidebar-slot{
    overflow: scroll;
    user-select: none;
    position: absolute;
    padding: 10px;
    padding-bottom: 100px;
    height:auto;
    bottom: 0px; 
    left: 0px;
    top: 0px;
    right: 0px;
}

.sidebar-slot::-webkit-scrollbar {
  display: none;
}

.sidebar-collapse-left{
    position: absolute;
    bottom: 0;
    right: 0;
    height: 60px;
    width: 30px;
    transform: translate(100%,0);
}

.sidebar-collapse-right{
    position: absolute;
    bottom: 0;
    left: 0;
    height: 60px;
    width: 30px;
    transform: translate(-100%,0);
}

.collapsed{
    width: 0;
    padding: 0;
}

.settings-button{
    position: absolute;
    width: 100%;
    height: 50px;
    bottom: 0px;
    left: 0px;
    text-align: center;
    line-height: 50px;
    font-size: 24px;
    background-color: #000000;
    user-select: none;
    -webkit-user-select: none;
    z-index: 10;
}

.settings-button:hover{
    background-color: #030712;
}

.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: 0 0 800px 50px rgba(0,0,0,0.9) inset;
    pointer-events: none;
  }

/* Hierarchy */

.hierarchy-node{
    
    margin-bottom: 10px;
    padding-bottom: 2px;
    padding-top: 4px;
    border-left: #97d11b solid 3px;
    border-radius: 3px;
    font-size: 18px;
}

.hierarchy-name{
    padding-left: 15px;
}

.hierarchy-indent{
    margin: 10px 20px 0px 20px;
}
/* .hierarchy-child-node-slot{

} */

.hierarchy-leaf-slot{
    justify-content: center;
}

.hierarchy-h1{
    font-size: 18px;

}

/* Pop up */

.popup{
    background-color: #4b4b4b;
    box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
    border-radius: 2px;
    overflow: hidden;
    position:absolute;
    width:200px;
    z-index: 20;
    
    
}
.popup-option{
    padding:10px;
    cursor:pointer;
    /* bottom border */
}

.popup-option:hover{
    background-color: #3d3d3d;
}

/* Inspector */

.text-editor{
    margin: 0px 10px;
    flex: 1;
}

#node_info{
    
    /* resize: vertical;
    overflow: auto; */
}

#node_type{
    
    font-size: 18px;
    line-height: 24px;
}
#output_display{
    overflow:auto;
    white-space: nowrap;
}

.error{
    color: #ff4949;
}


.output-item{
    margin: 5px 0px;
}

hr{
    border: none;
    border-bottom: #373737 solid 1px;
    margin: 10px 0px;
}

.attribute-editor{
    margin: 6px 0px;
}

/* Other */

.flex-vert {
    list-style: none;
    display: flex;
    flex-direction: column; 
    align-items: center;
}

.flex-horiz {
    list-style: none;
    display: flex;
    flex-direction: row;
    align-items: center;
}

.grow {
    flex-grow: 1;
}

.space-evenly { 
  justify-content: space-evenly; 
}

.space-between { 
  justify-content: space-between; 
}  

.full-width {
  width: 100%;
  box-sizing: border-box;
}

.full-height {
    height: 100%;
    box-sizing: border-box;
  }

.no-width {
  width: 0;
}

.middle {
    vertical-align: middle;
}

.center-align {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.left-align {
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.right-align {
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
}

.stretch-align {
  align-items: stretch;
}

.justify-start {
  justify-content: flex-start;
}

.pointerEventsNone {
    pointer-events: none;
}

.display-none{ 
    display: none;
}

.bg{
    position: absolute;
    top: -50000px;
    left: -50000px;
    width: 100000px;
    height: 100000px;
    
    z-index: -10;
}


.settings-page.open{
    display: block;
}

.settings-page{
    display: none;
}


.settings-page-overlay{
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.7);
}

.settings-page-content{
    
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    min-width: 500px;
    height: 60%;
    padding: 50px;
    z-index: 15;
    background-color : rgba(20, 20, 20, 1); 
    border-radius: 3px;
    overflow: scroll;
}

.settings-page-content::-webkit-scrollbar {
    display: none;
}

.settings-page-close{
  position: absolute;
  top: 10px;
  right: 10px;
}
.card-gallery{
    display: flex;
    flex-wrap: wrap;
    justify-content: left;
    align-items: center;
}

.card{
    margin: 10px;
    width: 200px;
    height: 140px;
    border-radius: 8px;
    background-color: rgba(45, 45, 45, 0.54);
    border: #4b4b4b solid 1px;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.card-image{
    width: 100%;
    height: 70%;
    background-size: cover;  
    background-repeat:   no-repeat;
    background-position: center center; 
    cursor: pointer;
}

.card-title{
    font-size: 18px;
    padding: 10px 10px;
    cursor: pointer;
}