
:root{
    --tree-line-height: 25px;
    --tree-label-line-height: 23px;
    --tree-label-height: 20px;
    --tree-line-icon-dim: 20px;

    --tree-control-fill: var(--primary-lighter);
    --tree-control-stroke: #333;
    --tree-path-stroke: #333;
    --tree-end-fill: var(--primary-lighter);

    --tree-line-icon-color: var(--primary-darker);
    --tree-stripe-shade: rgba(0,0,0,0.05);
    --tree-select-shade: var(--primary-lighter);
    --tree-indeterminate-shade: rgba(0,0,0,0.1);

    --drop-hover-flash-color: var(--secondary-darker); /*danger*/

    --flasher-height: 4px;

    --tree-drag-bg: rgba(255,255,255,0.5);

    --tree-first-root-placeholder-bg: #CCC;
    --tree-first-root-placeholder-border: #333;
}

[data-theme="dark"] {
    --tree-control-fill: var(--primary-dark);
    --tree-control-stroke: #ccc;
    --tree-path-stroke: #ccc;
    --tree-end-fill:  var(--primary-dark);

    --tree-line-icon-color: var(--primary-lighter);
    --tree-stripe-shade: rgba(255,255,255,0.05);
    --tree-select-shade: var(--primary-dark);
    --tree-indeterminate-shade: rgba(255,255,255,0.1);

    --drop-hover-flash-color: var(--primary-lighter);
    
    --tree-drag-bg: rgba(0,0,0,0.5);

    --tree-first-root-placeholder-bg: #555;
    --tree-first-root-placeholder-border: #CCC;
}

.roux-tree
{
    display: flex;
    flex-direction: column;
    margin-left: var(--input-left-margin);
    width: fit-content;
    position: relative;
}

/*
.roux-tree.striped .tree-line:nth-of-type(odd)
{
    background-color: var(--tree-stripe-shade);
}
*/


.roux-tree .tree-line
{
    display: flex;
    flex-direction: row;
    /* height: 19px; */
    height: var(--tree-line-height);

    align-items: center;

    opacity: 0;
    position: relative;
    top: -10px;
    transform: translate(0,0);
    --delay: 0s;
    animation-delay: --delay;
    animation-name: cascade;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
    animation-direction: alternate;

    padding: 0px 5px 0px 0px;

    cursor: pointer;
}

.roux-tree .tree-line.hidden
{
    display: none;
}

.roux-tree .tree-line > .tree-tab
{
    width: var(--tree-line-height);
    height: var(--tree-line-height);
}

.roux-tree .tree-line > .tree-tab svg
{
    width: var(--tree-line-height);
    height: var(--tree-line-height);
}

.roux-tree .tree-line > .tree-control
{
    width: var(--tree-line-height);
    height: var(--tree-line-height);
}

.roux-tree .tree-line > .tree-control svg
{
    width: var(--tree-line-height);
    height: var(--tree-line-height);
}

.roux-tree .tree-line > .tree-control
{
    /* width: 19px; */
    cursor: pointer;
    height: var(--tree-line-height);
}

.roux-tree .tree-line .tree-line-body
{
    display: flex;
    flex-direction: row;
    padding-left: 2px;
    position: relative;
}

.roux-tree .tree-line .tree-line-body.drop-placeholder
{
    width: 200px;
    /* background-color: red; */
    height: 20px;
    border-radius: 15px;
    /* background-color: var(--tree-select-shade); */
    background-color: var(--drop-hover-flash-color);
}

.roux-tree .tree-line:has(.tree-line-body.drop-placeholder)
{
    animation-delay: 0s;
    animation-name: none;
    opacity: 1;
    top: 0px;
}

.roux-tree .tree-line.no-anim
{
    animation-delay: 0s;
    animation-name: none;
    opacity: 1;
    top: 0px;
}

.roux-tree .tree-line .tree-line-body.roux-tree-droppable:hover:not(:has(.tree-drag-drop-zone:hover))
{
    border-radius: 15px;
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-name: background-color-flash;
}

.roux-tree .tree-line .tree-line-label
{
    height: var(--tree-label-height);
    line-height: var(--tree-label-line-height);
    padding: 0px 5px 2px 5px;
    border-radius: 15px;

    transition: background-color 0.4s;
    user-select: none;
}

.roux-tree .tree-line.selected .tree-line-label
{
    background-color: var(--tree-select-shade);
}

.roux-tree .tree-line.selected.indeterminate .tree-line-label
{
    background-color: var(--tree-indeterminate-shade);
}

.roux-tree .tree-line .tree-line-body.roux-tree-droppable:hover .tree-line-label
{
    background-color: transparent;
}

.tree-control.collapser > svg > circle, .tree-control.expander > svg > circle, .tree-tab.childless > svg > circle
{
    fill: var(--tree-control-fill);
    transition: stroke 0.4s, fill 0.4s;
}

.tree-control.collapser > svg > path, .tree-control.expander > svg > path
{
    stroke: var(--tree-control-stroke);
    stroke-width: 1;
    stroke-linecap: "round";

    transition: stroke 0.4s, fill 0.4s;
}

.tree-tab.branch > svg > path, .tree-tab.pass > svg > path, .tree-tab.end > svg > path, .tree-tab.childless > svg > path
{
    stroke: var(--tree-path-stroke);
    stroke-width: 1;
    stroke-linecap: "butt";
    transition: stroke 0.4s, fill 0.4s;
}

.tree-end
{
    height: 19px;
    width: 0px;
}

.tree-end > svg > circle
{
    fill: var(--tree-end-fill);
    transition: stroke 0.4s, fill 0.4s;
    opacity: 0;
}

.roux-tree .tree-line .tree-line-icon
{
    height: var(--tree-line-icon-dim);
    width: var(--tree-line-icon-dim);

    line-height: var(--tree-line-height);

    padding-right: 3px;

    color: var(--tree-line-icon-color);
    transition: border-right 0.4s, color 0.4s, background-color 0.4s;  
}

.tabs-overflow-icon > svg
{
    height: var(--tree-line-icon-dim);
    width: var(--tree-line-icon-dim);
}

@keyframes cascade {
    to {
        transform: translate(0, 10px);
        opacity: 1;
    }
  }

.roux-tree .roux-input:has(.roux-tree-check)
{
    margin-left: 0px;
    margin-bottom: 0px;
    padding-right: 0px;
}

#rouxTreeDragDiv{
    position: absolute;
}

.branch-wrapper
{
    transition: opacity 0.4s; 
    position: relative;
}

.tree-drag-drop-zone
{
    background-color: transparent; /*var(--drop-hover-flash-color);*/
    position: absolute;
    width: 100%;
    height: 7px;
    cursor: pointer;
    opacity: 1;
    z-index: 100;
    
}

.tree-drag-drop-zone.before
{
    top: -2px;
    /* border-top: 2px solid var(--drop-hover-flash-color); */
}

.tree-drag-drop-zone.after
{
    bottom: -2px;
    /* border-bottom: 2px solid var(--drop-hover-flash-color); */
}

.tree-drag-drop-zone.before:hover
{
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-name: top-border-flash;
}

.tree-drag-drop-zone.before.manual-trigger
{
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-name: top-border-flash;
}

.tree-drag-drop-zone.after:hover
{
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-name: bottom-border-flash;
}

/*
.tree-drag-drop-zone:hover
{
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-name: opacity-flash;
}
*/

.roux-tree-drag
{
    background-color: var(--tree-drag-bg);
    border-radius: 10px;
    padding: 5px;;
}

.roux-tree-drop-placeholder
{
    /* height: 25px; */
    /* background-color: red; */
    width: 100%;

    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-name: opacity-flash;
}

.roux-tree.shift-up
{
    top:calc(var(--tree-line-height) * -1);
}

.roux-tree .roux-tree-empty-drop-zone
{
    margin-top: 5px;
    width: 300px;
    height: 26px;
    border-radius: 15px;
    background-color: var(--tree-first-root-placeholder-bg);
    cursor: pointer;
    border: 1px dashed var(--tree-first-root-placeholder-border);
}

.roux-tree .roux-tree-empty-drop-zone.active
{
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-name: empty-background-color-flash;
}

/*
.roux-tree-scroll-up-zone
{
    position: absolute;
    top: 0px;
    width: 100%;
    height: 60px;
    background-color:red;
    opacity:0.4;
}

.roux-tree-scroll-down-zone
{
    position: absolute;
    bottom: 0px;
    width: 100%;
    height: 60px;
    background-color:red;
    opacity:0.4;
}
*/
@keyframes opacity-flash {
    0%   {
        opacity: 0;
    }
    50%  {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes bottom-border-flash {
    0%   {
        border-bottom: var(--flasher-height) solid transparent;
    }
    50%  {
        border-bottom: var(--flasher-height) solid var(--drop-hover-flash-color);
    }
    100% {
        border-bottom: var(--flasher-height) solid transparent;
    }
}

@keyframes top-border-flash {
    0%   {
        border-top: var(--flasher-height) solid transparent;
    }
    50%  {
        border-top: var(--flasher-height) solid var(--drop-hover-flash-color);
    }
    100% {
        border-top: var(--flasher-height) solid transparent;
    }
}

@keyframes background-color-flash {
    0%   {
        background-color: transparent;
    }
    50%  {
        background-color: var(--drop-hover-flash-color);
    }
    100% {
        background-color: transparent;
    }
}

@keyframes empty-background-color-flash {
    0%   {
        background-color: transparent;
    }
    50%  {
        background-color: var(--tree-first-root-placeholder-bg);
    }
    100% {
        background-color: transparent;
    }
}